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
Modifier and TypeFieldDescriptionprotected NodeRoom[]
protected MainRoomChecker
protected int
protected SimpleRoom
protected String
protected CommandEncoder
protected final String
protected InviteEncoder
protected NodePlayer
protected String
protected PropertyChangeListener
protected NodeRoom
protected String
protected SimpleStatusControlsInitializer
protected final int
protected PrivateChatEncoder
protected PropertyChangeListener
protected PropertyChangeSupport
protected RoomInteractionControlsInitializer
protected SoundEncoder
protected SynchEncoder
protected final WelcomeMessageServer
static final String
Fields inherited from interface VASSAL.chat.ChatServerConnection
AVAILABLE_ROOMS, DEFAULT_ROOM_NAME, INCOMING_MSG, PLAYER_INFO, ROOM, STATUS, STATUS_SERVER
Fields inherited from interface VASSAL.build.module.ServerConnection
CONNECTED, CONNECTION_LOST
-
Constructor Summary
ConstructorDescriptionNodeClient
(String moduleName, String playerId, CommandEncoder encoder, String host, int port, WelcomeMessageServer welcomer) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addPropertyChangeListener
(String propertyName, PropertyChangeListener l) Register a PropertyChangeListener.void
checkCompatibility
(NodeRoom targetRoom, boolean compatible, List<String> errors) Deprecated.Use boolean checkCompatibility(NodeRoom targetRoom, Listerrors) boolean
checkCompatibility
(NodeRoom targetRoom, List<String> errors) static String
cleanVersion
(String version) Clean off an ' (Editing)' suffix added to the module version numberprotected void
void
Process an invitation request from a player to join a roomvoid
Kick a player from this roomvoid
Room[]
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 playervoid
handleMessage
(String msg) void
Process a message received from the serverprotected void
void
initializeControls
(ChatServerControls controls) Register all event listenersboolean
boolean
Is specified room the default room?boolean
isInvitable
(Player invitee) Can a player be invited to this room by me?boolean
isKickable
(Player kickee) Can a player be kicked from this room by me?boolean
isOwner()
Return true if 1.void
Lock/Unlock the given roomprotected void
void
void
sendInvite
(Player invitee) Send Invitation to another player to join the current roomvoid
protected void
void
Send a Command to a particular playervoid
void
sendToOthers
(String msg) void
Send a command to other players on the servervoid
setConnected
(boolean connect) void
setDefaultRoomName
(String defaultRoomName) void
Join the given roomvoid
void
Set the Player instance representing this playervoid
socketClosed
(SocketHandler handler) void
uninitializeControls
(ChatServerControls controls) Remove all previously-registered event listenersprotected void
updateRooms
(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:
setConnected
in interfaceServerConnection
-
registerNewConnection
protected void registerNewConnection() -
initializeConnection
- Throws:
UnknownHostException
IOException
-
closeConnection
protected void closeConnection() -
isConnected
public boolean isConnected()- Specified by:
isConnected
in interfaceServerConnection
-
socketClosed
- Specified by:
socketClosed
in interfaceSocketWatcher
-
send
-
setDefaultRoomName
-
getDefaultRoomName
Description copied from interface:LockableChatServerConnection
Return the name of the default room- Specified by:
getDefaultRoomName
in interfaceLockableChatServerConnection
-
isDefaultRoom
Description copied from interface:LockableChatServerConnection
Is specified room the default room?- Specified by:
isDefaultRoom
in 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:ServerConnection
Send a command to other players on the server- Specified by:
sendToOthers
in interfaceServerConnection
-
sendToAll
-
forward
-
sendToOthers
-
sendTo
Description copied from interface:ChatServerConnection
Send a Command to a particular player- Specified by:
sendTo
in interfaceChatServerConnection
-
doKick
Description copied from interface:LockableChatServerConnection
Kick a player from this room- Specified by:
doKick
in interfaceLockableChatServerConnection
-
isKickable
Description copied from interface:LockableChatServerConnection
Can a player be kicked from this room by me?- Specified by:
isKickable
in interfaceLockableChatServerConnection
-
isInvitable
Description copied from interface:LockableChatServerConnection
Can a player be invited to this room by me?- Specified by:
isInvitable
in interfaceLockableChatServerConnection
-
sendInvite
Send Invitation to another player to join the current room- Specified by:
sendInvite
in interfaceLockableChatServerConnection
- Parameters:
invitee
- Player to invite
-
doInvite
Process an invitation request from a player to join a room- Specified by:
doInvite
in interfaceLockableChatServerConnection
- Parameters:
playerId
- Inviting player nameroomName
- Inviting room
-
getRoom
Description copied from interface:ChatServerConnection
Return the room currently occupied by the player- Specified by:
getRoom
in interfaceChatServerConnection
-
getAvailableRooms
Description copied from interface:ChatServerConnection
Return an array of all rooms on the server- Specified by:
getAvailableRooms
in interfaceChatServerConnection
-
addPropertyChangeListener
Description copied from interface:ServerConnection
Register a PropertyChangeListener. Changes to connection status triggers a PropertyChangeEvent, and concrete implementations may define other properties- Specified by:
addPropertyChangeListener
in interfaceServerConnection
-
addPropertyChangeListener
-
getUserInfo
Description copied from interface:ChatServerConnection
Return a Player instance representing the current player- Specified by:
getUserInfo
in interfaceChatServerConnection
-
getMyInfo
-
setUserInfo
Description copied from interface:ChatServerConnection
Set the Player instance representing this player- Specified by:
setUserInfo
in interfaceChatServerConnection
-
lockRoom
Description copied from interface:LockableChatServerConnection
Lock/Unlock the given room- Specified by:
lockRoom
in interfaceLockableChatServerConnection
-
sendRoomInfo
-
setRoom
Description copied from interface:ChatServerConnection
Join the given room- Specified by:
setRoom
in interfaceChatServerConnection
-
setRoom
-
handleMessageFromServer
Process a message received from the server- Parameters:
msg
- Encoded message
-
handleMessage
- Specified by:
handleMessage
in interfaceSocketWatcher
-
updateRooms
-
stringToPlayer
- Specified by:
stringToPlayer
in interfacePlayerEncoder
-
playerToString
- Specified by:
playerToString
in interfacePlayerEncoder
-
initializeControls
Description copied from interface:ChatControlsInitializer
Register all event listeners- Specified by:
initializeControls
in interfaceChatControlsInitializer
-
uninitializeControls
Description copied from interface:ChatControlsInitializer
Remove all previously-registered event listeners- Specified by:
uninitializeControls
in 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
-