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
  • Field Details Link icon

    • cachedTaxOwing Link icon

      protected com.palmergames.bukkit.towny.object.Resident.CachedTaxOwing cachedTaxOwing
  • Constructor Details Link icon

    • Resident Link icon

      public Resident(String name)
  • Method Details Link icon

    • equals Link icon

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • setLastOnline Link icon

      public void setLastOnline(long lastOnline)
    • getLastOnline Link icon

      public long getLastOnline()
    • setNPC Link icon

      public void setNPC(boolean isNPC)
    • isNPC Link icon

      public boolean isNPC()
    • getUUID Link icon

      public UUID getUUID()
      Specified by:
      getUUID in interface Identifiable
    • setUUID Link icon

      public void setUUID(UUID uuid)
      Description copied from interface: Identifiable
      This should only be used by internal loading methods!
      Specified by:
      setUUID in interface Identifiable
      Parameters:
      uuid - the UUID to set.
    • hasUUID Link icon

      public boolean hasUUID()
    • getJail Link icon

      public Jail getJail()
    • setJail Link icon

      public void setJail(Jail jail)
    • isJailed Link icon

      public boolean isJailed()
    • getJailCell Link icon

      public int getJailCell()
    • setJailCell Link icon

      public void setJailCell(int i)
    • getJailTown Link icon

      public Town getJailTown()
    • hasJailTown Link icon

      public boolean hasJailTown(String jailtown)
    • getJailHours Link icon

      public int getJailHours()
    • setJailHours Link icon

      public void setJailHours(Integer hours)
    • getJailBailCost Link icon

      public double getJailBailCost()
    • setJailBailCost Link icon

      public void setJailBailCost(double bail)
    • hasJailTime Link icon

      public boolean hasJailTime()
    • getJailSpawn Link icon

      public org.bukkit.Location getJailSpawn()
    • getPrimaryRankPrefix Link icon

      public String getPrimaryRankPrefix()
    • setTitle Link icon

      public void setTitle(String title)
    • getTitle Link icon

      public String getTitle()
    • hasTitle Link icon

      public boolean hasTitle()
    • setSurname Link icon

      public void setSurname(String surname)
    • getSurname Link icon

      public String getSurname()
    • hasSurname Link icon

      public boolean hasSurname()
    • setAbout Link icon

      public void setAbout(@NotNull @NotNull String about)
    • getAbout Link icon

      @NotNull public @NotNull String getAbout()
    • isKing Link icon

      public boolean isKing()
    • isMayor Link icon

      public boolean isMayor()
    • hasTown Link icon

      public boolean hasTown()
    • hasNation Link icon

      public boolean hasNation()
    • getTown Link icon

      public Town getTown() throws NotRegisteredException
      Throws:
      NotRegisteredException
    • getTownOrNull Link icon

      @Nullable public @Nullable Town getTownOrNull()
      Relatively safe to use after confirming there is a town using hasTown().
      Returns:
      Town the resident belongs to or null.
    • setTown Link icon

      public void setTown(Town town) throws AlreadyRegisteredException
      Throws:
      AlreadyRegisteredException
    • setTown Link icon

      public void setTown(Town town, boolean updateJoinedAt) throws AlreadyRegisteredException
      Throws:
      AlreadyRegisteredException
    • removeTown Link icon

      public void removeTown()
    • removeTown Link icon

      public void removeTown(boolean townDeleted)
    • setFriends Link icon

      public void setFriends(List<Resident> newFriends)
    • getFriends Link icon

      public List<Resident> getFriends()
    • removeFriend Link icon

      public void removeFriend(Resident resident)
    • hasFriend Link icon

      public boolean hasFriend(Resident resident)
    • addFriend Link icon

      public void addFriend(Resident resident)
    • removeAllFriends Link icon

      public void removeAllFriends()
    • updatePerms Link icon

      public void updatePerms()
    • updatePermsForNationRemoval Link icon

      public void updatePermsForNationRemoval()
    • setRegistered Link icon

      public void setRegistered(long registered)
    • getRegistered Link icon

      public long getRegistered()
    • getTreeString Link icon

      public List<String> getTreeString(int depth)
      Overrides:
      getTreeString in class TownyObject
    • getTeleportRequestTime Link icon

      @Obsolete public long getTeleportRequestTime()
    • getTeleportDestination Link icon

      @Obsolete public org.bukkit.Location getTeleportDestination()
    • getTeleportCooldown Link icon

      @Obsolete public int getTeleportCooldown()
    • hasRequestedTeleport Link icon

      public boolean hasRequestedTeleport()
      Returns:
      Whether this resident has an active teleport warmup that they're waiting for.
    • getTeleportCost Link icon

      @Obsolete public double getTeleportCost()
    • getTeleportAccount Link icon

      @Obsolete public Account getTeleportAccount()
    • hasPermissionNode Link icon

      public boolean hasPermissionNode(String node)
      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 Link icon

      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 Link icon

      public List<String> getModes()
    • hasMode Link icon

      public boolean hasMode(String mode)
    • toggleMode Link icon

      @Deprecated public void toggleMode(String[] newModes, boolean notify)
      Parameters:
      newModes -
      notify -
    • setModes Link icon

      @Deprecated public void setModes(String[] modes, boolean notify)
      Parameters:
      modes -
      notify -
    • clearModes Link icon

      public void clearModes()
    • clearModes Link icon

      public void clearModes(boolean notify)
    • resetModes Link icon

      public void resetModes(String[] modes, boolean notify)
      Only for internal Towny use. NEVER call this from any other plugin.
      Parameters:
      modes - - String Array of modes
      notify - - If notifications should be sent
    • getPlayer Link icon

      @Nullable public @Nullable org.bukkit.entity.Player getPlayer()
    • addTownRank Link icon

      public boolean addTownRank(String rank)
    • setTownRanks Link icon

      public void setTownRanks(List<String> ranks)
    • hasTownRank Link icon

      public boolean hasTownRank(String rank)
    • getTownRanks Link icon

      public List<String> getTownRanks()
    • getTownRanksForSaving Link icon

      @Internal public List<String> getTownRanksForSaving()
    • removeTownRank Link icon

      public boolean removeTownRank(String rank)
    • getHighestPriorityTownRank Link icon

      @Nullable public @Nullable String getHighestPriorityTownRank()
    • addNationRank Link icon

      public boolean addNationRank(String rank)
    • setNationRanks Link icon

      public void setNationRanks(List<String> ranks)
    • hasNationRank Link icon

      public boolean hasNationRank(String rank)
    • getNationRanks Link icon

      public List<String> getNationRanks()
    • getNationRanksForSaving Link icon

      @Internal public List<String> getNationRanksForSaving()
    • removeNationRank Link icon

      public boolean removeNationRank(String rank)
    • getHighestPriorityNationRank Link icon

      @Nullable public @Nullable String getHighestPriorityNationRank()
    • isAlliedWith Link icon

      public boolean isAlliedWith(Resident otherresident)
    • getReceivedInvites Link icon

      public List<Invite> getReceivedInvites()
      Description copied from interface: InviteReceiver
      Gets the collection of invites received.
      Specified by:
      getReceivedInvites in interface InviteReceiver
      Returns:
      An unmodifiable collection of received invites.
    • newReceivedInvite Link icon

      public void newReceivedInvite(Invite invite) throws TooManyInvitesException
      Description copied from interface: InviteReceiver
      Adds an invite to the received collection.
      Specified by:
      newReceivedInvite in interface InviteReceiver
      Parameters:
      invite - The invite to add.
      Throws:
      TooManyInvitesException - When the invite cap is reached.
    • deleteReceivedInvite Link icon

      public void deleteReceivedInvite(Invite invite)
      Description copied from interface: InviteReceiver
      Removes an invite from the received collection.
      Specified by:
      deleteReceivedInvite in interface InviteReceiver
      Parameters:
      invite - The invite to remove.
    • addMetaData Link icon

      public void addMetaData(@NotNull @NotNull CustomDataField<?> md)
      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 class TownyObject
      Parameters:
      md - CustomDataField to add.
    • removeMetaData Link icon

      public void removeMetaData(@NotNull @NotNull CustomDataField<?> md)
      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 class TownyObject
      Parameters:
      md - CustomDataField to remove.
    • getAccount Link icon

      public Account getAccount()
      Description copied from interface: EconomyHandler
      Gets the Account associated with this object.
      Specified by:
      getAccount in interface EconomyHandler
      Returns:
      An Account for this class.
    • getAccountOrNull Link icon

      @Nullable public @Nullable Account getAccountOrNull()
    • getFormattedName Link icon

      public String getFormattedName()
      Description copied from interface: Nameable
      Gets the formatted name of the object.
      Specified by:
      getFormattedName in interface Nameable
      Returns:
      The formatted name.
    • getNamePrefix Link icon

      public String 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 Link icon

      public String 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 Link icon

      public String getFormattedTitleName()
    • setTownblocks Link icon

      public void setTownblocks(Collection<TownBlock> townBlocks)
    • getTownBlocks Link icon

      public Collection<TownBlock> getTownBlocks()
      Description copied from interface: TownBlockOwner
      Gets the unmodifiable collection of townblocks.
      Specified by:
      getTownBlocks in interface TownBlockOwner
      Returns:
      The townblocks this object contains.
    • getTownsOutlawedIn Link icon

      public List<Town> getTownsOutlawedIn()
      Returns:
      All towns that the resident is outlawed in
    • hasTownBlock Link icon

      public boolean hasTownBlock(TownBlock townBlock)
      Description copied from interface: TownBlockOwner
      Checks whether object has townblock or not.
      Specified by:
      hasTownBlock in interface TownBlockOwner
      Parameters:
      townBlock - The townblock to check for.
      Returns:
      A boolean indicating if it was found or not.
    • addTownBlock Link icon

      public void addTownBlock(TownBlock townBlock) throws AlreadyRegisteredException
      Description copied from interface: TownBlockOwner
      Adds a townblock to the list of existing townblocks.
      Specified by:
      addTownBlock in interface TownBlockOwner
      Parameters:
      townBlock - The townblock to add.
      Throws:
      AlreadyRegisteredException - When the townblock is already in the list.
    • removeTownBlock Link icon

      public void removeTownBlock(TownBlock townBlock)
      Description copied from interface: TownBlockOwner
      Removes townblock from the list of existing townblocks.
      Specified by:
      removeTownBlock in interface TownBlockOwner
      Parameters:
      townBlock - The townblock to remove.
    • setPermissions Link icon

      public void setPermissions(String line)
      Description copied from interface: Permissible
      The the permissions of this object.
      Specified by:
      setPermissions in interface Permissible
      Parameters:
      line - The String line representation of the permissions.
    • getPermissions Link icon

      public TownyPermission getPermissions()
      Description copied from interface: Permissible
      Gets the permissions of the object.
      Specified by:
      getPermissions in interface Permissible
      Returns:
      TownyPermission the permissions of the object.
    • getConfirmation Link icon

      public Confirmation getConfirmation()
    • setConfirmation Link icon

      public void setConfirmation(Confirmation confirmation)
    • getGUIPage Link icon

      public org.bukkit.inventory.Inventory getGUIPage()
      Returns:
      the current inventory which the player is looking at for the GUIs.
    • getGUIPages Link icon

      public ArrayList<org.bukkit.inventory.Inventory> getGUIPages()
    • setGUIPages Link icon

      public void setGUIPages(ArrayList<org.bukkit.inventory.Inventory> inventory)
    • getGUIPageNum Link icon

      public int getGUIPageNum()
    • setGUIPageNum Link icon

      public void setGUIPageNum(int currentInventoryPage)
    • getGUISelectionType Link icon

      public SelectionGUI.SelectionType getGUISelectionType()
    • setGUISelectionType Link icon

      public void setGUISelectionType(SelectionGUI.SelectionType selectionType)
    • save Link icon

      public void save()
      Description copied from interface: Savable
      Schedules the object to be saved to the database.
      Specified by:
      save in interface Savable
    • getEmbassyTowns Link icon

      public List<Town> 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 Link icon

      public long getJoinedTownAt()
    • setJoinedTownAt Link icon

      public void setJoinedTownAt(long joinedTownAt)
    • getNation Link icon

      public Nation getNation() throws TownyException
      Throws:
      TownyException
    • getNationOrNull Link icon

      @Nullable public @Nullable Nation getNationOrNull()
    • isOnline Link icon

      public boolean isOnline()
    • hasRespawnProtection Link icon

      public boolean hasRespawnProtection()
    • addRespawnProtection Link icon

      public void addRespawnProtection(long protectionTime)
    • removeRespawnProtection Link icon

      public void removeRespawnProtection()
    • isRespawnPickupWarningShown Link icon

      public boolean isRespawnPickupWarningShown()
    • setRespawnPickupWarningShown Link icon

      public void setRespawnPickupWarningShown(boolean respawnPickupWarningShown)
    • audience Link icon

      @NotNull public @NotNull net.kyori.adventure.audience.Audience audience()
      Specified by:
      audience in interface net.kyori.adventure.audience.ForwardingAudience.Single
    • isSeeingBorderTitles Link icon

      public boolean isSeeingBorderTitles()
    • hasPlotGroupName Link icon

      public boolean hasPlotGroupName()
    • getPlotGroupName Link icon

      public String getPlotGroupName()
    • setPlotGroupName Link icon

      public void setPlotGroupName(String plotGroupName)
    • hasDistrictName Link icon

      public boolean hasDistrictName()
    • getDistrictName Link icon

      public String getDistrictName()
    • setDistrictName Link icon

      public void setDistrictName(String districtName)
    • exists Link icon

      @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 class TownyObject
      Returns:
      true if this TownyObject exists.
    • getTaxOwing Link icon

      public double getTaxOwing(boolean useCache)
    • getCachedTaxOwing Link icon

      public double getCachedTaxOwing()
      Returns a cached amount of taxes that a resident will pay daily.
      Returns:
      tax Double which is from a Resident.CachedTaxOwing.owing.
    • getCachedTaxOwing Link icon

      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 a Resident.CachedTaxOwing.owing.
    • removeTrustInTown Link icon

      public void removeTrustInTown(Town town)