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
FieldsModifier and TypeFieldDescriptionprotected com.palmergames.bukkit.towny.object.Resident.CachedTaxOwing -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddMetaData(@NotNull CustomDataField<?> md) Add a specific metadata to this TownyObject.booleanaddNationRank(String rank) voidaddRespawnProtection(long protectionTime) voidaddTownBlock(TownBlock townBlock) Adds a townblock to the list of existing townblocks.booleanaddTownRank(String rank) @NotNull net.kyori.adventure.audience.Audienceaudience()voidvoidclearModes(boolean notify) voiddeleteReceivedInvite(Invite invite) Removes an invite from the received collection.booleanbooleanexists()An internal method used to determine if an object exists in the TownyUniverse's maps.@NotNull StringgetAbout()Gets theAccountassociated with this object.@Nullable AccountdoubleReturns a cached amount of taxes that a resident will pay daily.doublegetCachedTaxOwing(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.InventoryintArrayList<org.bukkit.inventory.Inventory> @Nullable String@Nullable StringgetJail()doubleintintorg.bukkit.LocationlonglonggetModes()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 NationGets the permissions of the object.@Nullable org.bukkit.entity.PlayerGets the collection of invites received.longdoublegetTaxOwing(boolean useCache) intdoubleorg.bukkit.LocationlonggetTitle()getTown()Gets the unmodifiable collection of townblocks.@Nullable TownRelatively safe to use after confirming there is a town usinghasTown().getTreeString(int depth) getUUID()booleanbooleaninthashCode()booleanbooleanhasJailTown(String jailtown) booleanbooleanbooleanhasNationRank(String rank) booleanhasPermissionNode(String node) booleanbooleanbooleanbooleanbooleanhasTitle()booleanhasTown()booleanhasTownBlock(TownBlock townBlock) Checks whether object has townblock or not.booleanhasTownRank(String rank) booleanhasUUID()booleanisAdmin()booleanisAlliedWith(Resident otherresident) booleanisJailed()booleanisKing()booleanisMayor()booleanisNPC()booleanisOnline()booleanbooleanvoidnewReceivedInvite(Invite invite) Adds an invite to the received collection.voidvoidremoveFriend(Resident resident) voidremoveMetaData(@NotNull CustomDataField<?> md) Remove a specific metadata from the TownyObject.booleanremoveNationRank(String rank) voidvoidvoidremoveTown(boolean townDeleted) voidremoveTownBlock(TownBlock townBlock) Removes townblock from the list of existing townblocks.booleanremoveTownRank(String rank) voidremoveTrustInTown(Town town) voidresetModes(String[] modes, boolean notify) Only for internal Towny use.voidsave()Schedules the object to be saved to the database.voidvoidsetConfirmation(Confirmation confirmation) voidsetDistrictName(String districtName) voidsetFriends(List<Resident> newFriends) voidsetGUIPageNum(int currentInventoryPage) voidsetGUIPages(ArrayList<org.bukkit.inventory.Inventory> inventory) voidsetGUISelectionType(SelectionGUI.SelectionType selectionType) voidvoidsetJailBailCost(double bail) voidsetJailCell(int i) voidsetJailHours(Integer hours) voidsetJoinedTownAt(long joinedTownAt) voidsetLastOnline(long lastOnline) voidDeprecated.since 0.100.4.6.voidsetNationRanks(List<String> ranks) voidsetNPC(boolean isNPC) voidsetPermissions(String line) The the permissions of this object.voidsetPlotGroupName(String plotGroupName) voidsetRegistered(long registered) voidsetRespawnPickupWarningShown(boolean respawnPickupWarningShown) voidsetSurname(String surname) voidvoidvoidvoidsetTownblocks(Collection<TownBlock> townBlocks) voidsetTownRanks(List<String> ranks) voidThis should only be used by internal loading methods!voidtoggleMode(String[] newModes, boolean notify) Deprecated.since 0.100.4.6.voidvoidMethods inherited from class com.palmergames.bukkit.towny.object.TownyObject
addMetaData, getMetadata, getMetadata, getMetadata, getName, getTreeDepth, hasMeta, hasMeta, hasMeta, removeMetaData, removeMetaData, removeMetaData, setName, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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, stopSoundMethods 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, showDialog, 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:
getUUIDin interfaceIdentifiable
-
setUUID
Description copied from interface:IdentifiableThis should only be used by internal loading methods!- Specified by:
setUUIDin 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:
getTreeStringin classTownyObject
-
getTeleportRequestTime
@Obsolete public long getTeleportRequestTime() -
getTeleportDestination
@Obsolete public org.bukkit.Location getTeleportDestination() -
getTeleportCooldown
@Obsolete public int getTeleportCooldown() -
hasRequestedTeleport
public boolean hasRequestedTeleport()- Returns:
- Whether this resident has an active teleport warmup that they're waiting for.
-
getTeleportCost
@Obsolete public double getTeleportCost() -
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
Deprecated.since 0.100.4.6. UseResidentModeHandler.toggleModes(Resident, String[], boolean, boolean)instead.- Parameters:
newModes-notify-
-
setModes
Deprecated.since 0.100.4.6. UseResidentModeHandler.toggleModes(Resident, String[], boolean, boolean)instead.- Parameters:
modes-notify-
-
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
-
getTownRanksForSaving
-
removeTownRank
-
getHighestPriorityTownRank
-
addNationRank
-
setNationRanks
-
hasNationRank
-
getNationRanks
-
getNationRanksForSaving
-
removeNationRank
-
getHighestPriorityNationRank
-
isAlliedWith
-
getReceivedInvites
Description copied from interface:InviteReceiverGets the collection of invites received.- Specified by:
getReceivedInvitesin interfaceInviteReceiver- Returns:
- An unmodifiable collection of received invites.
-
newReceivedInvite
Description copied from interface:InviteReceiverAdds an invite to the received collection.- Specified by:
newReceivedInvitein interfaceInviteReceiver- Parameters:
invite- The invite to add.- Throws:
TooManyInvitesException- When the invite cap is reached.
-
deleteReceivedInvite
Description copied from interface:InviteReceiverRemoves an invite from the received collection.- Specified by:
deleteReceivedInvitein interfaceInviteReceiver- Parameters:
invite- The invite to remove.
-
addMetaData
Description copied from class:TownyObjectAdd 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:
addMetaDatain classTownyObject- Parameters:
md- CustomDataField to add.
-
removeMetaData
Description copied from class:TownyObjectRemove 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:
removeMetaDatain classTownyObject- Parameters:
md- CustomDataField to remove.
-
getAccount
Description copied from interface:EconomyHandlerGets theAccountassociated with this object.- Specified by:
getAccountin interfaceEconomyHandler- Returns:
- An
Accountfor this class.
-
getAccountOrNull
-
getFormattedName
Description copied from interface:NameableGets the formatted name of the object.- Specified by:
getFormattedNamein 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:TownBlockOwnerGets the unmodifiable collection of townblocks.- Specified by:
getTownBlocksin interfaceTownBlockOwner- Returns:
- The townblocks this object contains.
-
getTownsOutlawedIn
- Returns:
- All towns that the resident is outlawed in
-
hasTownBlock
Description copied from interface:TownBlockOwnerChecks whether object has townblock or not.- Specified by:
hasTownBlockin interfaceTownBlockOwner- Parameters:
townBlock- The townblock to check for.- Returns:
- A boolean indicating if it was found or not.
-
addTownBlock
Description copied from interface:TownBlockOwnerAdds a townblock to the list of existing townblocks.- Specified by:
addTownBlockin interfaceTownBlockOwner- Parameters:
townBlock- The townblock to add.- Throws:
AlreadyRegisteredException- When the townblock is already in the list.
-
removeTownBlock
Description copied from interface:TownBlockOwnerRemoves townblock from the list of existing townblocks.- Specified by:
removeTownBlockin interfaceTownBlockOwner- Parameters:
townBlock- The townblock to remove.
-
setPermissions
Description copied from interface:PermissibleThe the permissions of this object.- Specified by:
setPermissionsin interfacePermissible- Parameters:
line- The String line representation of the permissions.
-
getPermissions
Description copied from interface:PermissibleGets the permissions of the object.- Specified by:
getPermissionsin interfacePermissible- Returns:
TownyPermissionthe 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:SavableSchedules 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:
audiencein interfacenet.kyori.adventure.audience.ForwardingAudience.Single
-
isSeeingBorderTitles
public boolean isSeeingBorderTitles() -
hasPlotGroupName
public boolean hasPlotGroupName() -
getPlotGroupName
-
setPlotGroupName
-
hasDistrictName
public boolean hasDistrictName() -
getDistrictName
-
setDistrictName
-
exists
@Internal public boolean exists()Description copied from class:TownyObjectAn internal method used to determine if an object exists in the TownyUniverse's maps.- Specified by:
existsin 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
Doublewhich 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
Doublewhich is from aResident.CachedTaxOwing.owing.
-
removeTrustInTown
-