Class User

All Implemented Interfaces:
IConf, IUser, IMessageRecipient, Comparable<User>, IUser, MailSender

public class User extends UserData implements Comparable<User>, IMessageRecipient, IUser
  • Constructor Details

  • Method Details

    • update

      public void update(Player base)
    • getEssentials

      public IEssentials getEssentials()
    • isAuthorized

      public boolean isAuthorized(IEssentialsCommand cmd)
      Specified by:
      isAuthorized in interface IUser
    • isAuthorized

      public boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix)
      Specified by:
      isAuthorized in interface IUser
    • isAuthorized

      public boolean isAuthorized(String node)
      Specified by:
      isAuthorized in interface IUser
    • isPermissionSet

      public boolean isPermissionSet(String node)
      Specified by:
      isPermissionSet in interface IUser
    • isAuthorizedExact

      public TriState isAuthorizedExact(String node)
      Checks if the given permission is explicitly defined and returns its value, otherwise TriState.UNSET.
    • healCooldown

      public void healCooldown() throws Exception
      Specified by:
      healCooldown in interface IUser
      Throws:
      Exception
    • giveMoney

      public void giveMoney(BigDecimal value) throws MaxMoneyException
      Specified by:
      giveMoney in interface IUser
      Throws:
      MaxMoneyException
    • giveMoney

      public void giveMoney(BigDecimal value, CommandSource initiator) throws MaxMoneyException
      Specified by:
      giveMoney in interface IUser
      Throws:
      MaxMoneyException
    • giveMoney

      public void giveMoney(BigDecimal value, CommandSource initiator, UserBalanceUpdateEvent.Cause cause) throws MaxMoneyException
      Throws:
      MaxMoneyException
    • payUser

      public void payUser(User reciever, BigDecimal value) throws Exception
      Specified by:
      payUser in interface IUser
      Throws:
      Exception
    • payUser

      public void payUser(User reciever, BigDecimal value, UserBalanceUpdateEvent.Cause cause) throws Exception
      Throws:
      Exception
    • takeMoney

      public void takeMoney(BigDecimal value)
      Specified by:
      takeMoney in interface IUser
    • takeMoney

      public void takeMoney(BigDecimal value, CommandSource initiator)
      Specified by:
      takeMoney in interface IUser
    • takeMoney

      public void takeMoney(BigDecimal value, CommandSource initiator, UserBalanceUpdateEvent.Cause cause)
    • canAfford

      public boolean canAfford(BigDecimal cost)
      Specified by:
      canAfford in interface IUser
    • canAfford

      public boolean canAfford(BigDecimal cost, boolean permcheck)
    • dispose

      public void dispose()
    • canSpawnItem

      public Boolean canSpawnItem(Material material)
      Specified by:
      canSpawnItem in interface IUser
    • setLastLocation

      public void setLastLocation()
      Specified by:
      setLastLocation in interface IUser
    • setLogoutLocation

      public void setLogoutLocation()
      Specified by:
      setLogoutLocation in interface IUser
    • requestTeleport

      public void requestTeleport(User player, boolean here)
      Specified by:
      requestTeleport in interface IUser
    • getPendingTpaKeys

      public Collection<String> getPendingTpaKeys()
    • hasPendingTpaRequests

      public boolean hasPendingTpaRequests(boolean inform, boolean excludeHere)
      Description copied from interface: IUser
      Whether or not this IUser has any valid TPA requests in queue.
      Specified by:
      hasPendingTpaRequests in interface IUser
      Parameters:
      inform - true if the user should be informed if a request expires during iteration.
      excludeHere - true if /tpahere requests should be ignored in checking if a tpa request is available.
      Returns:
      true if the user has an available pending request in queue.
    • hasOutstandingTpaRequest

      public boolean hasOutstandingTpaRequest(String playerUsername, boolean here)
    • getOutstandingTpaRequest

      public @Nullable IUser.TpaRequest getOutstandingTpaRequest(String playerUsername, boolean inform)
    • removeTpaRequest

      public IUser.TpaRequest removeTpaRequest(String playerUsername)
    • getNextTpaRequest

      public IUser.TpaRequest getNextTpaRequest(boolean inform, boolean ignoreExpirations, boolean excludeHere)
      Description copied from interface: IUser
      Gets information about the most-recently-made, non-expired TPA request in the tpa queue of this IUser.

      The TPA Queue is Last-In-First-Out queue which stores all the active pending teleport requests of this IUser. Timeout calculations are also done during the iteration process of this method, ensuring that teleport requests made past the timeout period are removed from queue and therefore not returned here. The maximum size of this queue is determined by ISettings.getTpaMaxRequests().

      Specified by:
      getNextTpaRequest in interface IUser
      Parameters:
      inform - true if the underlying IUser should be informed if a request expires during iteration.
      ignoreExpirations - true if this method should not process expirations for the entire queue and stop execution on the first unexpired request.
      excludeHere - true if /tphere requests should be ignored in fetching the next tpa request.
      Returns:
      A IUser.TpaRequest corresponding to the next available request or null if no valid request is present.
    • getNick

      public String getNick()
    • getNick

      public String getNick(boolean longNick)
      Needed for backwards compatibility.
    • getNick

      public String getNick(boolean longNick, boolean withPrefix, boolean withSuffix)
      Needed for backwards compatibility.
    • getNick

      public String getNick(boolean withPrefix, boolean withSuffix)
    • setDisplayNick

      public void setDisplayNick()
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: IMessageRecipient
      Returns the display name of this recipient. This name is typically used when formatting messages.
      Specified by:
      getDisplayName in interface IMessageRecipient
      Specified by:
      getDisplayName in interface IUser
      Returns:
      display name of this recipient
    • getFormattedNickname

      public String getFormattedNickname()
      Specified by:
      getFormattedNickname in interface IUser
    • getAsyncTeleport

      public AsyncTeleport getAsyncTeleport()
      Specified by:
      getAsyncTeleport in interface IUser
    • getLastOnlineActivity

      public long getLastOnlineActivity()
    • setLastOnlineActivity

      public void setLastOnlineActivity(long timestamp)
    • getMoney

      public BigDecimal getMoney()
      Specified by:
      getMoney in interface IUser
      Overrides:
      getMoney in class UserData
    • setMoney

      public void setMoney(BigDecimal value) throws MaxMoneyException
      Specified by:
      setMoney in interface IUser
      Throws:
      MaxMoneyException
    • setMoney

      public void setMoney(BigDecimal value, UserBalanceUpdateEvent.Cause cause) throws MaxMoneyException
      Throws:
      MaxMoneyException
    • updateMoneyCache

      public void updateMoneyCache(BigDecimal value)
    • setAfk

      public void setAfk(boolean set)
      Specified by:
      setAfk in interface IUser
    • setAfk

      public void setAfk(boolean set, AfkStatusChangeEvent.Cause cause)
      Specified by:
      setAfk in interface IUser
    • toggleAfk

      @Deprecated public boolean toggleAfk()
      Deprecated.
    • toggleAfk

      public boolean toggleAfk(AfkStatusChangeEvent.Cause cause)
    • isHiddenFrom

      public boolean isHiddenFrom(Player player)
      Specified by:
      isHiddenFrom in interface IMessageRecipient
    • isHidden

      public boolean isHidden()
      Description copied from interface: IUser
      'Hidden' Represents when a player is hidden from others. This status includes when the player is hidden via other supported plugins. Use isVanished() if you want to check if a user is vanished by Essentials.
      Specified by:
      isHidden in interface IUser
      Returns:
      If the user is hidden or not
      See Also:
    • isLeavingHidden

      public boolean isLeavingHidden()
      Description copied from interface: IUser
      Whether the user was hidden before leaving the server.
      Specified by:
      isLeavingHidden in interface IUser
      Returns:
      true if the user was hidden.
    • setLeavingHidden

      public void setLeavingHidden(boolean leavingHidden)
      Specified by:
      setLeavingHidden in interface IUser
    • setHidden

      public void setHidden(boolean hidden)
      Specified by:
      setHidden in interface IUser
    • isHidden

      public boolean isHidden(Player player)
    • getFormattedJailTime

      public String getFormattedJailTime()
      Specified by:
      getFormattedJailTime in interface IUser
    • checkJailTimeout

      public boolean checkJailTimeout(long currentTime)
    • checkMuteTimeout

      public boolean checkMuteTimeout(long currentTime)
    • getLastActivityTime

      public long getLastActivityTime()
      Description copied from interface: IUser
      Returns last activity time.

      It is used internally to determine if user's afk status should be set to true because of ACTIVITY AfkStatusChangeEvent.Cause, or the player should be kicked for being afk too long.

      Specified by:
      getLastActivityTime in interface IUser
      Returns:
      Last activity time (Epoch Milliseconds)
    • updateActivity

      @Deprecated public void updateActivity(boolean broadcast)
      Deprecated.
    • updateActivity

      public void updateActivity(boolean broadcast, AfkStatusChangeEvent.Cause cause)
    • updateActivityOnMove

      public void updateActivityOnMove(boolean broadcast)
    • updateActivityOnInteract

      public void updateActivityOnInteract(boolean broadcast)
    • updateActivityOnChat

      public void updateActivityOnChat(boolean broadcast)
    • checkActivity

      public void checkActivity()
    • getAfkPosition

      public Location getAfkPosition()
    • isGodModeEnabled

      public boolean isGodModeEnabled()
      Specified by:
      isGodModeEnabled in interface IUser
      Overrides:
      isGodModeEnabled in class UserData
    • isGodModeEnabledRaw

      public boolean isGodModeEnabledRaw()
    • getGroup

      public String getGroup()
      Specified by:
      getGroup in interface IUser
    • inGroup

      public boolean inGroup(String group)
      Specified by:
      inGroup in interface IUser
    • canBuild

      public boolean canBuild()
      Specified by:
      canBuild in interface IUser
    • getTeleportRequestTime

      @Deprecated public long getTeleportRequestTime()
      Deprecated.
      Specified by:
      getTeleportRequestTime in interface IUser
      See Also:
    • isInvSee

      public boolean isInvSee()
    • setInvSee

      public void setInvSee(boolean set)
    • isEnderSee

      public boolean isEnderSee()
    • setEnderSee

      public void setEnderSee(boolean set)
    • enableInvulnerabilityAfterTeleport

      public void enableInvulnerabilityAfterTeleport()
      Specified by:
      enableInvulnerabilityAfterTeleport in interface IUser
    • resetInvulnerabilityAfterTeleport

      public void resetInvulnerabilityAfterTeleport()
      Specified by:
      resetInvulnerabilityAfterTeleport in interface IUser
    • hasInvulnerabilityAfterTeleport

      public boolean hasInvulnerabilityAfterTeleport()
      Specified by:
      hasInvulnerabilityAfterTeleport in interface IUser
    • canInteractVanished

      public boolean canInteractVanished()
    • isIgnoreMsg

      public boolean isIgnoreMsg()
      Specified by:
      isIgnoreMsg in interface IUser
    • setIgnoreMsg

      public void setIgnoreMsg(boolean ignoreMsg)
      Specified by:
      setIgnoreMsg in interface IUser
    • isVanished

      public boolean isVanished()
      Description copied from interface: IUser
      'Vanished' Represents when a player is hidden from others by Essentials. This status does NOT include when the player is hidden via other plugins. Use isHidden() if you want to check if a user is vanished by any supported plugin.
      Specified by:
      isVanished in interface IUser
      Returns:
      If the user is vanished or not
      See Also:
    • setVanished

      public void setVanished(boolean set)
      Specified by:
      setVanished in interface IUser
    • checkSignThrottle

      public boolean checkSignThrottle()
    • isSignThrottled

      public boolean isSignThrottled()
    • updateThrottle

      public void updateThrottle()
    • isFlyClickJump

      public boolean isFlyClickJump()
    • setRightClickJump

      public void setRightClickJump(boolean rightClickJump)
    • isIgnoreExempt

      public boolean isIgnoreExempt()
      Specified by:
      isIgnoreExempt in interface IUser
    • isRecipeSee

      public boolean isRecipeSee()
    • setRecipeSee

      public void setRecipeSee(boolean recipeSee)
    • sendMessage

      public void sendMessage(String message)
      Description copied from interface: IMessageRecipient
      Sends (prints) a message to this recipient.
      Specified by:
      sendMessage in interface IMessageRecipient
      Specified by:
      sendMessage in interface IUser
      Parameters:
      message - message
    • sendComponent

      public void sendComponent(net.kyori.adventure.text.ComponentLike component)
      Specified by:
      sendComponent in interface IUser
    • tlComponent

      public net.kyori.adventure.text.Component tlComponent(String tlKey, Object... args)
      Specified by:
      tlComponent in interface IUser
    • sendTl

      public void sendTl(String tlKey, Object... args)
      Description copied from interface: IMessageRecipient
      Sends a translated message to this recipient.
      Specified by:
      sendTl in interface IMessageRecipient
      Specified by:
      sendTl in interface IUser
      Parameters:
      tlKey - key
      args - arguments
    • playerTl

      public String playerTl(String tlKey, Object... args)
      Specified by:
      playerTl in interface IUser
    • tlSender

      public String tlSender(String tlKey, Object... args)
      Description copied from interface: IMessageRecipient
      Translates a message.
      Specified by:
      tlSender in interface IMessageRecipient
      Parameters:
      tlKey - key
      args - arguments
      Returns:
      translated message
    • getPlayerLocale

      public Locale getPlayerLocale(String locale)
    • compareTo

      public int compareTo(User other)
      Specified by:
      compareTo in interface Comparable<User>
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getSource

      public CommandSource getSource()
      Specified by:
      getSource in interface IUser
    • getName

      public String getName()
      Description copied from interface: IMessageRecipient
      Returns the name of this recipient. This name is typically used internally to identify this recipient.
      Specified by:
      getName in interface IMessageRecipient
      Specified by:
      getName in interface IUser
      Specified by:
      getName in interface MailSender
      Returns:
      name of this recipient
      See Also:
    • getUUID

      public UUID getUUID()
      Description copied from interface: MailSender
      Gets the UUID of this MailSender or null if this sender doesn't have a UUID.
      Specified by:
      getUUID in interface IUser
      Specified by:
      getUUID in interface MailSender
      Returns:
      The sender's UUID or null if N/A.
    • isReachable

      public boolean isReachable()
      Description copied from interface: IMessageRecipient
      Returns whether this recipient is reachable. A case where the recipient is not reachable is if they are offline.
      Specified by:
      isReachable in interface IMessageRecipient
      Returns:
      whether this recipient is reachable
    • sendMessage

      public IMessageRecipient.MessageResponse sendMessage(IMessageRecipient recipient, String message)
      Description copied from interface: IMessageRecipient
      This method is called when this IMessageRecipient is sending a message to another IMessageRecipient.

      The IMessageRecipient.MessageResponse that is returned is used to determine what exactly should happen in the IMessageRecipient.sendMessage(IMessageRecipient, String) implementation by the sender.

      Specified by:
      sendMessage in interface IMessageRecipient
      Parameters:
      recipient - recipient to receive the message
      message - message to send
      Returns:
      the response of the message
    • onReceiveMessage

      public IMessageRecipient.MessageResponse onReceiveMessage(IMessageRecipient sender, String message)
      Description copied from interface: IMessageRecipient
      This method is called when this recipient is receiving a message from another IMessageRecipient.

      The IMessageRecipient.MessageResponse that is returned is used to determine what exactly should happen in the IMessageRecipient.sendMessage(IMessageRecipient, String) implementation by the sender.

      This method should only be called by IMessageRecipient.sendMessage(IMessageRecipient, String).

      Specified by:
      onReceiveMessage in interface IMessageRecipient
      Parameters:
      sender - sender of the message
      message - message being received
      Returns:
      the response of the message
    • getReplyRecipient

      public IMessageRecipient getReplyRecipient()
      Description copied from interface: IMessageRecipient
      Returns the IMessageRecipient this recipient should send replies to.
      Specified by:
      getReplyRecipient in interface IMessageRecipient
      Returns:
      message recipient
    • setReplyRecipient

      public void setReplyRecipient(IMessageRecipient recipient)
      Description copied from interface: IMessageRecipient
      Sets the IMessageRecipient this recipient should send replies to.
      Specified by:
      setReplyRecipient in interface IMessageRecipient
      Parameters:
      recipient - message recipient to set
    • getAfkMessage

      public String getAfkMessage()
      Specified by:
      getAfkMessage in interface IUser
    • setAfkMessage

      public void setAfkMessage(String message)
      Specified by:
      setAfkMessage in interface IUser
    • getAfkSince

      public long getAfkSince()
      Specified by:
      getAfkSince in interface IUser
    • getConfirmingPayments

      public Map<User,BigDecimal> getConfirmingPayments()
      Specified by:
      getConfirmingPayments in interface IUser
    • getConfirmingClearCommand

      public String getConfirmingClearCommand()
    • setConfirmingClearCommand

      public void setConfirmingClearCommand(String command)
    • getItemInHand

      public ItemStack getItemInHand()
      Returns the ItemStack in the main hand or off-hand. If the main hand is empty then the offhand item is returned - also nullable.
    • sendMail

      public void sendMail(MailSender sender, String message)
      Specified by:
      sendMail in interface IUser
    • sendMail

      public void sendMail(MailSender sender, String message, long expireAt)
      Specified by:
      sendMail in interface IUser
    • addMail

      @Deprecated public void addMail(String mail)
      Deprecated.
      Specified by:
      addMail in interface IUser
    • notifyOfMail

      public void notifyOfMail()
    • getLastHomeConfirmation

      public String getLastHomeConfirmation()
    • setLastHomeConfirmation

      public void setLastHomeConfirmation(String lastHomeConfirmation)
    • getLastHomeConfirmationTimestamp

      public long getLastHomeConfirmationTimestamp()
    • setLastHomeConfirmationTimestamp

      public void setLastHomeConfirmationTimestamp()
    • getSignCopy

      public List<String> getSignCopy()
    • isFreeze

      public boolean isFreeze()
      Specified by:
      isFreeze in interface IUser
    • setFreeze

      public void setFreeze(boolean freeze)
      Specified by:
      setFreeze in interface IUser
    • isBaltopExempt

      public boolean isBaltopExempt()
    • getLastVanishTime

      public long getLastVanishTime()
    • getTargetBlock

      public Block getTargetBlock(int maxDistance)
      Specified by:
      getTargetBlock in interface IUser
    • setToggleShout

      public void setToggleShout(boolean toggleShout)
      Specified by:
      setToggleShout in interface IUser
    • isToggleShout

      public boolean isToggleShout()
      Specified by:
      isToggleShout in interface IUser
    • getFlightTick

      public int getFlightTick()
    • setFlightTick

      public void setFlightTick(int flightTick)