Class SetupContext<P,C,L>

java.lang.Object
net.blueva.arcade.api.setup.SetupContext<P,C,L>
Type Parameters:
P - the player type (platform-specific)
C - the command sender type (platform-specific)
L - the location type (platform-specific)

public class SetupContext<P,C,L> extends Object
Context passed to setup handlers when executing commands.

This context contains all information needed to handle a setup command, including the command sender, arena being configured, command arguments, and access to data and selection APIs for arena configuration.

  • Constructor Details

    • SetupContext

      @Deprecated public SetupContext(C sender, P player, int arenaId, String gameId, String[] args, int startIndex, SetupDataAPI<L> dataAPI, SetupSelectionAPI<P,L> selectionAPI, MessageAPI<P> messageAPI)
      Deprecated.
      Use the constructor that accepts a SchedulerAPI parameter instead.
    • SetupContext

      public SetupContext(C sender, P player, int arenaId, String gameId, String[] args, int startIndex, SetupDataAPI<L> dataAPI, SetupSelectionAPI<P,L> selectionAPI, MessageAPI<P> messageAPI, SchedulerAPI<?,L> schedulerAPI)
      Creates a new setup context.
      Parameters:
      sender - the command sender (player or console)
      player - the player, or null if the sender is the console
      arenaId - the arena being configured
      gameId - the game module being configured
      args - full command arguments
      startIndex - index where handler-specific arguments start
      dataAPI - data API for saving/loading game configuration
      selectionAPI - selection API for getting player position selections
      messageAPI - message API for sending formatted messages
      schedulerAPI - scheduler API for running world-thread tasks from setup handlers
      Since:
      3.2
  • Method Details

    • getSender

      public C getSender()
      Get command sender (player or console).
    • getPlayer

      public P getPlayer()
      Get player if sender is a player, null otherwise.
    • isPlayer

      public boolean isPlayer()
      Check if sender is a player.
    • getArenaId

      public int getArenaId()
      Get arena ID being configured.
    • getGameId

      public String getGameId()
      Get game ID being configured.
    • getArgs

      public String[] getArgs()
      Get all command arguments. Example: [game, 1, race, spawn, add] for "/baa game 1 race spawn add"
    • getStartIndex

      public int getStartIndex()
      Get index where handler-specific arguments start. For "/baa game 1 race spawn add", if handler handles "spawn", startIndex = 4
    • getArg

      public String getArg(int index)
      Get argument at specific index, or null if out of bounds.
    • getHandlerArg

      public String getHandlerArg(int relativeIndex)
      Get handler-specific argument at relative index. getHandlerArg(0) returns first arg after the handler subcommand. Example: "/baa game 1 race spawn add" If handler handles "spawn", getHandlerArg(0) = "add"
    • getHandlerArgCount

      public int getHandlerArgCount()
      Get number of handler-specific arguments.
    • hasHandlerArgs

      public boolean hasHandlerArgs(int count)
      Check if handler has enough arguments.
    • getData

      public SetupDataAPI<L> getData()
      Get data API for saving/loading game configuration.
    • getSelection

      public SetupSelectionAPI<P,L> getSelection()
      Get selection API for getting player's position selections.
    • getMessagesAPI

      public MessageAPI<P> getMessagesAPI()
    • getSchedulerAPI

      public SchedulerAPI<?,L> getSchedulerAPI()
      Get scheduler API for running world-thread tasks from setup handlers.

      This allows setup handlers to schedule tasks on the world thread without having to use world.execute() directly.

      Returns:
      the scheduler API, or null if not available
      Since:
      3.2