All Implemented Interfaces:
InviteReceiver, InviteSender, BankEconomyHandler, EconomyHandler, Identifiable, Inviteable, Nameable, Permissible, ResidentList, Savable, SpawnLocation, SpawnPosition, TownBlockOwner, net.kyori.adventure.audience.Audience, net.kyori.adventure.audience.ForwardingAudience, net.kyori.adventure.pointer.Pointered

public class Town extends Government implements TownBlockOwner
  • Constructor Details

  • Method Details

    • equals

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

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

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

      public int getNumTownBlocks()
    • hasTownBlock

      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.
    • hasTownBlock

      public boolean hasTownBlock(WorldCoord worldCoord)
    • addTownBlock

      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.
    • getTownBlock

      public TownBlock getTownBlock(WorldCoord worldCoord)
    • getTownBlockMap

      public ConcurrentMap<WorldCoord,TownBlock> getTownBlockMap()
    • getTownBlockTypeCache

      public TownBlockTypeCache getTownBlockTypeCache()
      Returns:
      the plotTypeCache
    • getMayor

      public Resident getMayor()
    • setTaxes

      public void setTaxes(double taxes)
      Description copied from class: Government
      Sets the tax amount of this object.
      Specified by:
      setTaxes in class Government
      Parameters:
      taxes - The taxes as a percentage or flat number.
    • forceSetMayor

      public void forceSetMayor(Resident mayor) throws TownyException
      Sets a resident to become mayor. Used only in database loading.
      Parameters:
      mayor - - Town Resident to make into mayor.
      Throws:
      TownyException - - When given mayor is not a resident.
    • setMayor

      public void setMayor(Resident mayor)
      Sets a town resident to become mayor.
      Parameters:
      mayor - - Resident to become mayor.
    • setMayor

      public void setMayor(Resident mayor, boolean callEvent)
    • getFounder

      public String getFounder()
    • setFounder

      public void setFounder(String founderName)
    • getNation

      public Nation getNation() throws NotRegisteredException
      Throws:
      NotRegisteredException
    • getNationOrNull

      @Nullable public @Nullable Nation getNationOrNull()
      Safe to use as long as hasNation() has returned true.
      Returns:
      Nation of the Town or null if no Nation.
    • removeNation

      public void removeNation()
    • setNation

      public void setNation(Nation nation) throws AlreadyRegisteredException
      Throws:
      AlreadyRegisteredException
    • setNation

      public void setNation(Nation nation, boolean updateJoinedAt) throws AlreadyRegisteredException
      Throws:
      AlreadyRegisteredException
    • getResidents

      public List<Resident> getResidents()
      Description copied from interface: ResidentList
      Returns an unmodifiable list of residents.
      Specified by:
      getResidents in interface ResidentList
      Returns:
      The list of residents in this object.
    • getRank

      public List<Resident> getRank(String rank)
    • hasResident

      public boolean hasResident(String name)
      Description copied from interface: ResidentList
      Whether a given object contains a resident.
      Specified by:
      hasResident in interface ResidentList
      Parameters:
      name - The name of the resident.
      Returns:
      true if found, false otherwise.
    • hasResident

      public boolean hasResident(Resident resident)
    • hasResident

      public boolean hasResident(org.bukkit.entity.Player player)
    • hasResident

      public boolean hasResident(UUID uuid)
    • hasResidentWithRank

      public boolean hasResidentWithRank(Resident resident, String rank)
    • addResidentCheck

      public void addResidentCheck(Resident resident) throws AlreadyRegisteredException
      Throws:
      AlreadyRegisteredException
    • isMayor

      public boolean isMayor(Resident resident)
    • hasNation

      public boolean hasNation()
    • getNumResidents

      public int getNumResidents()
    • isCapital

      public boolean isCapital()
    • setHasUpkeep

      public void setHasUpkeep(boolean hasUpkeep)
    • hasUpkeep

      public boolean hasUpkeep()
    • hasUnlimitedClaims

      public boolean hasUnlimitedClaims()
      Returns:
      whether the town hasUnlimitedClaims
    • setHasUnlimitedClaims

      public void setHasUnlimitedClaims(boolean hasUnlimitedClaims)
      Parameters:
      hasUnlimitedClaims - set whether the town has unlimited claims or not.
    • setHasMobs

      public void setHasMobs(boolean hasMobs)
    • hasMobs

      public boolean hasMobs()
    • setAdminEnabledMobs

      public void setAdminEnabledMobs(boolean isMobsForced)
    • isAdminEnabledMobs

      public boolean isAdminEnabledMobs()
    • setPVP

      public void setPVP(boolean isPVP)
    • setAdminDisabledPVP

      public void setAdminDisabledPVP(boolean isPVPDisabled)
    • setAdminEnabledPVP

      public void setAdminEnabledPVP(boolean isPVPEnabled)
    • isPVP

      public boolean isPVP()
    • isAdminDisabledPVP

      public boolean isAdminDisabledPVP()
    • isAdminEnabledPVP

      public boolean isAdminEnabledPVP()
    • isAllowedToWar

      public boolean isAllowedToWar()
    • setAllowedToWar

      public void setAllowedToWar(boolean allowedToWar)
    • setExplosion

      public void setExplosion(boolean isExplosion)
    • isExplosion

      public boolean isExplosion()
    • setTaxPercentage

      public void setTaxPercentage(boolean isPercentage)
    • isTaxPercentage

      public boolean isTaxPercentage()
    • setFire

      public void setFire(boolean isFire)
    • isFire

      public boolean isFire()
    • setBonusBlocks

      public void setBonusBlocks(int bonusBlocks)
    • getMaxTownBlocksAsAString

      public String getMaxTownBlocksAsAString()
    • getMaxTownBlocks

      public int getMaxTownBlocks()
    • getBonusBlocks

      public int getBonusBlocks()
    • getBonusBlockCost

      public double getBonusBlockCost()
    • getTownBlockCost

      public double getTownBlockCost()
    • getTownBlockCostN

      public double getTownBlockCostN(int inputN) throws TownyException
      Throws:
      TownyException
    • getBonusBlockCostN

      public double getBonusBlockCostN(int n) throws TownyException
      Throws:
      TownyException
    • addBonusBlocks

      public void addBonusBlocks(int bonusBlocks)
    • setPurchasedBlocks

      public void setPurchasedBlocks(int purchasedBlocks)
    • getPurchasedBlocks

      public int getPurchasedBlocks()
    • addPurchasedBlocks

      public void addPurchasedBlocks(int purchasedBlocks)
    • playerSetsHomeBlock

      public void playerSetsHomeBlock(TownBlock townBlock, org.bukkit.Location location, org.bukkit.entity.Player player)
    • setHomeBlock

      public void setHomeBlock(@Nullable @Nullable TownBlock homeBlock)
      Sets the HomeBlock of a town
      Parameters:
      homeBlock - - The TownBlock to set as the HomeBlock
    • forceSetHomeBlock

      public void forceSetHomeBlock(TownBlock homeBlock) throws TownyException
      Only to be called from the Loading methods.
      Parameters:
      homeBlock - - TownBlock to forcefully set as HomeBlock
      Throws:
      TownyException - - General TownyException
    • getHomeBlock

      public TownBlock getHomeBlock() throws TownyException
      Throws:
      TownyException
    • getHomeBlockOrNull

      @Nullable public @Nullable TownBlock getHomeBlockOrNull()
    • setWorld

      public void setWorld(TownyWorld world)
      Sets the world this town homeblock belongs to. If it's a world change it will remove the town from the old world and place in the new.
      Parameters:
      world - - TownyWorld to attribute a town to
    • getHomeblockWorld

      public TownyWorld getHomeblockWorld()
      Fetch the World this town homeblock is registered too. If the world is null it will poll the TownyWorlds for a townblock owned by the Town. If it fails to find any claimed blocks it will return the first TownyWorld as a placeholder.
      Returns:
      world
    • hasMayor

      public boolean hasMayor()
    • removeResident

      public void removeResident(Resident resident) throws EmptyTownException
      Throws:
      EmptyTownException
    • findNewMayor

      public void findNewMayor()
      Begins search for new mayor.
    • setSpawn

      public void setSpawn(@Nullable @Nullable org.bukkit.Location spawn)
      Description copied from interface: SpawnLocation
      Sets the spawn point of this object.
      Specified by:
      setSpawn in interface SpawnLocation
      Parameters:
      spawn - The Location of the new spawn.
    • getSpawn

      @NotNull public @NotNull org.bukkit.Location getSpawn() throws TownyException
      Description copied from interface: SpawnLocation
      Get the spawn location of this object.
      Specified by:
      getSpawn in interface SpawnLocation
      Returns:
      The spawn location
      Throws:
      TownyException - If no location is found.
    • getSpawnOrNull

      @Nullable public @Nullable org.bukkit.Location getSpawnOrNull()
      Specified by:
      getSpawnOrNull in interface SpawnLocation
    • spawnPosition

      @Nullable public @Nullable Position spawnPosition()
      Description copied from interface: SpawnPosition
      Gets the spawn location of this object.
      Specified by:
      spawnPosition in interface SpawnPosition
      Returns:
      The spawn location or null if none has been set.
    • spawnPosition

      public void spawnPosition(@Nullable @Nullable Position spawn)
      Description copied from interface: SpawnPosition
      Sets the spawn position of this object.
      Specified by:
      spawnPosition in interface SpawnPosition
      Parameters:
      spawn - The position of the new spawn.
    • hasHomeBlock

      public boolean hasHomeBlock()
    • hasWorld

      public boolean hasWorld()
    • removeTownBlock

      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

      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

      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.
    • addOutpostSpawn

      public void addOutpostSpawn(org.bukkit.Location location)
    • addOutpostSpawn

      public void addOutpostSpawn(Position position)
      Add or update an outpost spawn for a town. Saves the TownBlock if it is not already an Outpost. Saves the Town when finished.
      Parameters:
      position - Position to set an outpost's spawn point
    • forceAddOutpostSpawn

      @Internal public void forceAddOutpostSpawn(Position position)
      Only to be called from the Loading methods.
      Parameters:
      position - Location to set Outpost's spawn point
    • getOutpostSpawn

      public org.bukkit.Location getOutpostSpawn(Integer index) throws TownyException
      Return the Location for this Outpost index.
      Parameters:
      index - - Numeric identifier of an Outpost
      Returns:
      Location of Outpost's spawn
      Throws:
      TownyException - if there are no Outpost spawns set
    • getMaxOutpostSpawn

      public int getMaxOutpostSpawn()
    • hasOutpostSpawn

      public boolean hasOutpostSpawn()
    • getAllOutpostSpawns

      public List<org.bukkit.Location> getAllOutpostSpawns()
      Get an unmodifiable List of all outpost spawns.
      Returns:
      List of outpostSpawns
    • getOutpostSpawns

      public Collection<Position> getOutpostSpawns()
      Returns:
      Similar to getAllOutpostSpawns(), but with positions.
    • removeOutpostSpawn

      public void removeOutpostSpawn(Coord coord)
    • removeOutpostSpawn

      public void removeOutpostSpawn(org.bukkit.Location loc)
    • getOutpostNames

      public List<String> getOutpostNames()
    • setForSale

      public final void setForSale(boolean isForSale)
      Sets the town for sale.
      Parameters:
      isForSale - whether the town is for sale.
    • isForSale

      public final boolean isForSale()
      Whether the town is for sale.
      Returns:
      true for on sale, false otherwise.
    • setForSalePrice

      public final void setForSalePrice(double forSalePrice)
      Sets town sale price.
      Parameters:
      forSalePrice - double representing sale price.
    • getForSalePrice

      public final double getForSalePrice()
      Get town sale price.
      Returns:
      double representing sale price.
    • setPlotPrice

      public void setPlotPrice(double plotPrice)
    • getPlotPrice

      public double getPlotPrice()
    • getPlotTypePrice

      public double getPlotTypePrice(TownBlockType type)
    • setCommercialPlotPrice

      public void setCommercialPlotPrice(double commercialPlotPrice)
    • getCommercialPlotPrice

      public double getCommercialPlotPrice()
    • setEmbassyPlotPrice

      public void setEmbassyPlotPrice(double embassyPlotPrice)
    • getEmbassyPlotPrice

      public double getEmbassyPlotPrice()
    • isHomeBlock

      public boolean isHomeBlock(TownBlock townBlock)
    • setPlotTax

      public void setPlotTax(double plotTax)
    • getPlotTax

      public double getPlotTax()
    • setCommercialPlotTax

      public void setCommercialPlotTax(double commercialTax)
    • getCommercialPlotTax

      public double getCommercialPlotTax()
    • setEmbassyPlotTax

      public void setEmbassyPlotTax(double embassyPlotTax)
    • getEmbassyPlotTax

      public double getEmbassyPlotTax()
    • collect

      public void collect(double amount)
    • getTreeString

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

      public Collection<Resident> getOutlaws()
      Description copied from interface: ResidentList
      Gets the unmodifiable list of outlaws.
      Specified by:
      getOutlaws in interface ResidentList
      Returns:
      The list of outlaws in this object.
    • hasOutlaw

      public boolean hasOutlaw(String name)
    • hasOutlaw

      public boolean hasOutlaw(Resident outlaw)
    • addOutlaw

      public void addOutlaw(Resident resident) throws AlreadyRegisteredException
      Throws:
      AlreadyRegisteredException
    • addOutlawCheck

      public void addOutlawCheck(Resident resident) throws AlreadyRegisteredException
      Throws:
      AlreadyRegisteredException
    • removeOutlaw

      public void removeOutlaw(Resident resident)
    • loadOutlaws

      public void loadOutlaws(List<Resident> outlaws)
    • hasValidUUID

      public boolean hasValidUUID()
    • setOutpostSpawns

      public void setOutpostSpawns(List<org.bukkit.Location> outpostSpawns)
    • isAlliedWith

      public boolean isAlliedWith(Town othertown)
    • getOutpostLimit

      public int getOutpostLimit()
    • isOverOutpostLimit

      public boolean isOverOutpostLimit()
    • isOverClaimed

      public boolean isOverClaimed()
    • availableTownBlocks

      public int availableTownBlocks()
      Only use this if TownySettings.getTownBlockRatio() is greater than -1.
      Returns:
      the number of TownBlocks a town is able to claim.
    • addMetaData

      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

      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.
    • setConquered

      public void setConquered(boolean conquered)
    • setConquered

      public void setConquered(boolean conquered, boolean callEvent)
    • isConquered

      public boolean isConquered()
    • setConqueredDays

      public void setConqueredDays(int conqueredDays)
    • getConqueredDays

      public int getConqueredDays()
    • addJail

      public void addJail(Jail jail)
    • removeJail

      public void removeJail(Jail jail)
    • hasJails

      public boolean hasJails()
    • hasJail

      public boolean hasJail(Jail jail)
    • getJails

      @Nullable public @Nullable Collection<Jail> getJails()
    • getJail

      @Nullable public @Nullable Jail getJail(int i)
    • setPrimaryJail

      public void setPrimaryJail(Jail jail)
    • getPrimaryJail

      @Nullable public @Nullable Jail getPrimaryJail()
    • getJailedPlayerCount

      public int getJailedPlayerCount()
      Returns:
      the number of jailed residents in the town.
    • getJailedResidents

      public List<Resident> getJailedResidents()
      Returns:
      an unmodifiable List of Residents which are jailed in the town.
    • renamePlotGroup

      public void renamePlotGroup(String oldName, PlotGroup group)
    • addPlotGroup

      public void addPlotGroup(PlotGroup group)
    • removePlotGroup

      public void removePlotGroup(PlotGroup plotGroup)
    • getPlotGroups

      public Collection<PlotGroup> getPlotGroups()
    • hasPlotGroups

      public boolean hasPlotGroups()
    • hasPlotGroupName

      public boolean hasPlotGroupName(String name)
    • getPlotObjectGroupFromName

      @Nullable public @Nullable PlotGroup getPlotObjectGroupFromName(String name)
    • getBankCap

      public double getBankCap()
      Description copied from interface: BankEconomyHandler
      Gets the max amount of money that can be in the bank.
      Specified by:
      getBankCap in interface BankEconomyHandler
      Returns:
      The max amount of money.
    • getWorld

      public org.bukkit.World getWorld()
      Description copied from class: Government
      Gets the world in which this object resides.
      Specified by:
      getWorld in class Government
      Returns:
      The World this object is in.
    • getBankAccountPrefix

      public String getBankAccountPrefix()
      Description copied from interface: BankEconomyHandler
      The prefix to be used for the bank account.
      Specified by:
      getBankAccountPrefix in interface BankEconomyHandler
      Returns:
      A string providing the prefix.
    • getFormattedName

      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.
    • getPrefix

      public String getPrefix()
    • getPostfix

      public String getPostfix()
    • getMaxPercentTaxAmount

      public double getMaxPercentTaxAmount()
    • setMaxPercentTaxAmount

      public void setMaxPercentTaxAmount(double maxPercentTaxAmount)
    • isBankrupt

      public boolean isBankrupt()
      Whether a town is bankrupted.
      Returns:
      true if bankrupt.
    • getDebtBalance

      public double getDebtBalance()
      Returns:
      the amount of debt held by the Town.
    • setDebtBalance

      public void setDebtBalance(double balance)
      Parameters:
      balance - the amount to set the debtBalance of the town to.
    • isRuined

      public boolean isRuined()
    • setRuined

      public void setRuined(boolean b)
    • setRuinedTime

      public void setRuinedTime(long time)
    • getRuinedTime

      public long getRuinedTime()
    • getMapColorHexCode

      @Nullable public @Nullable String getMapColorHexCode()
      Used by Dynmap-Towny to get the town's *local* map-colour.
      Overrides:
      getMapColorHexCode in class Government
      Returns:
      String value of hex code or null.
    • getNationMapColorHexCode

      @Nullable public @Nullable String getNationMapColorHexCode()
      Used by Dynmap-Towny to get the town's *national* map colour.
      Returns:
      String value of hex code or null.
    • save

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

      public void saveTownBlocks()
    • getNationZoneOverride

      public int getNationZoneOverride()
    • setNationZoneOverride

      public void setNationZoneOverride(int size)
    • hasNationZoneOverride

      public boolean hasNationZoneOverride()
    • getJoinedNationAt

      public long getJoinedNationAt()
    • setJoinedNationAt

      public void setJoinedNationAt(long joinedNationAt)
    • getMovedHomeBlockAt

      public long getMovedHomeBlockAt()
    • setMovedHomeBlockAt

      public void setMovedHomeBlockAt(long movedHomeBlockAt)
    • getTrustedResidents

      public Set<Resident> getTrustedResidents()
    • hasTrustedResident

      public boolean hasTrustedResident(Resident resident)
    • addTrustedResident

      public void addTrustedResident(Resident resident)
    • removeTrustedResident

      public void removeTrustedResident(Resident resident)
    • getNationZoneSize

      public int getNationZoneSize()
      Specified by:
      getNationZoneSize in class Government
    • loadAllies

      public void loadAllies(List<Town> towns)
      Only to be used when loading the database.
      Parameters:
      towns - List<Town> which will be loaded in as allies.
    • addAlly

      public void addAlly(Town town)
    • removeAlly

      public void removeAlly(Town town)
    • removeAllAllies

      public boolean removeAllAllies()
    • hasAlly

      public boolean hasAlly(Town town)
    • hasMutualAlly

      public boolean hasMutualAlly(Town town)
    • loadTrustedTowns

      public void loadTrustedTowns(List<Town> towns)
      Only to be used when loading the database.
      Parameters:
      towns - List<Town> which will be loaded in as trusted towns.
    • addTrustedTown

      public void addTrustedTown(Town town)
    • removeTrustedTown

      public void removeTrustedTown(Town town)
    • removeAllTrustedTowns

      public boolean removeAllTrustedTowns()
    • hasTrustedTown

      public boolean hasTrustedTown(Town town)
    • loadEnemies

      public void loadEnemies(List<Town> towns)
      Only to be used when loading the database.
      Parameters:
      towns - List<Town> which will be loaded in as enemies.
    • addEnemy

      public void addEnemy(Town town)
    • removeEnemy

      public void removeEnemy(Town town)
    • removeAllEnemies

      public boolean removeAllEnemies()
    • hasEnemy

      public boolean hasEnemy(Town town)
    • getEnemies

      public List<Town> getEnemies()
    • getAllies

      public List<Town> getAllies()
    • getTrustedTowns

      public List<Town> getTrustedTowns()
    • getMutualAllies

      public List<Town> getMutualAllies()
    • getAlliesUUIDs

      public List<UUID> getAlliesUUIDs()
    • getEnemiesUUIDs

      public List<UUID> getEnemiesUUIDs()
    • getTrustedTownsUUIDS

      public List<UUID> getTrustedTownsUUIDS()
    • isNationZoneEnabled

      public boolean isNationZoneEnabled()
    • setNationZoneEnabled

      public void setNationZoneEnabled(boolean nationZoneEnabled)
    • isInsideTown

      public boolean isInsideTown(@NotNull @NotNull org.bukkit.Location location)
      Tests whether a location is inside this town's boundaries
      Parameters:
      location - The location
      Returns:
      Whether the location is inside this town.
    • isInsideTown

      public boolean isInsideTown(@NotNull @NotNull Position position)
      Tests whether a position is inside this town's boundaries
      Parameters:
      position - The position
      Returns:
      Whether the position is inside this town.
    • isNeutral

      public boolean isNeutral()
      Is the Town Neutral or Peaceful? Tests against a config option that prevents a capital city from being neutral.
      Overrides:
      isNeutral in class Government
      Returns:
      true if the object is Neutral or Peaceful.
      Since:
      0.96.5.4
    • getTownLevel

      public TownySettings.TownLevel getTownLevel()
    • getLevelNumber

      public int getLevelNumber()
      Get the Town's current TownLevel number, based on its population.

      Note that Town Levels are not hard-coded. They can be defined by the server administrator, and may be different from the default configuration. If you need a Town's level, use getTownLevel(). Due to Town Levels being configurable by administrators, caution is advised when relying on this method. See TownyResources or SiegeWar for example usages.
      e.g. ruins = 0 hamlet = 1 village = 2

      Returns:
      Current TownLevel number.
    • getLevel

      @Deprecated public int getLevel()
      Deprecated.
      since 0.99.6.3 use getLevelNumber() instead. Get the Town's current level, based on its population.

      Note that Town Levels are not hard-coded. They can be defined by the server administrator, and may be different from the default configuration.

      Returns:
      Current Town Level.
    • getLevel

      @Deprecated public int getLevel(int populationSize)
      Deprecated.
      since 0.99.6.3 use TownySettings.getTownLevelFromGivenInt(int, Town) instead. Get the town level for a given population size.

      Great for debugging, or just to see what the town level is for a given amount of residents. But for most cases you'll want to use getLevel(), which uses the town's current population.
      Note that Town Levels are not hard-coded. They can be defined by the server administrator, and may be different from the default configuration.

      Parameters:
      populationSize - Number of residents used to calculate the level.
      Returns:
      The calculated Town Level. 0, if the town is ruined, or the method otherwise fails through.
    • getMaxLevel

      @Deprecated public int getMaxLevel()
      Deprecated.
      since 0.99.6.3 use TownySettings.getTownLevelMax() instead. Get the maximum level a Town may achieve.
      Returns:
      Size of TownySettings' configTownLevel SortedMap.
    • getLevelID

      @Deprecated public int getLevelID()
      Deprecated.
      since 0.99.6.3 use getLevelNumber() instead. Returns the Town Level ID.
      Returns:
      id
    • getManualTownLevel

      public int getManualTownLevel()
      Returns:
      the manualTownLevel
    • setManualTownLevel

      public void setManualTownLevel(int manualTownLevel)
      Parameters:
      manualTownLevel - the manualTownLevel to set
    • getTownBlockTypeLimit

      public int getTownBlockTypeLimit(TownBlockType type)
      Parameters:
      type - The townblock type to get the limit for.
      Returns:
      The townblock type limit, or -1 if no limit is configured.
    • audiences

      @NotNull public @NotNull Iterable<? extends net.kyori.adventure.audience.Audience> audiences()
      Specified by:
      audiences in interface net.kyori.adventure.audience.ForwardingAudience
    • 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 class TownyObject
      Returns:
      true if this TownyObject exists.
    • isVisibleOnTopLists

      public boolean isVisibleOnTopLists()
    • setVisibleOnTopLists

      public void setVisibleOnTopLists(boolean visibleOnTopLists)
    • playerBroadCastMessageToTown

      public void playerBroadCastMessageToTown(org.bukkit.entity.Player player, String message)
    • checkTownHasEnoughResidentsForNationRequirements

      public void checkTownHasEnoughResidentsForNationRequirements()
    • hasEnoughResidentsToJoinANation

      public boolean hasEnoughResidentsToJoinANation()
    • hasEnoughResidentsToBeANationCapital

      public boolean hasEnoughResidentsToBeANationCapital()
    • isAllowedThisAmountOfResidents

      public boolean isAllowedThisAmountOfResidents(int residentCount, boolean isCapital)
      Is this town allowed to have the given number of residents?
      Parameters:
      residentCount - Number of residents to test with.
      isCapital - When false, a capital city will be tested as though it were not a non-Capital city.
      Returns:
      true if the town can support the number of residents based on the rules configured on the server.
    • getMaxAllowedNumberOfResidentsWithoutNation

      public int getMaxAllowedNumberOfResidentsWithoutNation()