Class Player
java.lang.Object
fr.hytale.loader.api.Player
HytaleLoader wrapper for the native Hytale Player class.
This class provides a simplified and extended API for interacting with players, abstracting the native Hytale server implementation. It adds utility methods and provides a cleaner interface for common player operations.
- Since:
- 1.0.1
- Version:
- 1.0.4
- Author:
- HytaleLoader
-
Constructor Summary
ConstructorsConstructorDescriptionPlayer(com.hypixel.hytale.server.core.entity.entities.Player nativePlayer, com.hypixel.hytale.server.core.universe.PlayerRef playerRef) Constructs a new Player wrapper. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPermission(Permission permission) Adds a permission to this player.voidaddPermission(String permission) Adds a permission to this player.voidClears all permissions from this player.booleanfloatgetAmmo()Gets the player's current ammo.Gets the player's current game mode.floatGets the player's current health.Gets the player's inventory.Gets the player's current location.floatgetMana()Gets the player's current mana.getName()Gets the player's username.com.hypixel.hytale.server.core.entity.entities.PlayerGets the native Hytale player instance.floatGets the player's current oxygen.Gets all permissions this player has.floatgetPitch()Gets the player's pitch rotation.com.hypixel.hytale.server.core.universe.PlayerRefGets the native Hytale player reference.doubleGets the player's X position.doubleGets the player's Y position.doubleGets the player's Z position.floatGets the player's current signature energy.floatGets the player's current stamina.getUUID()Gets the player's UUID.floatgetYaw()Gets the player's yaw rotation.inthashCode()booleanhasPermission(Permission permission) Checks if the player has a specific permission.booleanhasPermission(String permission) Checks if the player has a specific permission.booleanisOnline()Checks if the player is currently online.booleanisOp()Checks if the player is an operator.voidKicks the player from the server.booleanremovePermission(Permission permission) Removes a permission from this player.booleanremovePermission(String permission) Removes a permission from this player.voidsendMessage(com.hypixel.hytale.server.core.Message message) Sends a formatted message to this player.voidsendMessage(String message) Sends a message to this player.voidShow to the player a title at the top of the screenvoidsendTitleWithSubtitle(String title, String subtitle) Show to the player a title at the top of the screenvoidsetAmmo(float ammo) Sets the player's ammo.voidsetGameMode(GameMode gameMode) Sets the player's game mode.voidsetHealth(float health) Sets the player's health.voidsetMana(float mana) Sets the player's mana.voidsetOxygen(float oxygen) Sets the player's oxygen.voidsetSignatureEnergy(float energy) Sets the player's signature energy.voidsetStamina(float stamina) Sets the player's stamina.voidteleport(double x, double y, double z) Teleports the player to coordinates.voidTeleports the player to a location.toString()
-
Constructor Details
-
Player
public Player(com.hypixel.hytale.server.core.entity.entities.Player nativePlayer, com.hypixel.hytale.server.core.universe.PlayerRef playerRef) Constructs a new Player wrapper.- Parameters:
nativePlayer- the native Hytale player instanceplayerRef- the player reference
-
-
Method Details
-
getNativePlayer
public com.hypixel.hytale.server.core.entity.entities.Player getNativePlayer()Gets the native Hytale player instance.Use this if you need direct access to the native API.
- Returns:
- the wrapped native player
-
getPlayerRef
public com.hypixel.hytale.server.core.universe.PlayerRef getPlayerRef()Gets the native Hytale player reference.The PlayerRef is used for operations that don't require the full entity to be loaded, such as sending messages or checking online status.
- Returns:
- the native player reference
-
getName
-
getUUID
-
sendMessage
Sends a message to this player.- Parameters:
message- the message text to send
-
sendMessage
public void sendMessage(com.hypixel.hytale.server.core.Message message) Sends a formatted message to this player.- Parameters:
message- the message object to send
-
getInventory
-
getGameMode
Gets the player's current game mode.- Returns:
- the player's game mode, or SURVIVAL if not available
-
setGameMode
Sets the player's game mode.- Parameters:
gameMode- the new game mode to set
-
getLocation
Gets the player's current location.- Returns:
- the player's location, or null if unavailable
-
getPositionX
public double getPositionX()Gets the player's X position.- Returns:
- the X coordinate, or 0.0 if unavailable
-
getPositionY
public double getPositionY()Gets the player's Y position.- Returns:
- the Y coordinate, or 0.0 if unavailable
-
getPositionZ
public double getPositionZ()Gets the player's Z position.- Returns:
- the Z coordinate, or 0.0 if unavailable
-
getYaw
public float getYaw()Gets the player's yaw rotation.- Returns:
- the yaw rotation, or 0.0f if unavailable
-
getPitch
public float getPitch()Gets the player's pitch rotation.- Returns:
- the pitch rotation, or 0.0f if unavailable
-
teleport
Teleports the player to a location.- Parameters:
location- the target location
-
teleport
public void teleport(double x, double y, double z) Teleports the player to coordinates.- Parameters:
x- the X coordinatey- the Y coordinatez- the Z coordinate
-
getHealth
public float getHealth()Gets the player's current health.- Returns:
- the player's current health, or 0.0 if unavailable
- Since:
- 1.0.3
-
setHealth
public void setHealth(float health) Sets the player's health.- Parameters:
health- the new health value- Since:
- 1.0.3
-
getStamina
public float getStamina()Gets the player's current stamina.- Returns:
- the player's current stamina, or 0.0 if unavailable
- Since:
- 1.0.3
-
setStamina
public void setStamina(float stamina) Sets the player's stamina.- Parameters:
stamina- the new stamina value- Since:
- 1.0.3
-
getOxygen
public float getOxygen()Gets the player's current oxygen.- Returns:
- the player's current oxygen, or 0.0 if unavailable
- Since:
- 1.0.3
-
setOxygen
public void setOxygen(float oxygen) Sets the player's oxygen.- Parameters:
oxygen- the new oxygen value- Since:
- 1.0.3
-
getMana
public float getMana()Gets the player's current mana.- Returns:
- the player's current mana, or 0.0 if unavailable
- Since:
- 1.0.3
-
setMana
public void setMana(float mana) Sets the player's mana.- Parameters:
mana- the new mana value- Since:
- 1.0.3
-
getSignatureEnergy
public float getSignatureEnergy()Gets the player's current signature energy.- Returns:
- the player's current signature energy, or 0.0 if unavailable
- Since:
- 1.0.3
-
setSignatureEnergy
public void setSignatureEnergy(float energy) Sets the player's signature energy.- Parameters:
energy- the new signature energy value- Since:
- 1.0.3
-
getAmmo
public float getAmmo()Gets the player's current ammo.- Returns:
- the player's current ammo, or 0.0 if unavailable
- Since:
- 1.0.3
-
setAmmo
public void setAmmo(float ammo) Sets the player's ammo.- Parameters:
ammo- the new ammo value- Since:
- 1.0.3
-
isOp
public boolean isOp()Checks if the player is an operator.Note: This feature is not yet implemented in Hytale.
- Returns:
- true if the player has operator permissions
-
hasPermission
Checks if the player has a specific permission.- Parameters:
permission- the permission node to check- Returns:
- true if the player has the permission
-
hasPermission
Checks if the player has a specific permission.- Parameters:
permission- the permission to check- Returns:
- true if the player has the permission
- Since:
- 1.0.3
-
addPermission
Adds a permission to this player.- Parameters:
permission- the permission to add- Since:
- 1.0.3
-
addPermission
Adds a permission to this player.- Parameters:
permission- the permission node to add- Since:
- 1.0.3
-
removePermission
Removes a permission from this player.- Parameters:
permission- the permission to remove- Returns:
- true if the permission was removed
- Since:
- 1.0.3
-
removePermission
Removes a permission from this player.- Parameters:
permission- the permission node to remove- Returns:
- true if the permission was removed
- Since:
- 1.0.3
-
getPermissions
Gets all permissions this player has.- Returns:
- an unmodifiable set of permissions
- Since:
- 1.0.3
-
clearPermissions
public void clearPermissions()Clears all permissions from this player.- Since:
- 1.0.3
-
kick
Kicks the player from the server.- Parameters:
reason- the kick reason
-
isOnline
public boolean isOnline()Checks if the player is currently online.- Returns:
- true if the player is connected
-
sendTitle
Show to the player a title at the top of the screen- Parameters:
title- the title you want to show to the player
-
sendTitleWithSubtitle
-
toString
-
equals
-
hashCode
-