Class Player

java.lang.Object
fr.hytale.loader.api.Player

public class Player extends Object
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 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 instance
      playerRef - 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

      public String getName()
      Gets the player's username.
      Returns:
      the username
    • getUUID

      public UUID getUUID()
      Gets the player's UUID.
      Returns:
      the player's unique identifier
    • sendMessage

      public void sendMessage(String message)
      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

      public Inventory getInventory()
      Gets the player's inventory.
      Returns:
      the player's inventory
    • getGameMode

      public GameMode getGameMode()
      Gets the player's current game mode.
      Returns:
      the player's game mode, or SURVIVAL if not available
    • setGameMode

      public void setGameMode(GameMode gameMode)
      Sets the player's game mode.
      Parameters:
      gameMode - the new game mode to set
    • getLocation

      public Location 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

      public void teleport(Location location)
      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 coordinate
      y - the Y coordinate
      z - 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

      public boolean hasPermission(String permission)
      Checks if the player has a specific permission.
      Parameters:
      permission - the permission node to check
      Returns:
      true if the player has the permission
    • hasPermission

      public boolean hasPermission(Permission permission)
      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

      public void addPermission(Permission permission)
      Adds a permission to this player.
      Parameters:
      permission - the permission to add
      Since:
      1.0.3
    • addPermission

      public void addPermission(String permission)
      Adds a permission to this player.
      Parameters:
      permission - the permission node to add
      Since:
      1.0.3
    • removePermission

      public boolean removePermission(Permission permission)
      Removes a permission from this player.
      Parameters:
      permission - the permission to remove
      Returns:
      true if the permission was removed
      Since:
      1.0.3
    • removePermission

      public boolean removePermission(String permission)
      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

      public Set<Permission> 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

      public void kick(String reason)
      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

      public void sendTitle(String title)
      Show to the player a title at the top of the screen
      Parameters:
      title - the title you want to show to the player
    • sendTitleWithSubtitle

      public void sendTitleWithSubtitle(String title, String subtitle)
      Show to the player a title at the top of the screen
      Parameters:
      title - the title you want to show to the player
      subtitle - the subtitle you want to show to the player
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object