Package VASSAL.chat.peer2peer
Class P2PClient
java.lang.Object
VASSAL.chat.peer2peer.P2PClient
- All Implemented Interfaces:
org.litesoft.p2pchat.UserDialog,ServerConnection,ChatServerConnection,PlayerEncoder,ChatControlsInitializer
- Direct Known Subclasses:
ClientTest
public class P2PClient extends Object implements ChatServerConnection, ChatControlsInitializer, org.litesoft.p2pchat.UserDialog, PlayerEncoder
-
Field Summary
Fields Modifier and Type Field Description protected org.litesoft.p2pchat.ActivePeerManagerpeerMgrFields inherited from interface VASSAL.chat.ChatServerConnection
AVAILABLE_ROOMS, DEFAULT_ROOM_NAME, INCOMING_MSG, PLAYER_INFO, ROOM, STATUS, STATUS_SERVERFields inherited from interface VASSAL.build.module.ServerConnection
CONNECTED -
Constructor Summary
Constructors Constructor Description P2PClient(CommandEncoder encoder, MessageBoard msgSvr, WelcomeMessageServer welcomeMessageServer, PeerPool pool)P2PClient(CommandEncoder encoder, MessageBoard msgSvr, WelcomeMessageServer welcomeMessageServer, PeerPool pool, Properties param) -
Method Summary
Modifier and Type Method Description voidaddPropertyChangeListener(PropertyChangeListener l)voidaddPropertyChangeListener(String propertyName, PropertyChangeListener l)Register a PropertyChangeListener.protected voidfireStatus(String msg)Room[]getAvailableRooms()Return an array of all rooms on the serverMessage[]getMessages()MessageBoardgetMessageServer()RoomgetRoom()Return the room currently occupied by the playerRoomManagergetRoomMgr()ServerStatusgetStatusServer()PlayergetUserInfo()Return a Player instance representing the current playervoidinitializeControls(ChatServerControls controls)Register all event listenersbooleanisConnected()StringplayerToString(Player p)voidpostMessage(String msg)voidsendTo(Player recipient, Command c)Send a Command to a particular playervoidsendToAll(String msg)voidsendToOthers(String msg)voidsendToOthers(Command c)Send a command to other players on the servervoidsetActivePeerManager(org.litesoft.p2pchat.ActivePeerManager pActivePeerManager)voidsetConnected(boolean connect)voidsetPendingPeerManager(org.litesoft.p2pchat.PendingPeerManager pPendingPeerManager)voidsetRoom(Room r)Join the given roomvoidsetUserInfo(Player p)Set the Player instance representing this playervoidshowCHAT(org.litesoft.p2pchat.PeerInfo pPeerInfo, String msg)voidshowConnect(org.litesoft.p2pchat.PeerInfo pPeerInfo)voidshowConnectFailed(org.litesoft.p2pchat.PeerInfo pPeerInfo)voidshowDisconnect(org.litesoft.p2pchat.PeerInfo pPeerInfo)voidshowHELO(org.litesoft.p2pchat.PeerInfo pPeerInfo)voidshowNAME(org.litesoft.p2pchat.PeerInfo pPeerInfo)voidshowPMSG(org.litesoft.p2pchat.PeerInfo pPeerInfo, String msg)voidshowStreamsFailed(org.litesoft.p2pchat.PeerInfo pPeerInfo)voidshowUnrecognized(org.litesoft.p2pchat.PeerInfo pPeerInfo, String pBadMessage)PlayerstringToPlayer(String s)voiduninitializeControls(ChatServerControls controls)Remove all previously-registered event listeners
-
Field Details
-
peerMgr
protected org.litesoft.p2pchat.ActivePeerManager peerMgr
-
-
Constructor Details
-
P2PClient
public P2PClient(CommandEncoder encoder, MessageBoard msgSvr, WelcomeMessageServer welcomeMessageServer, PeerPool pool) -
P2PClient
public P2PClient(CommandEncoder encoder, MessageBoard msgSvr, WelcomeMessageServer welcomeMessageServer, PeerPool pool, Properties param)
-
-
Method Details
-
getRoomMgr
-
sendToOthers
Description copied from interface:ServerConnectionSend a command to other players on the server- Specified by:
sendToOthersin interfaceServerConnection
-
sendToAll
-
sendToOthers
-
sendTo
Description copied from interface:ChatServerConnectionSend a Command to a particular player- Specified by:
sendToin interfaceChatServerConnection
-
getRoom
Description copied from interface:ChatServerConnectionReturn the room currently occupied by the player- Specified by:
getRoomin interfaceChatServerConnection
-
setRoom
Description copied from interface:ChatServerConnectionJoin the given room- Specified by:
setRoomin interfaceChatServerConnection
-
getAvailableRooms
Description copied from interface:ChatServerConnectionReturn an array of all rooms on the server- Specified by:
getAvailableRoomsin interfaceChatServerConnection
-
getUserInfo
Description copied from interface:ChatServerConnectionReturn a Player instance representing the current player- Specified by:
getUserInfoin interfaceChatServerConnection
-
setUserInfo
Description copied from interface:ChatServerConnectionSet the Player instance representing this player- Specified by:
setUserInfoin interfaceChatServerConnection
-
setConnected
public void setConnected(boolean connect)- Specified by:
setConnectedin interfaceServerConnection
-
fireStatus
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceServerConnection
-
getMessages
-
postMessage
-
getMessageServer
-
getStatusServer
-
stringToPlayer
- Specified by:
stringToPlayerin interfacePlayerEncoder
-
playerToString
- Specified by:
playerToStringin interfacePlayerEncoder
-
addPropertyChangeListener
Description copied from interface:ServerConnectionRegister a PropertyChangeListener. Changes to connection status triggers a PropertyChangeEvent, and concrete implementations may define other properties- Specified by:
addPropertyChangeListenerin interfaceServerConnection
-
addPropertyChangeListener
-
setActivePeerManager
public void setActivePeerManager(org.litesoft.p2pchat.ActivePeerManager pActivePeerManager)- Specified by:
setActivePeerManagerin interfaceorg.litesoft.p2pchat.UserDialog
-
setPendingPeerManager
public void setPendingPeerManager(org.litesoft.p2pchat.PendingPeerManager pPendingPeerManager)- Specified by:
setPendingPeerManagerin interfaceorg.litesoft.p2pchat.UserDialog
-
showUnrecognized
- Specified by:
showUnrecognizedin interfaceorg.litesoft.p2pchat.UserDialog
-
showStreamsFailed
public void showStreamsFailed(org.litesoft.p2pchat.PeerInfo pPeerInfo)- Specified by:
showStreamsFailedin interfaceorg.litesoft.p2pchat.UserDialog
-
showConnectFailed
public void showConnectFailed(org.litesoft.p2pchat.PeerInfo pPeerInfo)- Specified by:
showConnectFailedin interfaceorg.litesoft.p2pchat.UserDialog
-
showConnect
public void showConnect(org.litesoft.p2pchat.PeerInfo pPeerInfo)- Specified by:
showConnectin interfaceorg.litesoft.p2pchat.UserDialog
-
showDisconnect
public void showDisconnect(org.litesoft.p2pchat.PeerInfo pPeerInfo)- Specified by:
showDisconnectin interfaceorg.litesoft.p2pchat.UserDialog
-
showCHAT
- Specified by:
showCHATin interfaceorg.litesoft.p2pchat.UserDialog
-
showPMSG
- Specified by:
showPMSGin interfaceorg.litesoft.p2pchat.UserDialog
-
showNAME
public void showNAME(org.litesoft.p2pchat.PeerInfo pPeerInfo)- Specified by:
showNAMEin interfaceorg.litesoft.p2pchat.UserDialog
-
showHELO
public void showHELO(org.litesoft.p2pchat.PeerInfo pPeerInfo)- Specified by:
showHELOin interfaceorg.litesoft.p2pchat.UserDialog
-
initializeControls
Description copied from interface:ChatControlsInitializerRegister all event listeners- Specified by:
initializeControlsin interfaceChatControlsInitializer
-
uninitializeControls
Description copied from interface:ChatControlsInitializerRemove all previously-registered event listeners- Specified by:
uninitializeControlsin interfaceChatControlsInitializer
-