Class CommandQueue


  • public class CommandQueue
    extends java.lang.Object
    Maintains the pending (ncom) commands sent to the server.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addToRepeatCount​(int digit)
      Adds a digit to the current repeat count.
      boolean checkFire()
      Returns whether the character is firing.
      boolean checkRun()
      Returns whether the character is running.
      void resetRepeatCount()
      Resets the current repeat count to zero.
      void sendMove​(int to, int tag)
      Sends a "move" command to the server.
      void sendNcom​(boolean mustSend, int repeat, @NotNull java.lang.String command)
      Sends an "ncom" command to the server.
      void sendNcom​(boolean mustSend, @NotNull java.lang.String command)
      Sends an "ncom" command to the server.
      void sendRawString​(@NotNull java.lang.String command)
      Sends a raw command to the server.
      boolean stopRunning()
      Tells the server to stop running.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CommandQueue

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

      • resetRepeatCount

        public void resetRepeatCount()
        Resets the current repeat count to zero.
      • 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 java.lang.String command)
        Sends an "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(boolean, int, String)
      • sendNcom

        public void sendNcom​(boolean mustSend,
                             int repeat,
                             @NotNull
                             @NotNull java.lang.String command)
        Sends an "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:
        sendNcom(boolean, String)
      • sendRawString

        public void sendRawString​(@NotNull
                                  @NotNull java.lang.String command)
        Sends a raw command to the server.
        Parameters:
        command - the command to send
        See Also:
        sendNcom(boolean, String)
      • 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
        No Inspection:
        MethodMayBeStatic
      • 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