Interface CrossfireServerConnection
- All Superinterfaces:
AskfaceQueue,ServerConnection
- All Known Implementing Classes:
AbstractCrossfireServerConnection,DefaultCrossfireServerConnection
Adds encoding/decoding of crossfire protocol packets to a
ServerConnection.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCrossfireAccountListener(@NotNull CrossfireAccountListener listener) Adds a listener to be notified about account events.voidaddCrossfireComcListener(@NotNull CrossfireComcListener listener) Adds a listener to be notified about received comc commands.voidaddCrossfireDrawextinfoListener(@NotNull CrossfireDrawextinfoListener listener) Adds a new listener monitoring the drawextinfo S->C messages.voidaddCrossfireDrawinfoListener(@NotNull CrossfireDrawinfoListener listener) Adds a new listener monitoring the drawinfo S->C messages.voidaddCrossfireFailureListener(@NotNull CrossfireFailureListener listener) Adds a listener to be notified of failure messages.voidaddCrossfireMagicmapListener(@NotNull CrossfireMagicmapListener listener) Adds a listener from the list of objects listening to magicmap messages.voidaddCrossfireMapScrollListener(@NotNull CrossfireMapScrollListener listener) Registers a listener to be called whenever the map was scolled.voidaddCrossfireMusicListener(@NotNull CrossfireMusicListener listener) Adds a listener to be notified about received music commands.voidaddCrossfirePickupListener(@NotNull CrossfirePickupListener listener) Adds a listener to be notified about received "pickup" messages.voidaddCrossfireQueryListener(@NotNull CrossfireQueryListener listener) Adds a new listener monitoring the query S->C messages.voidaddCrossfireSoundListener(@NotNull CrossfireSoundListener listener) Adds a listener to be notified about received sound commands.voidaddCrossfireTickListener(@NotNull CrossfireTickListener listener) Adds a listener to be notified about tick changes.voidaddCrossfireUpdateItemListener(@NotNull CrossfireUpdateItemListener crossfireUpdateItemListener) Adds a listener to be notified about item changes.voidaddPacketWatcherListener(@NotNull ReceivedPacketListener listener) Adds a listener to be notified about received packets.voidaddSentPacketListener(@NotNull SentPacketListener listener) Adds a listener to be notified about sent reply packets.voiddrawextinfo(int color, int type, int subtype, String message) Pretends that a drawextinfo message has been received.voidPretends that a drawinfo message has been received.voiddrawInfoSetDebugMode(boolean printMessageTypes) Enables or disables printing of message types.@Nullable StringReturns the current account name.voidremoveCrossfireAccountListener(@NotNull CrossfireAccountListener listener) Removes a listener to be notified about account events.voidremoveCrossfireDrawextinfoListener(@NotNull CrossfireDrawextinfoListener listener) Removes the given listener from the list of objects listening to the drawextinfo S->C messages.voidremoveCrossfireDrawinfoListener(@NotNull CrossfireDrawinfoListener listener) Removes the given listener from the list of objects listening to the drawinfo S->C messages.voidremoveCrossfireFailureListener(@NotNull CrossfireFailureListener listener) Removes a listener to be notified of failure messages.voidremoveCrossfireMagicmapListener(@NotNull CrossfireMagicmapListener listener) Removes a listener from the list of objects listening to magicmap messages.voidremoveCrossfirePickupListener(@NotNull CrossfirePickupListener listener) Removes a listener to be notified about received "pickup" messages.voidremoveCrossfireQueryListener(@NotNull CrossfireQueryListener listener) Removes the given listener from the list of objects listening to the query S->C messages.voidremoveCrossfireUpdateItemListener(@NotNull CrossfireUpdateItemListener crossfireUpdateItemListener) Removes a listener to be notified about item changes.voidremovePacketWatcherListener(@NotNull ReceivedPacketListener listener) Removes a listener to be notified about received packets.voidremoveSentPacketListener(@NotNull SentPacketListener listener) Removes a listener to be notified about sent reply packets.voidsendAccountCharacterCreate(@NotNull String login, @NotNull String password, @NotNull Collection<String> attributes) Sends a request to create a new character associated to the account.voidsendAccountCreate(@NotNull String login, @NotNull String password) Sends a request to create a new account.voidsendAccountLink(int force, @NotNull String login, @NotNull String password) Sends a request to add an existing character to an account.voidsendAccountLogin(@NotNull String login, @NotNull String password) Asks for an account login.voidsendAccountPassword(@NotNull String currentPassword, @NotNull String newPassword) Sends a request to change the account's password.voidsendAccountPlay(@NotNull String name) Sends a request to play a character from an account.voidSends an "addme" command to the server.voidsendApply(int tag) Sends an "apply" command to the server.voidsendExamine(int tag) Sends an "examine" command to the server.voidsendLock(boolean val, int tag) Sends a "lock" command to the server.voidsendLookat(int dx, int dy) Sends a "lookat" command to the server.voidsendMark(int tag) Sends a "mark" command to the server.voidsendMove(int to, int tag, int nrof) Sends a "move" command to the server.intSends a "ncom" command to the server.voidsendRawString(@NotNull String command) Sends an arbitrary string command to the server.voidSends a "reply" command to the server.voidsendRequestinfo(@NotNull String infoType) Sends a "requestinfo" command to the server.voidSends a "setup" command to the server.voidsendToggleextendedtext(@org.jetbrains.annotations.NotNull int... types) Sends a "toggleextendedtext" command to the server.voidsendVersion(int csval, int scval, @NotNull String vinfo) Sends a "version" command to the server.voidsetCrossfireUpdateMapListener(@NotNull CrossfireUpdateMapListener listener) Sets a listener to be notified about map changes.voidsetPreferredMapSize(int preferredMapWidth, int preferredMapHeight) Sets the preferred map size.voidsetPreferredNumLookObjects(int preferredNumLookObjects) Sets the maximum number of objects in the ground view.voidstart()Starts operation.voidstop()Stops operation.Methods inherited from interface com.realtime.crossfire.jxclient.faces.AskfaceQueue
addFaceReceivedListener, sendAskfaceMethods inherited from interface com.realtime.crossfire.jxclient.server.server.ServerConnection
addClientSocketListener, connect, disconnect, removeClientSocketListener
-
Method Details
-
start
void start()Starts operation. -
stop
Stops operation.- Throws:
InterruptedException- if stopping was interrupted
-
addCrossfireDrawinfoListener
Adds a new listener monitoring the drawinfo S->C messages.- Parameters:
listener- the listener to remove
-
removeCrossfireDrawinfoListener
Removes the given listener from the list of objects listening to the drawinfo S->C messages.- Parameters:
listener- the listener to remove
-
addCrossfireDrawextinfoListener
Adds a new listener monitoring the drawextinfo S->C messages.- Parameters:
listener- the listener to remove
-
removeCrossfireDrawextinfoListener
Removes the given listener from the list of objects listening to the drawextinfo S->C messages.- Parameters:
listener- the listener to remove
-
addCrossfireQueryListener
Adds a new listener monitoring the query S->C messages.- Parameters:
listener- the listener to remove
-
removeCrossfireQueryListener
Removes the given listener from the list of objects listening to the query S->C messages.- Parameters:
listener- the listener to remove
-
addCrossfireMagicmapListener
Adds a listener from the list of objects listening to magicmap messages.- Parameters:
listener- the listener to add
-
removeCrossfireMagicmapListener
Removes a listener from the list of objects listening to magicmap messages.- Parameters:
listener- the listener to remove
-
addCrossfireMapScrollListener
Registers a listener to be called whenever the map was scolled.- Parameters:
listener- the listener
-
addCrossfireUpdateItemListener
void addCrossfireUpdateItemListener(@NotNull @NotNull CrossfireUpdateItemListener crossfireUpdateItemListener) Adds a listener to be notified about item changes.- Parameters:
crossfireUpdateItemListener- the listener to add
-
removeCrossfireUpdateItemListener
void removeCrossfireUpdateItemListener(@NotNull @NotNull CrossfireUpdateItemListener crossfireUpdateItemListener) Removes a listener to be notified about item changes.- Parameters:
crossfireUpdateItemListener- the listener to remove
-
setCrossfireUpdateMapListener
Sets a listener to be notified about map changes. At most one such listener may be set.- Parameters:
listener- the listener
-
addCrossfireTickListener
Adds a listener to be notified about tick changes.- Parameters:
listener- the listener to add
-
addCrossfireSoundListener
Adds a listener to be notified about received sound commands.- Parameters:
listener- the listener to add
-
addCrossfireMusicListener
Adds a listener to be notified about received music commands.- Parameters:
listener- the listener to add
-
addCrossfireComcListener
Adds a listener to be notified about received comc commands.- Parameters:
listener- the listener to add
-
addCrossfirePickupListener
Adds a listener to be notified about received "pickup" messages.- Parameters:
listener- the listener to add
-
removeCrossfirePickupListener
Removes a listener to be notified about received "pickup" messages.- Parameters:
listener- the listener to remove
-
addPacketWatcherListener
Adds a listener to be notified about received packets.- Parameters:
listener- the listener to add
-
removePacketWatcherListener
Removes a listener to be notified about received packets.- Parameters:
listener- the listener to add
-
addSentPacketListener
Adds a listener to be notified about sent reply packets.- Parameters:
listener- the listener to add
-
removeSentPacketListener
Removes a listener to be notified about sent reply packets.- Parameters:
listener- the listener to add
-
addCrossfireAccountListener
Adds a listener to be notified about account events.- Parameters:
listener- the listener to add
-
removeCrossfireAccountListener
Removes a listener to be notified about account events.- Parameters:
listener- the listener to remove
-
addCrossfireFailureListener
Adds a listener to be notified of failure messages.- Parameters:
listener- the listener to add
-
removeCrossfireFailureListener
Removes a listener to be notified of failure messages.- Parameters:
listener- the listener to remove
-
drawInfo
Pretends that a drawinfo message has been received.- Parameters:
message- the messagecolor- the color
-
drawextinfo
Pretends that a drawextinfo message has been received.- Parameters:
type- the message typesubtype- the message subtypemessage- the messagecolor- the color
-
drawInfoSetDebugMode
void drawInfoSetDebugMode(boolean printMessageTypes) Enables or disables printing of message types.- Parameters:
printMessageTypes- whether to enable or disable message types
-
sendAccountLogin
Asks for an account login.- Parameters:
login- the account loginpassword- the account password
-
sendAccountPlay
Sends a request to play a character from an account.- Parameters:
name- the character's name to play
-
sendAccountLink
Sends a request to add an existing character to an account.- Parameters:
force- 0 to allow failure, 1 to force in certain situationslogin- the character's loginpassword- the character's password
-
sendAccountCreate
Sends a request to create a new account.- Parameters:
login- the account loginpassword- the account password
-
sendAccountCharacterCreate
void sendAccountCharacterCreate(@NotNull @NotNull String login, @NotNull @NotNull String password, @NotNull @NotNull Collection<String> attributes) Sends a request to create a new character associated to the account.- Parameters:
login- the character's namepassword- the character's passwordattributes- the character attributes
-
sendAccountPassword
void sendAccountPassword(@NotNull @NotNull String currentPassword, @NotNull @NotNull String newPassword) Sends a request to change the account's password.- Parameters:
currentPassword- current account passwordnewPassword- new account password
-
sendAddme
void sendAddme()Sends an "addme" command to the server. -
sendApply
void sendApply(int tag) Sends an "apply" command to the server.- Parameters:
tag- the item to apply
-
sendExamine
void sendExamine(int tag) Sends an "examine" command to the server.- Parameters:
tag- the item to examine
-
sendLock
void sendLock(boolean val, int tag) Sends a "lock" command to the server.- Parameters:
val- whether to lock the itemtag- the item to lock
-
sendLookat
void sendLookat(int dx, int dy) Sends a "lookat" command to the server.- Parameters:
dx- the x-coordinate in tiles, relative to the playerdy- the y-coordinate in tiles, relative to the player
-
sendMark
void sendMark(int tag) Sends a "mark" command to the server.- Parameters:
tag- the item to mark
-
sendMove
void sendMove(int to, int tag, int nrof) Sends a "move" command to the server.- Parameters:
to- the destination locationtag- the item to movenrof- the number of items to move
-
sendNcom
Sends a "ncom" command to the server.- Parameters:
repeat- the repeat countcommand- the command- Returns:
- the packet id
-
sendRawString
Sends an arbitrary string command to the server.- Parameters:
command- the command
-
sendReply
Sends a "reply" command to the server.- Parameters:
text- the text to reply
-
sendRequestinfo
Sends a "requestinfo" command to the server.- Parameters:
infoType- the info type to request
-
sendSetup
Sends a "setup" command to the server.- Parameters:
options- the option/value pairs to send
-
sendToggleextendedtext
void sendToggleextendedtext(@NotNull @org.jetbrains.annotations.NotNull int... types) Sends a "toggleextendedtext" command to the server.- Parameters:
types- the types to request
-
sendVersion
Sends a "version" command to the server.- Parameters:
csval- the client version numberscval- the server version numbervinfo- the client identification string
-
setPreferredMapSize
void setPreferredMapSize(int preferredMapWidth, int preferredMapHeight) Sets the preferred map size.- Parameters:
preferredMapWidth- the preferred map width in tiles; must be oddpreferredMapHeight- the preferred map height in tiles; must be odd
-
setPreferredNumLookObjects
void setPreferredNumLookObjects(int preferredNumLookObjects) Sets the maximum number of objects in the ground view. Must not be called in connected state.- Parameters:
preferredNumLookObjects- the number of objects- Throws:
IllegalArgumentException- if the number of objects is invalid
-
getAccountName
Returns the current account name.- Returns:
- the current account name or
null
-