Class Player

java.lang.Object
net.pl3x.map.core.Keyed
net.pl3x.map.core.player.Player

public abstract class Player extends Keyed
Represents a player.
  • Constructor Details

    • Player

      public Player(@NotNull @NotNull String key, @NotNull T player)
  • Method Details

    • getPlayer

      @NotNull public <T> T getPlayer()
    • setPlayer

      public void setPlayer(Object player)
    • getName

      @NotNull public abstract @NotNull String getName()
      Get the player's name.
      Returns:
      player's name
    • getUUID

      @NotNull public abstract @NotNull UUID getUUID()
      Get the player's UUID.
      Returns:
      player's UUID
    • getWorld

      @NotNull public abstract @NotNull World getWorld()
      Get the world this player is currently in.
      Returns:
      player's world
    • getPosition

      @NotNull public abstract @NotNull Point getPosition()
      Get the player's current position.
      Returns:
      player's position
    • getYaw

      public abstract float getYaw()
      Get the player's current yaw.
      Returns:
      player's yaw
    • getHealth

      public abstract int getHealth()
      Get the player's current health
      Returns:
      player's health
    • getArmorPoints

      public abstract int getArmorPoints()
      Get the player's current armor points.
      Returns:
      player's armor points
    • getSkin

      @Nullable public abstract @Nullable URL getSkin()
      Get the player's skin URL.
      Returns:
      player's skin URL
    • isInvisible

      public abstract boolean isInvisible()
      Get whether the player is invisible.
      Returns:
      true if player is invisible
    • isNPC

      public abstract boolean isNPC()
      Get whether the player is an NPC.

      This is for things like the Citizens plugin.

      Returns:
      true if player is an NPC
    • isSpectator

      public abstract boolean isSpectator()
      Get whether the player is in spectator gamemode.
      Returns:
      true if player is spectator
    • isHidden

      public boolean isHidden()
      Get whether player is hidden from the map.
      Returns:
      true if player is hidden
    • setHidden

      public void setHidden(boolean hidden, boolean persistent)
      Set if the player is hidden from the map
      Parameters:
      hidden - True to hide, false to show
      persistent - True to persist this state
    • isPersistentlyHidden

      public abstract boolean isPersistentlyHidden()
      Get whether the player has hidden flag set persistently.
      Returns:
      true if player is persistently hidden
    • setPersistentlyHidden

      public abstract void setPersistentlyHidden(boolean hidden)
      Set whether the player has hidden flag set persistently.
      Parameters:
      hidden - true to persistently hide player
    • registerNameDecorator

      public void registerNameDecorator(int priority, @NotNull @NotNull BiFunction<@NotNull Player,@NotNull String,@NotNull String> decorator)
      Function that is used to change player name in a player list

      Multiple decorators can be registered at the same time, in that case the one with Integer.MAX_VALUE will be run as first These two values should be used only in addons that you do not plan to release for public use.

      The function takes two arguments - the player and the output of previous decorator

      Parameters:
      priority - Priority of decorator
      decorator - Name decorator to register
    • getDecoratedName

      @NotNull public @NotNull String getDecoratedName()
      Get the player's decorated name.
      Returns:
      decorated name
    • equals

      public boolean equals(@Nullable @Nullable Object o)
      Overrides:
      equals in class Keyed
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Keyed