Class CommandQueue

java.lang.Object
com.realtime.crossfire.jxclient.queue.CommandQueue

public class CommandQueue extends Object
Maintains the pending (ncom) commands sent to the server.
  • Constructor Details

    • CommandQueue

      public CommandQueue(@NotNull @NotNull CrossfireServerConnection crossfireServerConnection, @NotNull @NotNull GuiStateManager guiStateManager, @NotNull @NotNull PendingDirections pendingDirections)
      Creates a new instance.
      Parameters:
      crossfireServerConnection - the server connection for sending ncom commands
      guiStateManager - the gui state manager to watch
      pendingDirections - the pending directions instance to update
  • Method Details

    • addToRepeatCount

      public void addToRepeatCount(int digit)
      Adds a digit to the current repeat count.
      Parameters:
      digit - the digit (0-9) to add
    • sendNcom

      public void sendNcom(boolean mustSend, @NotNull @NotNull String command)
      Sends a "ncom" command to the server. This function uses the default repeat count.
      Parameters:
      mustSend - if set, always send the command; if unset, drop the command if the command queue is full
      command - the command to send
      See Also:
    • sendNcom

      public void sendNcom(boolean mustSend, int repeat, @NotNull @NotNull String command)
      Sends a "ncom" command to the server.
      Parameters:
      mustSend - if set, always send the command; if unset, drop the command if the command queue is full
      repeat - the repeat count
      command - the command to send
      See Also:
    • sendRawString

      public void sendRawString(@NotNull @NotNull String command)
      Sends a raw command to the server.
      Parameters:
      command - the command to send
      See Also:
    • stopRunning

      public boolean stopRunning()
      Tells the server to stop running. If the character is not running, does nothing.
      Returns:
      whether running was active
    • checkRun

      public boolean checkRun()
      Returns whether the character is running.
      Returns:
      whether the character is running
    • checkFire

      public boolean checkFire()
      Returns whether the character is firing.
      Returns:
      whether the character is firing
    • sendMove

      public void sendMove(int to, int tag)
      Sends a "move" command to the server. The repeat count value is the client's current repeat count.
      Parameters:
      to - the destination location
      tag - the item to move