Class AbstractCrossfireServerConnection
java.lang.Object
com.realtime.crossfire.jxclient.server.crossfire.AbstractCrossfireServerConnection
- All Implemented Interfaces:
AskfaceQueue,CrossfireServerConnection,ServerConnection
- Direct Known Subclasses:
DefaultCrossfireServerConnection
public abstract class AbstractCrossfireServerConnection
extends Object
implements CrossfireServerConnection
Abstract base class for
CrossfireServerConnection implementing
classes.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCrossfireServerConnection(@NotNull Model model) Creates a new instance. -
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.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.protected voidInform the various failure listeners that they can clean the last displayed failure.voiddrawextinfo(int color, int type, int subtype, @NotNull 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.protected voidfireAddAccount(@NotNull CharacterInformation characterInformation) protected voidfireAddItemReceived(int location, int tag, int flags, int weight, int faceNum, String name, String namePl, int anim, int animSpeed, int nrof, int type) protected voidfireCommandComcReceived(int packetNo, int time) protected voidfireCommandQueryReceived(@NotNull String prompt, int queryType) protected voidfireCommandSound2Received(int x, int y, int dir, int volume, int type, @NotNull String action, @NotNull String name) protected voidfireCommandSoundReceived(int x, int y, int num, int type) protected voidfireDelinvReceived(int tag) protected voidfireDelitemReceived(int @NotNull [] tags) protected voidfireEndAccountList(int count) protected voidfireFaceReceived(int faceNum, int faceSetNum, int faceChecksum, @NotNull String faceName) protected voidfireFailure(@NotNull String command, @NotNull String arguments) protected voidprotected voidprotected voidfireMarkSent(int tag) Notifies all listeners about a "mark" command that has been sent to the Crossfire server.protected voidfireMusicReceived(@NotNull String music) protected voidfirePickupChanged(int pickupOptions) protected voidfirePlayerReceived(int tag, int weight, int faceNum, @NotNull String name) protected voidNotifies all listeners about a "reply" command that has been sent to the Crossfire server.protected voidfireSelectCharacter(@NotNull String accountName, @NotNull String characterName) protected voidfireStartAccountList(@NotNull String accountName) protected voidprotected voidfireTick(int tickNo) protected voidfireUpditemReceived(int flags, int tag, int valLocation, int valFlags, int valWeight, int valFaceNum, @NotNull String valName, @NotNull String valNamePl, int valAnim, int valAnimSpeed, int valNrof) protected static @NotNull StringnewString(@NotNull ByteBuffer byteBuffer, int start, int len) Extracts a string from aByteBufferrange.protected voidnotifyPacketWatcherListeners(@NotNull String command, @NotNull ClientSocketMonitorCommand args) Notifies allReceivedPacketListenersabout a packet.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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.realtime.crossfire.jxclient.faces.AskfaceQueue
addFaceReceivedListener, sendAskfaceMethods inherited from interface com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection
addCrossfireMapScrollListener, getAccountName, sendAccountCharacterCreate, sendAccountCreate, sendAccountLink, sendAccountLogin, sendAccountPassword, sendAccountPlay, sendAddme, sendApply, sendExamine, sendLock, sendLookat, sendMark, sendMove, sendNcom, sendRawString, sendReply, sendRequestinfo, sendSetup, sendToggleextendedtext, sendVersion, setCrossfireUpdateMapListener, setPreferredMapSize, setPreferredNumLookObjects, start, stopMethods inherited from interface com.realtime.crossfire.jxclient.server.server.ServerConnection
addClientSocketListener, connect, disconnect, removeClientSocketListener
-
Field Details
-
UTF8
TheCharsetused for parsing or encoding strings received from or sent to the Crossfire server.
-
-
Constructor Details
-
AbstractCrossfireServerConnection
Creates a new instance.- Parameters:
model- the model instance to update
-
-
Method Details
-
addCrossfireDrawinfoListener
Description copied from interface:CrossfireServerConnectionAdds a new listener monitoring the drawinfo S->C messages.- Specified by:
addCrossfireDrawinfoListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to remove
-
removeCrossfireDrawinfoListener
Description copied from interface:CrossfireServerConnectionRemoves the given listener from the list of objects listening to the drawinfo S->C messages.- Specified by:
removeCrossfireDrawinfoListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to remove
-
addCrossfireDrawextinfoListener
public void addCrossfireDrawextinfoListener(@NotNull @NotNull CrossfireDrawextinfoListener listener) Description copied from interface:CrossfireServerConnectionAdds a new listener monitoring the drawextinfo S->C messages.- Specified by:
addCrossfireDrawextinfoListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to remove
-
removeCrossfireDrawextinfoListener
public void removeCrossfireDrawextinfoListener(@NotNull @NotNull CrossfireDrawextinfoListener listener) Description copied from interface:CrossfireServerConnectionRemoves the given listener from the list of objects listening to the drawextinfo S->C messages.- Specified by:
removeCrossfireDrawextinfoListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to remove
-
addCrossfireQueryListener
Description copied from interface:CrossfireServerConnectionAdds a new listener monitoring the query S->C messages.- Specified by:
addCrossfireQueryListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to remove
-
removeCrossfireQueryListener
Description copied from interface:CrossfireServerConnectionRemoves the given listener from the list of objects listening to the query S->C messages.- Specified by:
removeCrossfireQueryListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to remove
-
addCrossfireMagicmapListener
Description copied from interface:CrossfireServerConnectionAdds a listener from the list of objects listening to magicmap messages.- Specified by:
addCrossfireMagicmapListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to add
-
removeCrossfireMagicmapListener
Description copied from interface:CrossfireServerConnectionRemoves a listener from the list of objects listening to magicmap messages.- Specified by:
removeCrossfireMagicmapListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to remove
-
addCrossfireUpdateItemListener
public void addCrossfireUpdateItemListener(@NotNull @NotNull CrossfireUpdateItemListener crossfireUpdateItemListener) Description copied from interface:CrossfireServerConnectionAdds a listener to be notified about item changes.- Specified by:
addCrossfireUpdateItemListenerin interfaceCrossfireServerConnection- Parameters:
crossfireUpdateItemListener- the listener to add
-
removeCrossfireUpdateItemListener
public void removeCrossfireUpdateItemListener(@NotNull @NotNull CrossfireUpdateItemListener crossfireUpdateItemListener) Description copied from interface:CrossfireServerConnectionRemoves a listener to be notified about item changes.- Specified by:
removeCrossfireUpdateItemListenerin interfaceCrossfireServerConnection- Parameters:
crossfireUpdateItemListener- the listener to remove
-
addCrossfireTickListener
Description copied from interface:CrossfireServerConnectionAdds a listener to be notified about tick changes.- Specified by:
addCrossfireTickListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to add
-
addCrossfireSoundListener
Description copied from interface:CrossfireServerConnectionAdds a listener to be notified about received sound commands.- Specified by:
addCrossfireSoundListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to add
-
addCrossfireMusicListener
Description copied from interface:CrossfireServerConnectionAdds a listener to be notified about received music commands.- Specified by:
addCrossfireMusicListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to add
-
addCrossfireComcListener
Description copied from interface:CrossfireServerConnectionAdds a listener to be notified about received comc commands.- Specified by:
addCrossfireComcListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to add
-
addPacketWatcherListener
Description copied from interface:CrossfireServerConnectionAdds a listener to be notified about received packets.- Specified by:
addPacketWatcherListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to add
-
addCrossfireAccountListener
Description copied from interface:CrossfireServerConnectionAdds a listener to be notified about account events.- Specified by:
addCrossfireAccountListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to add
-
removeCrossfireAccountListener
Description copied from interface:CrossfireServerConnectionRemoves a listener to be notified about account events.- Specified by:
removeCrossfireAccountListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to remove
-
removePacketWatcherListener
Description copied from interface:CrossfireServerConnectionRemoves a listener to be notified about received packets.- Specified by:
removePacketWatcherListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to add
-
addSentPacketListener
Description copied from interface:CrossfireServerConnectionAdds a listener to be notified about sent reply packets.- Specified by:
addSentPacketListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to add
-
removeSentPacketListener
Description copied from interface:CrossfireServerConnectionRemoves a listener to be notified about sent reply packets.- Specified by:
removeSentPacketListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to add
-
addCrossfirePickupListener
Description copied from interface:CrossfireServerConnectionAdds a listener to be notified about received "pickup" messages.- Specified by:
addCrossfirePickupListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to add
-
removeCrossfirePickupListener
Description copied from interface:CrossfireServerConnectionRemoves a listener to be notified about received "pickup" messages.- Specified by:
removeCrossfirePickupListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to remove
-
addCrossfireFailureListener
Description copied from interface:CrossfireServerConnectionAdds a listener to be notified of failure messages.- Specified by:
addCrossfireFailureListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to add
-
removeCrossfireFailureListener
Description copied from interface:CrossfireServerConnectionRemoves a listener to be notified of failure messages.- Specified by:
removeCrossfireFailureListenerin interfaceCrossfireServerConnection- Parameters:
listener- the listener to remove
-
fireManageAccount
protected void fireManageAccount() -
fireStartAccountList
-
fireAddAccount
-
fireEndAccountList
protected void fireEndAccountList(int count) -
fireStartPlaying
protected void fireStartPlaying() -
fireCommandComcReceived
protected void fireCommandComcReceived(int packetNo, int time) -
fireDelinvReceived
protected void fireDelinvReceived(int tag) -
fireDelitemReceived
protected void fireDelitemReceived(int @NotNull [] tags) -
fireFaceReceived
protected void fireFaceReceived(int faceNum, int faceSetNum, int faceChecksum, @NotNull @NotNull String faceName) -
fireFailure
-
clearFailure
protected void clearFailure()Inform the various failure listeners that they can clean the last displayed failure. -
fireAddItemReceived
-
fireMagicMap
protected void fireMagicMap() -
fireMusicReceived
-
firePickupChanged
protected void firePickupChanged(int pickupOptions) -
firePlayerReceived
-
fireCommandQueryReceived
-
fireCommandSoundReceived
protected void fireCommandSoundReceived(int x, int y, int num, int type) -
fireCommandSound2Received
-
fireTick
protected void fireTick(int tickNo) -
fireUpditemReceived
-
drawInfo
Description copied from interface:CrossfireServerConnectionPretends that a drawinfo message has been received.- Specified by:
drawInfoin interfaceCrossfireServerConnection- Parameters:
message- the messagecolor- the color
-
drawextinfo
Description copied from interface:CrossfireServerConnectionPretends that a drawextinfo message has been received.- Specified by:
drawextinfoin interfaceCrossfireServerConnection- Parameters:
color- the colortype- the message typesubtype- the message subtypemessage- the message
-
drawInfoSetDebugMode
public void drawInfoSetDebugMode(boolean printMessageTypes) Description copied from interface:CrossfireServerConnectionEnables or disables printing of message types.- Specified by:
drawInfoSetDebugModein interfaceCrossfireServerConnection- Parameters:
printMessageTypes- whether to enable or disable message types
-
fireMarkSent
protected void fireMarkSent(int tag) Notifies all listeners about a "mark" command that has been sent to the Crossfire server.- Parameters:
tag- the tag of the marked item
-
fireReplySent
protected void fireReplySent()Notifies all listeners about a "reply" command that has been sent to the Crossfire server. -
notifyPacketWatcherListeners
protected void notifyPacketWatcherListeners(@NotNull @NotNull String command, @NotNull @NotNull ClientSocketMonitorCommand args) Notifies allReceivedPacketListenersabout a packet.- Parameters:
command- the command stringargs- the command arguments
-
newString
@NotNull protected static @NotNull String newString(@NotNull @NotNull ByteBuffer byteBuffer, int start, int len) Extracts a string from aByteBufferrange.- Parameters:
byteBuffer- the byte bufferstart- the start index of the stringlen- the length of the string- Returns:
- the string
-
fireSelectCharacter
-