Class User
- All Implemented Interfaces:
IConf
,IUser
,IMessageRecipient
,Comparable<User>
,IUser
,MailSender
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.earth2me.essentials.messaging.IMessageRecipient
IMessageRecipient.MessageResponse
Nested classes/interfaces inherited from interface com.earth2me.essentials.IUser
IUser.TpaRequest
-
Field Summary
Fields inherited from class com.earth2me.essentials.PlayerExtension
base
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.boolean
canAfford
(BigDecimal cost) boolean
canAfford
(BigDecimal cost, boolean permcheck) boolean
canBuild()
boolean
canSpawnItem
(Material material) void
boolean
checkJailTimeout
(long currentTime) boolean
checkMuteTimeout
(long currentTime) boolean
int
void
dispose()
void
boolean
long
Returns the display name of this recipient.getGroup()
Returns theItemStack
in the main hand or off-hand.long
long
long
getMoney()
getName()
Returns the name of this recipient.getNextTpaRequest
(boolean inform, boolean ignoreExpirations, boolean excludeHere) Gets information about the most-recently-made, non-expired TPA request in the tpa queue of thisIUser
.getNick()
getNick
(boolean longNick) Needed for backwards compatibility.getNick
(boolean withPrefix, boolean withSuffix) getNick
(boolean longNick, boolean withPrefix, boolean withSuffix) Needed for backwards compatibility.@Nullable IUser.TpaRequest
getOutstandingTpaRequest
(String playerUsername, boolean inform) getPlayerLocale
(String locale) Returns theIMessageRecipient
this recipient should send replies to.getTargetBlock
(int maxDistance) Deprecated.This API is not asynchronous.long
Deprecated.getUUID()
Gets theUUID
of thisMailSender
or null if this sender doesn't have a UUID.void
giveMoney
(BigDecimal value) void
giveMoney
(BigDecimal value, CommandSource initiator) void
giveMoney
(BigDecimal value, CommandSource initiator, UserBalanceUpdateEvent.Cause cause) int
hashCode()
boolean
boolean
Deprecated.boolean
hasOutstandingTpaRequest
(String playerUsername, boolean here) boolean
hasPendingTpaRequests
(boolean inform, boolean excludeHere) Whether or not thisIUser
has any valid TPA requests in queue.void
boolean
boolean
boolean
isAuthorized
(IEssentialsCommand cmd, String permissionPrefix) boolean
isAuthorized
(String node) isAuthorizedExact
(String node) Checks if the given permission is explicitly defined and returns its value, otherwiseTriState.UNSET
.boolean
boolean
boolean
boolean
isFreeze()
boolean
boolean
boolean
isHidden()
'Hidden' Represents when a player is hidden from others.boolean
boolean
isHiddenFrom
(Player player) boolean
boolean
boolean
isInvSee()
boolean
Whether the user was hidden before leaving the server.boolean
isPermissionSet
(String node) boolean
Returns whether this recipient is reachable.boolean
boolean
boolean
boolean
'Vanished' Represents when a player is hidden from others by Essentials.void
onReceiveMessage
(IMessageRecipient sender, String message) This method is called when this recipient is receiving a message from anotherIMessageRecipient
.void
payUser
(User reciever, BigDecimal value) void
payUser
(User reciever, BigDecimal value, UserBalanceUpdateEvent.Cause cause) removeTpaRequest
(String playerUsername) void
requestTeleport
(User player, boolean here) void
void
sendComponent
(net.kyori.adventure.text.ComponentLike component) void
sendMail
(MailSender sender, String message) void
sendMail
(MailSender sender, String message, long expireAt) sendMessage
(IMessageRecipient recipient, String message) This method is called when thisIMessageRecipient
is sending a message to anotherIMessageRecipient
.void
sendMessage
(String message) Sends (prints) a message to this recipient.void
Sends a translated message to this recipient.void
setAfk
(boolean set) void
setAfk
(boolean set, AfkStatusChangeEvent.Cause cause) void
setAfkMessage
(String message) void
setConfirmingClearCommand
(String command) void
void
setEnderSee
(boolean set) void
setFreeze
(boolean freeze) void
setHidden
(boolean hidden) void
setIgnoreMsg
(boolean ignoreMsg) void
setInvSee
(boolean set) void
setLastHomeConfirmation
(String lastHomeConfirmation) void
void
void
setLastOnlineActivity
(long timestamp) void
setLeavingHidden
(boolean leavingHidden) void
void
setMoney
(BigDecimal value) void
setMoney
(BigDecimal value, UserBalanceUpdateEvent.Cause cause) void
setRecipeSee
(boolean recipeSee) void
setReplyRecipient
(IMessageRecipient recipient) Sets theIMessageRecipient
this recipient should send replies to.void
setRightClickJump
(boolean rightClickJump) void
setToggleShout
(boolean toggleShout) void
setVanished
(boolean set) void
takeMoney
(BigDecimal value) void
takeMoney
(BigDecimal value, CommandSource initiator) void
takeMoney
(BigDecimal value, CommandSource initiator, UserBalanceUpdateEvent.Cause cause) net.kyori.adventure.text.Component
tlComponent
(String tlKey, Object... args) Translates a message.boolean
Deprecated.boolean
void
void
updateActivity
(boolean broadcast) Deprecated.void
updateActivity
(boolean broadcast, AfkStatusChangeEvent.Cause cause) void
updateActivityOnChat
(boolean broadcast) void
updateActivityOnInteract
(boolean broadcast) void
updateActivityOnMove
(boolean broadcast) void
updateMoneyCache
(BigDecimal value) void
Methods inherited from class com.earth2me.essentials.UserData
_getIgnoredPlayers, _setAfk, addCommandCooldown, addPastUsername, arePowerToolsEnabled, cleanup, clearAllPowertools, clearCommandCooldown, delHome, getCommandCooldownExpiry, getCommandCooldowns, getConfigKeys, getConfigMap, getConfigMap, getConfigUUID, getCooldownsList, getGeoLocation, getHome, getHome, getHomes, getJail, getJailTimeout, getKitTimestamp, getLastAccountName, getLastHealTimestamp, getLastLocation, getLastLogin, getLastLoginAddress, getLastLogout, getLastTeleportTimestamp, getLogoutLocation, getMailAmount, getMailMessages, getMails, getMuted, getMuteReason, getMuteTimeout, getNickname, getOnlineJailedTime, getPastUsernames, getPowertool, getPowertool, getUnlimited, getUnreadMailAmount, hasHome, hasHome, hasMuteReason, hasPowerTools, hasUnlimited, hasValidHomes, isAcceptingPay, isAfk, isAutoTeleportEnabled, isBaltopExcludeCache, isIgnoredPlayer, isIgnoredPlayer, isJailed, isLastMessageReplyRecipient, isMuted, isNPC, isPromptingClearConfirm, isPromptingPayConfirm, isShouting, isSocialSpyEnabled, isTeleportEnabled, reloadConfig, renameHome, reset, save, setAcceptingPay, setAutoTeleportEnabled, setBaltopExemptCache, setConfigProperty, setConfigPropertyRaw, setGeoLocation, setGodModeEnabled, setHome, setIgnoredPlayer, setIgnoredPlayers, setIgnoredPlayerUUIDs, setJail, setJailed, setJailTimeout, setKitTimestamp, setLastAccountName, setLastHealTimestamp, setLastLocation, setLastLogin, setLastLogout, setLastMessageReplyRecipient, setLastTeleportTimestamp, setLogoutLocation, setMailList, setMails, setMoney, setMuted, setMuteReason, setMuteTimeout, setNickname, setNPC, setOnlineJailedTime, setPowertool, setPowerToolsEnabled, setPromptingClearConfirm, setPromptingPayConfirm, setShouting, setSocialSpyEnabled, setTeleportEnabled, setUnlimited, startTransaction, stopTransaction, toggleJailed, togglePowerToolsEnabled
Methods inherited from class com.earth2me.essentials.PlayerExtension
getBase, getLocation, getOffline, getServer, getWorld, setBase
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.earth2me.essentials.IUser
addCommandCooldown, addPastUsername, clearCommandCooldown, delHome, getBase, getCommandCooldownExpiry, getCommandCooldowns, getConfigKeys, getConfigMap, getConfigMap, getCooldownsList, getHome, getHome, getHomes, getJail, getLastLocation, getLastTeleportTimestamp, getLogoutLocation, getMailAmount, getMailMessages, getMails, getPastUsernames, hasHome, isAcceptingPay, isAfk, isLastMessageReplyRecipient, isPromptingClearConfirm, isPromptingPayConfirm, renameHome, setAcceptingPay, setConfigProperty, setHome, setJail, setLastMessageReplyRecipient, setLastTeleportTimestamp, setMailList, setPromptingClearConfirm, setPromptingPayConfirm
-
Constructor Details
-
User
-
-
Method Details
-
update
-
getEssentials
-
isAuthorized
- Specified by:
isAuthorized
in interfaceIUser
-
isAuthorized
- Specified by:
isAuthorized
in interfaceIUser
-
isAuthorized
- Specified by:
isAuthorized
in interfaceIUser
-
isPermissionSet
- Specified by:
isPermissionSet
in interfaceIUser
-
isAuthorizedExact
Checks if the given permission is explicitly defined and returns its value, otherwiseTriState.UNSET
. -
healCooldown
- Specified by:
healCooldown
in interfaceIUser
- Throws:
Exception
-
giveMoney
- Specified by:
giveMoney
in interfaceIUser
- Throws:
MaxMoneyException
-
giveMoney
- Specified by:
giveMoney
in interfaceIUser
- Throws:
MaxMoneyException
-
giveMoney
public void giveMoney(BigDecimal value, CommandSource initiator, UserBalanceUpdateEvent.Cause cause) throws MaxMoneyException - Throws:
MaxMoneyException
-
payUser
-
payUser
public void payUser(User reciever, BigDecimal value, UserBalanceUpdateEvent.Cause cause) throws Exception - Throws:
Exception
-
takeMoney
-
takeMoney
-
takeMoney
public void takeMoney(BigDecimal value, CommandSource initiator, UserBalanceUpdateEvent.Cause cause) -
canAfford
-
canAfford
-
dispose
public void dispose() -
canSpawnItem
- Specified by:
canSpawnItem
in interfaceIUser
-
setLastLocation
public void setLastLocation()- Specified by:
setLastLocation
in interfaceIUser
-
setLogoutLocation
public void setLogoutLocation()- Specified by:
setLogoutLocation
in interfaceIUser
-
requestTeleport
- Specified by:
requestTeleport
in interfaceIUser
-
hasOutstandingTeleportRequest
Deprecated.Description copied from interface:IUser
Returns whether this user has an outstanding teleport request to deal with.- Specified by:
hasOutstandingTeleportRequest
in interfaceIUser
- Returns:
- whether there is a teleport request
- See Also:
-
getPendingTpaKeys
-
hasPendingTpaRequests
public boolean hasPendingTpaRequests(boolean inform, boolean excludeHere) Description copied from interface:IUser
Whether or not thisIUser
has any valid TPA requests in queue.- Specified by:
hasPendingTpaRequests
in interfaceIUser
- 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
-
getOutstandingTpaRequest
-
removeTpaRequest
-
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 thisIUser
.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 byISettings.getTpaMaxRequests()
.- Specified by:
getNextTpaRequest
in interfaceIUser
- Parameters:
inform
- true if the underlyingIUser
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
-
getNick
Needed for backwards compatibility. -
getNick
Needed for backwards compatibility. -
getNick
-
setDisplayNick
public void setDisplayNick() -
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 interfaceIMessageRecipient
- Specified by:
getDisplayName
in interfaceIUser
- Returns:
- display name of this recipient
-
getFormattedNickname
- Specified by:
getFormattedNickname
in interfaceIUser
-
getAsyncTeleport
- Specified by:
getAsyncTeleport
in interfaceIUser
-
getTeleport
Deprecated.This API is not asynchronous. UsegetAsyncTeleport()
- Specified by:
getTeleport
in interfaceIUser
-
getLastOnlineActivity
public long getLastOnlineActivity() -
setLastOnlineActivity
public void setLastOnlineActivity(long timestamp) -
getMoney
-
setMoney
- Specified by:
setMoney
in interfaceIUser
- Throws:
MaxMoneyException
-
setMoney
- Throws:
MaxMoneyException
-
updateMoneyCache
-
setAfk
public void setAfk(boolean set) -
setAfk
-
toggleAfk
Deprecated. -
toggleAfk
-
isHiddenFrom
- Specified by:
isHiddenFrom
in interfaceIMessageRecipient
-
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. -
isLeavingHidden
public boolean isLeavingHidden()Description copied from interface:IUser
Whether the user was hidden before leaving the server.- Specified by:
isLeavingHidden
in interfaceIUser
- Returns:
- true if the user was hidden.
-
setLeavingHidden
public void setLeavingHidden(boolean leavingHidden) - Specified by:
setLeavingHidden
in interfaceIUser
-
setHidden
public void setHidden(boolean hidden) -
isHidden
-
getFormattedJailTime
- Specified by:
getFormattedJailTime
in interfaceIUser
-
checkJailTimeout
public boolean checkJailTimeout(long currentTime) -
checkMuteTimeout
public boolean checkMuteTimeout(long currentTime) -
updateActivity
Deprecated. -
updateActivity
-
updateActivityOnMove
public void updateActivityOnMove(boolean broadcast) -
updateActivityOnInteract
public void updateActivityOnInteract(boolean broadcast) -
updateActivityOnChat
public void updateActivityOnChat(boolean broadcast) -
checkActivity
public void checkActivity() -
getAfkPosition
-
isGodModeEnabled
public boolean isGodModeEnabled()- Specified by:
isGodModeEnabled
in interfaceIUser
- Overrides:
isGodModeEnabled
in classUserData
-
isGodModeEnabledRaw
public boolean isGodModeEnabledRaw() -
getGroup
-
inGroup
-
canBuild
public boolean canBuild() -
getTeleportRequestTime
Deprecated.- Specified by:
getTeleportRequestTime
in interfaceIUser
- 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 interfaceIUser
-
resetInvulnerabilityAfterTeleport
public void resetInvulnerabilityAfterTeleport()- Specified by:
resetInvulnerabilityAfterTeleport
in interfaceIUser
-
hasInvulnerabilityAfterTeleport
public boolean hasInvulnerabilityAfterTeleport()- Specified by:
hasInvulnerabilityAfterTeleport
in interfaceIUser
-
canInteractVanished
public boolean canInteractVanished() -
isIgnoreMsg
public boolean isIgnoreMsg()- Specified by:
isIgnoreMsg
in interfaceIUser
-
setIgnoreMsg
public void setIgnoreMsg(boolean ignoreMsg) - Specified by:
setIgnoreMsg
in interfaceIUser
-
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 interfaceIUser
- Returns:
- If the user is vanished or not
- See Also:
-
setVanished
public void setVanished(boolean set) - Specified by:
setVanished
in interfaceIUser
-
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 interfaceIUser
-
isRecipeSee
public boolean isRecipeSee() -
setRecipeSee
public void setRecipeSee(boolean recipeSee) -
sendMessage
Description copied from interface:IMessageRecipient
Sends (prints) a message to this recipient.- Specified by:
sendMessage
in interfaceIMessageRecipient
- Specified by:
sendMessage
in interfaceIUser
- Parameters:
message
- message
-
sendComponent
public void sendComponent(net.kyori.adventure.text.ComponentLike component) - Specified by:
sendComponent
in interfaceIUser
-
tlComponent
- Specified by:
tlComponent
in interfaceIUser
-
sendTl
Description copied from interface:IMessageRecipient
Sends a translated message to this recipient.- Specified by:
sendTl
in interfaceIMessageRecipient
- Specified by:
sendTl
in interfaceIUser
- Parameters:
tlKey
- keyargs
- arguments
-
playerTl
-
tlSender
Description copied from interface:IMessageRecipient
Translates a message.- Specified by:
tlSender
in interfaceIMessageRecipient
- Parameters:
tlKey
- keyargs
- arguments- Returns:
- translated message
-
getPlayerLocale
-
compareTo
- Specified by:
compareTo
in interfaceComparable<User>
-
equals
-
hashCode
public int hashCode() -
getSource
-
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 interfaceIMessageRecipient
- Specified by:
getName
in interfaceIUser
- Specified by:
getName
in interfaceMailSender
- Returns:
- name of this recipient
- See Also:
-
getUUID
Description copied from interface:MailSender
Gets theUUID
of thisMailSender
or null if this sender doesn't have a UUID.- Specified by:
getUUID
in interfaceIUser
- Specified by:
getUUID
in interfaceMailSender
- 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 interfaceIMessageRecipient
- Returns:
- whether this recipient is reachable
-
sendMessage
Description copied from interface:IMessageRecipient
This method is called when thisIMessageRecipient
is sending a message to anotherIMessageRecipient
.The
IMessageRecipient.MessageResponse
that is returned is used to determine what exactly should happen in theIMessageRecipient.sendMessage(IMessageRecipient, String)
implementation by thesender
.- Specified by:
sendMessage
in interfaceIMessageRecipient
- Parameters:
recipient
- recipient to receive themessage
message
- message to send- Returns:
- the response of the message
-
onReceiveMessage
Description copied from interface:IMessageRecipient
This method is called when this recipient is receiving a message from anotherIMessageRecipient
.The
IMessageRecipient.MessageResponse
that is returned is used to determine what exactly should happen in theIMessageRecipient.sendMessage(IMessageRecipient, String)
implementation by thesender
.This method should only be called by
IMessageRecipient.sendMessage(IMessageRecipient, String)
.- Specified by:
onReceiveMessage
in interfaceIMessageRecipient
- Parameters:
sender
- sender of themessage
message
- message being received- Returns:
- the response of the message
-
getReplyRecipient
Description copied from interface:IMessageRecipient
Returns theIMessageRecipient
this recipient should send replies to.- Specified by:
getReplyRecipient
in interfaceIMessageRecipient
- Returns:
- message recipient
-
setReplyRecipient
Description copied from interface:IMessageRecipient
Sets theIMessageRecipient
this recipient should send replies to.- Specified by:
setReplyRecipient
in interfaceIMessageRecipient
- Parameters:
recipient
- message recipient to set
-
getAfkMessage
- Specified by:
getAfkMessage
in interfaceIUser
-
setAfkMessage
- Specified by:
setAfkMessage
in interfaceIUser
-
getAfkSince
public long getAfkSince()- Specified by:
getAfkSince
in interfaceIUser
-
getConfirmingPayments
- Specified by:
getConfirmingPayments
in interfaceIUser
-
getConfirmingClearCommand
-
setConfirmingClearCommand
-
getItemInHand
Returns theItemStack
in the main hand or off-hand. If the main hand is empty then the offhand item is returned - also nullable. -
sendMail
-
sendMail
-
addMail
Deprecated. -
notifyOfMail
public void notifyOfMail() -
getLastHomeConfirmation
-
setLastHomeConfirmation
-
getLastHomeConfirmationTimestamp
public long getLastHomeConfirmationTimestamp() -
setLastHomeConfirmationTimestamp
public void setLastHomeConfirmationTimestamp() -
getSignCopy
-
isFreeze
public boolean isFreeze() -
setFreeze
public void setFreeze(boolean freeze) -
isBaltopExempt
public boolean isBaltopExempt() -
getLastVanishTime
public long getLastVanishTime() -
getTargetBlock
- Specified by:
getTargetBlock
in interfaceIUser
-
setToggleShout
public void setToggleShout(boolean toggleShout) - Specified by:
setToggleShout
in interfaceIUser
-
isToggleShout
public boolean isToggleShout()- Specified by:
isToggleShout
in interfaceIUser
-