Package VASSAL.chat.node
Class NodeClient
java.lang.Object
VASSAL.chat.node.NodeClient
- All Implemented Interfaces:
ServerConnection,ChatServerConnection,LockableChatServerConnection,SocketWatcher,PlayerEncoder,ChatControlsInitializer
- Direct Known Subclasses:
OfficialNodeClient,PrivateNodeClient
public class NodeClient
extends Object
implements LockableChatServerConnection, PlayerEncoder, ChatControlsInitializer, SocketWatcher
- Author:
- rkinney
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NodeRoom[]protected MainRoomCheckerprotected intprotected SimpleRoomprotected Stringprotected CommandEncoderprotected final Stringprotected InviteEncoderprotected NodePlayerprotected Stringprotected PropertyChangeListenerprotected NodeRoomprotected Stringprotected SimpleStatusControlsInitializerprotected final intprotected PrivateChatEncoderprotected PropertyChangeListenerprotected PropertyChangeSupportprotected RoomInteractionControlsInitializerprotected SoundEncoderprotected SynchEncoderprotected final WelcomeMessageServerstatic final StringFields 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, CONNECTION_LOST -
Constructor Summary
ConstructorsConstructorDescriptionNodeClient(String moduleName, String playerId, CommandEncoder encoder, String host, int port, WelcomeMessageServer welcomer) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddPropertyChangeListener(String propertyName, PropertyChangeListener l) Register a PropertyChangeListener.voidcheckCompatibility(NodeRoom targetRoom, boolean compatible, List<String> errors) Deprecated.Use boolean checkCompatibility(NodeRoom targetRoom, Listerrors) booleancheckCompatibility(NodeRoom targetRoom, List<String> errors) static StringcleanVersion(String version) Clean off an ' (Editing)' suffix added to the module version numberprotected voidvoidProcess an invitation request from a player to join a roomvoidKick a player from this roomvoidRoom[]Return an array of all rooms on the serverReturn the name of the default roomgetRoom()Return the room currently occupied by the playerReturn a Player instance representing the current playervoidhandleMessage(String msg) voidProcess a message received from the serverprotected voidvoidinitializeControls(ChatServerControls controls) Register all event listenersbooleanbooleanIs specified room the default room?booleanisInvitable(Player invitee) Can a player be invited to this room by me?booleanisKickable(Player kickee) Can a player be kicked from this room by me?booleanisOwner()Return true if 1.voidLock/Unlock the given roomprotected voidvoidvoidsendInvite(Player invitee) Send Invitation to another player to join the current roomvoidprotected voidvoidSend a Command to a particular playervoidvoidsendToOthers(String msg) voidSend a command to other players on the servervoidsetConnected(boolean connect) voidsetDefaultRoomName(String defaultRoomName) voidJoin the given roomvoidvoidSet the Player instance representing this playervoidsocketClosed(SocketHandler handler) voiduninitializeControls(ChatServerControls controls) Remove all previously-registered event listenersprotected voidupdateRooms(Node module)
-
Field Details
-
ZIP_HEADER
- See Also:
-
propSupport
-
me
-
currentRoom
-
defaultRoomName
-
allRooms
-
moduleName
-
playerId
-
checker
-
compressionLimit
protected int compressionLimit -
encoder
-
roomControls
-
playerStatusControls
-
soundEncoder
-
privateChatEncoder
-
synchEncoder
-
inviteEncoder
-
nameChangeListener
-
profileChangeListener
-
pendingSynchToRoom
-
host
-
port
protected final int port -
welcomer
-
-
Constructor Details
-
NodeClient
public NodeClient(String moduleName, String playerId, CommandEncoder encoder, String host, int port, WelcomeMessageServer welcomer)
-
-
Method Details
-
setConnected
public void setConnected(boolean connect) - Specified by:
setConnectedin interfaceServerConnection
-
registerNewConnection
protected void registerNewConnection() -
initializeConnection
- Throws:
UnknownHostExceptionIOException
-
closeConnection
protected void closeConnection() -
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceServerConnection
-
socketClosed
- Specified by:
socketClosedin interfaceSocketWatcher
-
send
-
setDefaultRoomName
-
getDefaultRoomName
Description copied from interface:LockableChatServerConnectionReturn the name of the default room- Specified by:
getDefaultRoomNamein interfaceLockableChatServerConnection
-
isDefaultRoom
Description copied from interface:LockableChatServerConnectionIs specified room the default room?- Specified by:
isDefaultRoomin interfaceLockableChatServerConnection
-
sendStats
protected void sendStats() -
isOwner
public boolean isOwner()Return true if 1. The current room is the default room OR 2. The current player is the Owner of the current room- Returns:
- true if this player owns the current room
-
sendToOthers
Description copied from interface:ServerConnectionSend a command to other players on the server- Specified by:
sendToOthersin interfaceServerConnection
-
sendToAll
-
forward
-
sendToOthers
-
sendTo
Description copied from interface:ChatServerConnectionSend a Command to a particular player- Specified by:
sendToin interfaceChatServerConnection
-
doKick
Description copied from interface:LockableChatServerConnectionKick a player from this room- Specified by:
doKickin interfaceLockableChatServerConnection
-
isKickable
Description copied from interface:LockableChatServerConnectionCan a player be kicked from this room by me?- Specified by:
isKickablein interfaceLockableChatServerConnection
-
isInvitable
Description copied from interface:LockableChatServerConnectionCan a player be invited to this room by me?- Specified by:
isInvitablein interfaceLockableChatServerConnection
-
sendInvite
Send Invitation to another player to join the current room- Specified by:
sendInvitein interfaceLockableChatServerConnection- Parameters:
invitee- Player to invite
-
doInvite
Process an invitation request from a player to join a room- Specified by:
doInvitein interfaceLockableChatServerConnection- Parameters:
playerId- Inviting player nameroomName- Inviting room
-
getRoom
Description copied from interface:ChatServerConnectionReturn the room currently occupied by the player- Specified by:
getRoomin interfaceChatServerConnection
-
getAvailableRooms
Description copied from interface:ChatServerConnectionReturn an array of all rooms on the server- Specified by:
getAvailableRoomsin interfaceChatServerConnection
-
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
-
getUserInfo
Description copied from interface:ChatServerConnectionReturn a Player instance representing the current player- Specified by:
getUserInfoin interfaceChatServerConnection
-
getMyInfo
-
setUserInfo
Description copied from interface:ChatServerConnectionSet the Player instance representing this player- Specified by:
setUserInfoin interfaceChatServerConnection
-
lockRoom
Description copied from interface:LockableChatServerConnectionLock/Unlock the given room- Specified by:
lockRoomin interfaceLockableChatServerConnection
-
sendRoomInfo
-
setRoom
Description copied from interface:ChatServerConnectionJoin the given room- Specified by:
setRoomin interfaceChatServerConnection
-
setRoom
-
handleMessageFromServer
Process a message received from the server- Parameters:
msg- Encoded message
-
handleMessage
- Specified by:
handleMessagein interfaceSocketWatcher
-
updateRooms
-
stringToPlayer
- Specified by:
stringToPlayerin interfacePlayerEncoder
-
playerToString
- Specified by:
playerToStringin interfacePlayerEncoder
-
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
-
checkCompatibility
@Deprecated(since="2020-03-01") public void checkCompatibility(NodeRoom targetRoom, boolean compatible, List<String> errors) Deprecated.Use boolean checkCompatibility(NodeRoom targetRoom, Listerrors) Check on the compatibility of this client connecting to the target room. Check Vassal version, module version, module CRC- Parameters:
targetRoom- Room to be enteredcompatible- Return true if entry allowederrors- Return a list of error message if entry not allowed.
-
checkCompatibility
-
cleanVersion
Clean off an ' (Editing)' suffix added to the module version number- Parameters:
version-- Returns:
-