Interface TaleServer


public interface TaleServer
Represents the game server and provides access to server-wide functionality.

TaleServer is the central access point for:

  • Online player management and tracking
  • Permission service access
  • Server configuration

Player Tracking

The server automatically tracks players joining and leaving. The permission system is hooked into these events to load/unload player permissions.


 // Get all online players
 Collection<TalePlayer> players = TaleServer.getInstance().getOnlinePlayers();

 // Find a specific player
 Optional<TalePlayer> player = TaleServer.getInstance().getPlayer("Steve");
 

Permissions

Access the permission service for advanced permission operations:


 PermissionService perms = TaleServer.getInstance().getPermissions();
 perms.setPermission(player, PermissionNode.allow("cmd.fly"));
 
  • Method Details

    • getInstance

      static TaleServer getInstance()
      Returns the singleton instance of the server.

      This method must be implemented by the actual server implementation.

      Returns:
      the server instance
      Throws:
      UnsupportedOperationException - if no implementation is available
    • getPermissions

      default PermissionService getPermissions()
      Returns the permission service.

      This provides access to the permission system for advanced operations like setting permissions programmatically or registering custom providers.

      Returns:
      the permission service
    • getOnlinePlayers

      Collection<TalePlayer> getOnlinePlayers()
      Returns all currently online players.
      Returns:
      an unmodifiable collection of online players
    • getPlayer

      Optional<TalePlayer> getPlayer(String uniqueId)
      Finds an online player by their unique ID.
      Parameters:
      uniqueId - the player's unique identifier
      Returns:
      an Optional containing the player, or empty if not online
    • broadcastMessage

      void broadcastMessage(String message)
      Broadcasts a message to all online players.
      Parameters:
      message - the message to broadcast