Class Keyboard

java.lang.Object
org.rspeer.game.Keyboard

@Deprecated public class Keyboard extends Object
Deprecated.
Provides operations related to the Keyboard. Please note that this should only be used when necessary. In most cases there are better alternatives, such as invoking CS2 via Game.ScriptExecutor.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Deprecated.
    Presses the Enter key.
    static void
    pressEventKey(int eventKey)
    Deprecated.
    Presses and releases a key specified by its key code.
    static void
    sendKey(char key)
    Deprecated.
    Sends a single character as keyboard input.
    static void
    sendText(String text, boolean pressEnter)
    Deprecated.
    Sends a sequence of characters as keyboard input.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Keyboard

      public Keyboard()
      Deprecated.
  • Method Details

    • sendText

      public static void sendText(String text, boolean pressEnter)
      Deprecated.
      Sends a sequence of characters as keyboard input.

      Each character in the provided string is dispatched as a key typed event. Optionally, the Enter key can be pressed after the input.

      Parameters:
      text - the text to send as keyboard input
      pressEnter - true to press the Enter key after sending the text, false otherwise
      Throws:
      IllegalArgumentException - if text is null
    • pressEnter

      public static void pressEnter()
      Deprecated.
      Presses the Enter key.

      This method dispatches both KEY_PRESSED and KEY_RELEASED events for the Enter key.

    • sendKey

      public static void sendKey(char key)
      Deprecated.
      Sends a single character as keyboard input.

      This method dispatches a KEY_TYPED event for the given character.

      Parameters:
      key - the character to send as input
    • pressEventKey

      public static void pressEventKey(int eventKey)
      Deprecated.
      Presses and releases a key specified by its key code.

      This method dispatches both KEY_PRESSED and KEY_RELEASED events for the specified key code.

      Parameters:
      eventKey - the key code of the key to press