Package dev.polv.taleapi.server
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 Summary
Modifier and TypeMethodDescriptionvoidbroadcastMessage(String message) Broadcasts a message to all online players.static TaleServerReturns the singleton instance of the server.Returns all currently online players.default PermissionServiceReturns the permission service.Finds an online player by their unique ID.
-
Method Details
-
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
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
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
Broadcasts a message to all online players.- Parameters:
message- the message to broadcast
-