Class Resident
java.lang.Object
com.palmergames.bukkit.towny.object.TownyObject
com.palmergames.bukkit.towny.object.Resident
- All Implemented Interfaces:
InviteReceiver
,EconomyHandler
,Identifiable
,Nameable
,Permissible
,Savable
,TownBlockOwner
,net.kyori.adventure.audience.Audience
,net.kyori.adventure.audience.ForwardingAudience
,net.kyori.adventure.audience.ForwardingAudience.Single
,net.kyori.adventure.pointer.Pointered
public class Resident
extends TownyObject
implements InviteReceiver, EconomyHandler, TownBlockOwner, Identifiable, net.kyori.adventure.audience.ForwardingAudience.Single
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.kyori.adventure.audience.ForwardingAudience
net.kyori.adventure.audience.ForwardingAudience.Single
-
Field Summary
Modifier and TypeFieldDescriptionprotected com.palmergames.bukkit.towny.object.Resident.CachedTaxOwing
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addMetaData
(@NotNull CustomDataField<?> md) Add a specific metadata to this TownyObject.boolean
addNationRank
(String rank) void
addRespawnProtection
(long protectionTime) void
addTownBlock
(TownBlock townBlock) Adds a townblock to the list of existing townblocks.boolean
addTownRank
(String rank) @NotNull net.kyori.adventure.audience.Audience
audience()
void
void
clearModes
(boolean notify) void
Deprecated.Deprecated as of 0.99.0.10, clearing teleport requests is no longer needed.void
deleteReceivedInvite
(Invite invite) Removes an invite from the received collection.boolean
boolean
exists()
An internal method used to determine if an object exists in the TownyUniverse's maps.@NotNull String
getAbout()
Gets theAccount
associated with this object.@Nullable Account
double
Returns a cached amount of taxes that a resident will pay daily.double
getCachedTaxOwing
(boolean refreshIfStale) Returns a cached amount of taxes that a resident will pay daily, with the ability to only refresh the cache if it is stale.Gets a list of Towns which the given resident owns embassy plots in.Gets the formatted name of the object.org.bukkit.inventory.Inventory
int
ArrayList<org.bukkit.inventory.Inventory>
@Nullable String
@Nullable String
getJail()
double
int
int
org.bukkit.Location
long
long
getModes()
Returns King or Mayor postfix set in the Town and Nation Levels of the config.Returns King or Mayor prefix set in the Town and Nation Levels of the config.@Nullable Nation
Gets the permissions of the object.@Nullable org.bukkit.entity.Player
Gets the collection of invites received.long
double
getTaxOwing
(boolean useCache) int
double
org.bukkit.Location
long
getTitle()
getTown()
Gets the unmodifiable collection of townblocks.@Nullable Town
Relatively safe to use after confirming there is a town usinghasTown()
.getTreeString
(int depth) getUUID()
boolean
int
hashCode()
boolean
boolean
hasJailTown
(String jailtown) boolean
boolean
boolean
hasNationRank
(String rank) boolean
hasPermissionNode
(String node) boolean
boolean
boolean
boolean
boolean
hasTitle()
boolean
hasTown()
boolean
hasTownBlock
(TownBlock townBlock) Checks whether object has townblock or not.boolean
hasTownRank
(String rank) boolean
hasUUID()
boolean
isAdmin()
boolean
isAlliedWith
(Resident otherresident) boolean
isJailed()
boolean
isKing()
boolean
isMayor()
boolean
isNPC()
boolean
isOnline()
boolean
boolean
void
newReceivedInvite
(Invite invite) Adds an invite to the received collection.void
void
removeFriend
(Resident resident) void
removeMetaData
(@NotNull CustomDataField<?> md) Remove a specific metadata from the TownyObject.boolean
removeNationRank
(String rank) void
void
void
removeTown
(boolean townDeleted) void
removeTownBlock
(TownBlock townBlock) Removes townblock from the list of existing townblocks.boolean
removeTownRank
(String rank) void
resetModes
(String[] modes, boolean notify) Only for internal Towny use.void
save()
Schedules the object to be saved to the database.void
void
setConfirmation
(Confirmation confirmation) void
setFriends
(List<Resident> newFriends) void
setGUIPageNum
(int currentInventoryPage) void
setGUIPages
(ArrayList<org.bukkit.inventory.Inventory> inventory) void
setGUISelectionType
(SelectionGUI.SelectionType selectionType) void
void
setJailBailCost
(double bail) void
setJailCell
(int i) void
setJailHours
(Integer hours) void
setJoinedTownAt
(long joinedTownAt) void
setLastOnline
(long lastOnline) void
void
setNationRanks
(List<String> ranks) void
setNPC
(boolean isNPC) void
setPermissions
(String line) The the permissions of this object.void
setPlotGroupName
(String plotGroupName) void
setRegistered
(long registered) void
setRespawnPickupWarningShown
(boolean respawnPickupWarningShown) void
setSurname
(String surname) void
setTeleportAccount
(Account payee) Deprecated.Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested.void
setTeleportCooldown
(int cooldown) Deprecated.Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested.void
setTeleportCost
(double cost) Deprecated.Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested.void
setTeleportDestination
(org.bukkit.Location spawnLoc) Deprecated.Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested.void
Deprecated.Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested.void
void
void
void
setTownblocks
(Collection<TownBlock> townBlocks) void
setTownRanks
(List<String> ranks) void
This should only be used by internal loading methods!void
toggleMode
(String[] newModes, boolean notify) void
void
Methods inherited from class com.palmergames.bukkit.towny.object.TownyObject
addMetaData, getMetadata, getMetadata, getMetadata, getName, getTreeDepth, hasMeta, hasMeta, hasMeta, removeMetaData, removeMetaData, removeMetaData, setName, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.kyori.adventure.audience.Audience
deleteMessage, openBook, removeResourcePacks, removeResourcePacks, removeResourcePacks, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, showTitle, stopSound
Methods inherited from interface net.kyori.adventure.audience.ForwardingAudience.Single
audiences, clearResourcePacks, clearTitle, deleteMessage, filterAudience, forEachAudience, get, getOrDefault, getOrDefaultFrom, hideBossBar, openBook, playSound, playSound, playSound, pointers, removeResourcePacks, removeResourcePacks, resetTitle, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendResourcePacks, sendTitlePart, showBossBar, stopSound
-
Field Details
-
cachedTaxOwing
protected com.palmergames.bukkit.towny.object.Resident.CachedTaxOwing cachedTaxOwing
-
-
Constructor Details
-
Resident
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
setLastOnline
public void setLastOnline(long lastOnline) -
getLastOnline
public long getLastOnline() -
setNPC
public void setNPC(boolean isNPC) -
isNPC
public boolean isNPC() -
getUUID
- Specified by:
getUUID
in interfaceIdentifiable
-
setUUID
Description copied from interface:Identifiable
This should only be used by internal loading methods!- Specified by:
setUUID
in interfaceIdentifiable
- Parameters:
uuid
- the UUID to set.
-
hasUUID
public boolean hasUUID() -
getJail
-
setJail
-
isJailed
public boolean isJailed() -
getJailCell
public int getJailCell() -
setJailCell
public void setJailCell(int i) -
getJailTown
-
hasJailTown
-
getJailHours
public int getJailHours() -
setJailHours
-
getJailBailCost
public double getJailBailCost() -
setJailBailCost
public void setJailBailCost(double bail) -
hasJailTime
public boolean hasJailTime() -
getJailSpawn
public org.bukkit.Location getJailSpawn() -
getPrimaryRankPrefix
-
setTitle
-
getTitle
-
hasTitle
public boolean hasTitle() -
setSurname
-
getSurname
-
hasSurname
public boolean hasSurname() -
setAbout
-
getAbout
-
isKing
public boolean isKing() -
isMayor
public boolean isMayor() -
hasTown
public boolean hasTown() -
hasNation
public boolean hasNation() -
getTown
- Throws:
NotRegisteredException
-
getTownOrNull
Relatively safe to use after confirming there is a town usinghasTown()
.- Returns:
- Town the resident belongs to or null.
-
setTown
- Throws:
AlreadyRegisteredException
-
setTown
- Throws:
AlreadyRegisteredException
-
removeTown
public void removeTown() -
removeTown
public void removeTown(boolean townDeleted) -
setFriends
-
getFriends
-
removeFriend
-
hasFriend
-
addFriend
-
removeAllFriends
public void removeAllFriends() -
updatePerms
public void updatePerms() -
updatePermsForNationRemoval
public void updatePermsForNationRemoval() -
setRegistered
public void setRegistered(long registered) -
getRegistered
public long getRegistered() -
getTreeString
- Overrides:
getTreeString
in classTownyObject
-
clearTeleportRequest
Deprecated.Deprecated as of 0.99.0.10, clearing teleport requests is no longer needed. UseTownyAPI.abortTeleportRequest(Resident)
to abort an active teleport request. -
setTeleportRequestTime
Deprecated.Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested. -
getTeleportRequestTime
@Obsolete public long getTeleportRequestTime() -
setTeleportDestination
Deprecated.Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested. -
getTeleportDestination
@Obsolete public org.bukkit.Location getTeleportDestination() -
setTeleportCooldown
Deprecated.Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested. -
getTeleportCooldown
@Obsolete public int getTeleportCooldown() -
hasRequestedTeleport
public boolean hasRequestedTeleport()- Returns:
- Whether this resident has an active teleport warmup that they're waiting for.
-
setTeleportCost
Deprecated.Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested. -
getTeleportCost
@Obsolete public double getTeleportCost() -
setTeleportAccount
Deprecated.Deprecated as of 0.99.0.10, teleport request related values are no longer modifiable once the teleport has been requested. -
getTeleportAccount
-
hasPermissionNode
- Parameters:
node
- String representing a PermissionNode to test for.- Returns:
- true if the Player of the Resident has the permission node assigned to them according to the TownyPermissionSource.
-
isAdmin
public boolean isAdmin()- Returns:
- true if the Player of the Resident is a server OP or has the towny.admin permission node according to the TownyPermissionSource.
-
getModes
-
hasMode
-
toggleMode
-
setModes
-
clearModes
public void clearModes() -
clearModes
public void clearModes(boolean notify) -
resetModes
Only for internal Towny use. NEVER call this from any other plugin.- Parameters:
modes
- - String Array of modesnotify
- - If notifications should be sent
-
getPlayer
@Nullable public @Nullable org.bukkit.entity.Player getPlayer() -
addTownRank
-
setTownRanks
-
hasTownRank
-
getTownRanks
-
removeTownRank
-
getHighestPriorityTownRank
-
addNationRank
-
setNationRanks
-
hasNationRank
-
getNationRanks
-
removeNationRank
-
getHighestPriorityNationRank
-
isAlliedWith
-
getReceivedInvites
Description copied from interface:InviteReceiver
Gets the collection of invites received.- Specified by:
getReceivedInvites
in interfaceInviteReceiver
- Returns:
- An unmodifiable collection of received invites.
-
newReceivedInvite
Description copied from interface:InviteReceiver
Adds an invite to the received collection.- Specified by:
newReceivedInvite
in interfaceInviteReceiver
- Parameters:
invite
- The invite to add.- Throws:
TooManyInvitesException
- When the invite cap is reached.
-
deleteReceivedInvite
Description copied from interface:InviteReceiver
Removes an invite from the received collection.- Specified by:
deleteReceivedInvite
in interfaceInviteReceiver
- Parameters:
invite
- The invite to remove.
-
addMetaData
Description copied from class:TownyObject
Add a specific metadata to this TownyObject. Overrides existing metadata of the same key. Most implementations will save the object after this method is called.- Overrides:
addMetaData
in classTownyObject
- Parameters:
md
- CustomDataField to add.
-
removeMetaData
Description copied from class:TownyObject
Remove a specific metadata from the TownyObject. The metadata does not need to be the same instance of the one added, but must have the same key. Most implementations will save the TownyObject after removing the metadata.- Overrides:
removeMetaData
in classTownyObject
- Parameters:
md
- CustomDataField to remove.
-
getAccount
Description copied from interface:EconomyHandler
Gets theAccount
associated with this object.- Specified by:
getAccount
in interfaceEconomyHandler
- Returns:
- An
Account
for this class.
-
getAccountOrNull
-
getFormattedName
Description copied from interface:Nameable
Gets the formatted name of the object.- Specified by:
getFormattedName
in interfaceNameable
- Returns:
- The formatted name.
-
getNamePrefix
Returns King or Mayor prefix set in the Town and Nation Levels of the config.- Returns:
- Prefix of a King or Mayor if resident is a king or mayor.
-
getNamePostfix
Returns King or Mayor postfix set in the Town and Nation Levels of the config.- Returns:
- Postfix of a King or Mayor if resident is a king or mayor.
-
getFormattedTitleName
-
setTownblocks
-
getTownBlocks
Description copied from interface:TownBlockOwner
Gets the unmodifiable collection of townblocks.- Specified by:
getTownBlocks
in interfaceTownBlockOwner
- Returns:
- The townblocks this object contains.
-
getTownsOutlawedIn
- Returns:
- All towns that the resident is outlawed in
-
hasTownBlock
Description copied from interface:TownBlockOwner
Checks whether object has townblock or not.- Specified by:
hasTownBlock
in interfaceTownBlockOwner
- Parameters:
townBlock
- The townblock to check for.- Returns:
- A boolean indicating if it was found or not.
-
addTownBlock
Description copied from interface:TownBlockOwner
Adds a townblock to the list of existing townblocks.- Specified by:
addTownBlock
in interfaceTownBlockOwner
- Parameters:
townBlock
- The townblock to add.- Throws:
AlreadyRegisteredException
- When the townblock is already in the list.
-
removeTownBlock
Description copied from interface:TownBlockOwner
Removes townblock from the list of existing townblocks.- Specified by:
removeTownBlock
in interfaceTownBlockOwner
- Parameters:
townBlock
- The townblock to remove.
-
setPermissions
Description copied from interface:Permissible
The the permissions of this object.- Specified by:
setPermissions
in interfacePermissible
- Parameters:
line
- The String line representation of the permissions.
-
getPermissions
Description copied from interface:Permissible
Gets the permissions of the object.- Specified by:
getPermissions
in interfacePermissible
- Returns:
TownyPermission
the permissions of the object.
-
getConfirmation
-
setConfirmation
-
getGUIPage
public org.bukkit.inventory.Inventory getGUIPage()- Returns:
- the current inventory which the player is looking at for the GUIs.
-
getGUIPages
-
setGUIPages
-
getGUIPageNum
public int getGUIPageNum() -
setGUIPageNum
public void setGUIPageNum(int currentInventoryPage) -
getGUISelectionType
-
setGUISelectionType
-
save
public void save()Description copied from interface:Savable
Schedules the object to be saved to the database. -
getEmbassyTowns
Gets a list of Towns which the given resident owns embassy plots in.- Returns:
- List of Towns in which the resident owns embassies.
-
getJoinedTownAt
public long getJoinedTownAt() -
setJoinedTownAt
public void setJoinedTownAt(long joinedTownAt) -
getNation
- Throws:
TownyException
-
getNationOrNull
-
isOnline
public boolean isOnline() -
hasRespawnProtection
public boolean hasRespawnProtection() -
addRespawnProtection
public void addRespawnProtection(long protectionTime) -
removeRespawnProtection
public void removeRespawnProtection() -
isRespawnPickupWarningShown
public boolean isRespawnPickupWarningShown() -
setRespawnPickupWarningShown
public void setRespawnPickupWarningShown(boolean respawnPickupWarningShown) -
audience
@NotNull public @NotNull net.kyori.adventure.audience.Audience audience()- Specified by:
audience
in interfacenet.kyori.adventure.audience.ForwardingAudience.Single
-
isSeeingBorderTitles
public boolean isSeeingBorderTitles() -
hasPlotGroupName
public boolean hasPlotGroupName() -
getPlotGroupName
-
setPlotGroupName
-
exists
@Internal public boolean exists()Description copied from class:TownyObject
An internal method used to determine if an object exists in the TownyUniverse's maps.- Specified by:
exists
in classTownyObject
- Returns:
- true if this TownyObject exists.
-
getTaxOwing
public double getTaxOwing(boolean useCache) -
getCachedTaxOwing
public double getCachedTaxOwing()Returns a cached amount of taxes that a resident will pay daily.- Returns:
- tax
Double
which is from aResident.CachedTaxOwing.owing
.
-
getCachedTaxOwing
public double getCachedTaxOwing(boolean refreshIfStale) Returns a cached amount of taxes that a resident will pay daily, with the ability to only refresh the cache if it is stale.- Parameters:
refreshIfStale
- when true, if the cache is stale it will update.- Returns:
- cachedTaxOwing
Double
which is from aResident.CachedTaxOwing.owing
.
-