Interface TalePlayer
- All Superinterfaces:
PermissionHolder,TaleEntity
Players are a specialized type of entity with additional player-specific
functionality. They inherit all entity behavior from TaleEntity
and permission capabilities from PermissionHolder.
Event Behavior
Players fire both player-specific events (like PlayerJoinCallback)
and general entity events (like EntityMoveCallback). When listening
to entity events, you can check if the entity is a player using
instanceof TalePlayer.
Permissions
Players implement PermissionHolder, providing access to the
extensible permission system. Use hasPermission(String) for
simple checks, or PermissionHolder.getPermissionValue(String) for dynamic values.
// Simple boolean check
if (player.hasPermission("cmd.teleport")) { ... }
// Dynamic value (e.g., max homes limit)
int maxHomes = player.getPermissionValue("homes.limit").asInt(3);
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns the player's display name.Returns the player's unique identifier.booleanhasPermission(String permission) Checks if the player has the specified permission.voidsendMessage(String message) Sends a message to the player.Methods inherited from interface dev.polv.taleapi.permission.PermissionHolder
getPermissionValue, getPermissionValue, hasPermissionMethods inherited from interface dev.polv.taleapi.entity.TaleEntity
getLocation, teleport
-
Method Details
-
getUniqueId
String getUniqueId()Returns the player's unique identifier.This overrides
TaleEntity.getUniqueId()to clarify that for players, this represents their account UUID. If the Hytale team ends up using UUIDs, we will use that directly.- Specified by:
getUniqueIdin interfacePermissionHolder- Specified by:
getUniqueIdin interfaceTaleEntity- Returns:
- the player's UUID, guaranteed to be unique
-
getDisplayName
String getDisplayName()Returns the player's display name.Note: Display names are NOT guaranteed to be unique across players.
- Returns:
- the player's display name
-
hasPermission
Checks if the player has the specified permission.Permissions are dot-separated strings following a hierarchical convention (e.g., "server.admin.kick", "world.edit", "chat.color").
Permission checking supports wildcards:
server.admin.*- grants all permissions under server.admin*- grants all permissions
This method is inherited from
PermissionHolderand delegates to the activePermissionService.- Specified by:
hasPermissionin interfacePermissionHolder- Parameters:
permission- the permission node to check- Returns:
trueif the player has the permission,falseotherwise
-
sendMessage
Sends a message to the player.- Parameters:
message- the message to send
-