 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.stats;
32 import org.jetbrains.annotations.NotNull;
33 import org.jetbrains.annotations.Nullable;
56 @SuppressWarnings(
"FieldAccessedSynchronizedAndUnsynchronized")
63 private final Object
sync = new Object();
76 @SuppressWarnings("FieldCanBeLocal")
80 public void commandDrawextinfoReceived(
final int color,
final int type,
final int subtype, @NotNull
final String message) {
85 public void setDebugMode(
final boolean printMessageTypes) {
95 @SuppressWarnings(
"FieldCanBeLocal")
99 public void markSent(
final int tag) {
100 synchronized (
sync) {
106 public void replySent() {
117 @SuppressWarnings(
"FieldCanBeLocal")
121 public void playerChanged(@Nullable
final CfItem player) {
126 public void openContainerChanged(
final int tag) {
139 public void itemChanged(
final int tag) {
141 throw new IllegalArgumentException(
"tag="+tag+
" but expecting currentPlayerTag="+
currentPlayerTag);
147 public void itemRemoved(
final int tag) {
152 public void inventoryAdded(
final int tag,
final int index, @NotNull
final CfItem item) {
154 throw new IllegalArgumentException(
"tag="+tag+
" but expecting currentPlayerTag="+
currentPlayerTag);
160 public void inventoryRemoved(
final int tag,
final int index) {
162 throw new IllegalArgumentException(
"tag="+tag+
" but expecting currentPlayerTag="+
currentPlayerTag);
176 crossfireServerConnection.addCrossfireDrawinfoListener((text, type) ->
check(text));
188 private void check(@NotNull
final String message) {
189 synchronized (
sync) {
205 if (this.currentPlayerTag != -1) {
209 if (this.currentPlayerTag != -1) {
void addInventoryListener(final int tag, @NotNull final ItemListener listener)
Adds an ItemListener to be notified about changes.
void setCurrentPlayerTag(final int currentPlayerTag)
Updates the current player object.
Model class maintaining the CfItems known to the player.
final SentPacketListener sentPacketListener
The SentPacketListener to track commands sent to the server.
final ItemListener playerInventoryListener
The ItemListener attached to the current player object.
Helper class to track the currently marked item.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
static final String MARK_MESSAGE
The text message the server sends in poisoned state.
Interface for listeners for changes of item locations.
int pendingMarkedTag
The item tag of the last "mark" command sent to the server.
final CrossfireDrawextinfoListener drawextinfoListener
The CrossfireDrawextinfoListener to receive drawextinfo messages.
void setMarkedItemTag(final int markedItemTag)
Sets the marked item.
Listener for classes interested in commands sent to the Crossfire server.
void check(@NotNull final String message)
Examines a text message.
final ItemSet itemSet
The ItemSet to monitor.
The representation of a Crossfire Item, client-side.
int getTag()
Returns the tag.
void addItemSetListener(@NotNull final ItemSetListener listener)
Adds an ItemSetListener to be notified about changes.
CfItem getPlayer()
Returns the player object this client controls.
Interface for listeners interested in drawextinfo messages received from the Crossfire server.
final Object sync
The object used for synchronization on pendingMarkedTag.
int currentPlayerTag
The tag of the current player object or.
MarkedItemWatcher(@NotNull final ItemSet itemSet, @NotNull final CrossfireServerConnection crossfireServerConnection)
Creates a new instance.
Interface for listeners in ItemSet related events.
final ItemSetListener itemSetListener
The ItemSetListener attached to itemSet to track the current player object.
void removeInventoryListener(final int tag, @NotNull final ItemListener listener)
Removes an ItemListener to be notified about changes.