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, HttpServer httpServer)
      Hooks into a server.
      Parameters:
      gameServer - The game server to hook into.
      httpServer - The HTTP 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.
    • getHttpServer

      public HttpServer getHttpServer()
      Returns:
      The HTTP 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.
    • addRouter

      public void addRouter(Router router)
      Adds a router using an instance of a class.
      Parameters:
      router - A router instance.
    • addRouter

      public void addRouter(Class<? extends Router> router)
      Adds a router using a class.
      Parameters:
      router - The class of the router.
    • setAuthSystem

      public void setAuthSystem(AuthenticationSystem authSystem)
      Sets the server's authentication system.
      Parameters:
      authSystem - An instance of the authentication system.