Class ServerHook

java.lang.Object
emu.grasscutter.plugin.api.ServerHook

public final class ServerHook extends Object
Hooks into the GameServer class, adding convenient ways to do certain things.
  • Constructor Details

    • ServerHook

      public ServerHook(GameServer gameServer, DispatchServer dispatchServer)
      Hooks into a server.
      Parameters:
      gameServer - The game server to hook into.
      dispatchServer - The dispatch server to hook into.
  • Method Details

    • getInstance

      public static ServerHook getInstance()
      Gets the server hook instance.
      Returns:
      A ServerHook singleton.
    • getGameServer

      public GameServer getGameServer()
      Returns:
      The game server.
    • getDispatchServer

      public DispatchServer getDispatchServer()
      Returns:
      The dispatch server.
    • getOnlinePlayers

      public List<Player> getOnlinePlayers()
      Gets all online players.
      Returns:
      Players connected to the server.
    • registerCommand

      public void registerCommand(CommandHandler handler)
      Registers a command to the CommandMap.
      Parameters:
      handler - The command handler.