Class Town
java.lang.Object
com.palmergames.bukkit.towny.object.TownyObject
com.palmergames.bukkit.towny.object.Government
com.palmergames.bukkit.towny.object.Town
- 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
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.kyori.adventure.audience.ForwardingAudience
net.kyori.adventure.audience.ForwardingAudience.Single
-
Field Summary
Fields inherited from class com.palmergames.bukkit.towny.object.Government
account, board, isNeutral, mapColorHexCode, spawn, tag, taxes, uuid
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addBonusBlocks
(int bonusBlocks) void
addDistrict
(District district) void
void
void
addMetaData
(@NotNull CustomDataField<?> md) Add a specific metadata to this TownyObject.void
void
addOutlawCheck
(Resident resident) void
addOutpostSpawn
(Position position) Add or update an outpost spawn for a town.void
addOutpostSpawn
(org.bukkit.Location location) void
addPlotGroup
(PlotGroup group) void
addPurchasedBlocks
(int purchasedBlocks) void
addResidentCheck
(Resident resident) void
addTownBlock
(TownBlock townBlock) Adds a townblock to the list of existing townblocks.void
addTrustedResident
(Resident resident) void
addTrustedTown
(Town town) @NotNull Iterable
<? extends net.kyori.adventure.audience.Audience> int
Only use this if TownySettings.getTownBlockRatio() is greater than -1.void
void
collect
(double amount) boolean
boolean
exists()
An internal method used to determine if an object exists in the TownyUniverse's maps.void
Begins search for new mayor.void
forceAddOutpostSpawn
(Position position) Only to be called from the Loading methods.void
forceSetHomeBlock
(TownBlock homeBlock) Only to be called from the Loading methods.void
forceSetMayor
(Resident mayor) Sets a resident to become mayor.List
<org.bukkit.Location> Get an unmodifiable List of all outpost spawns.The prefix to be used for the bank account.double
Gets the max amount of money that can be in the bank.double
double
getBonusBlockCostN
(int n) int
double
double
int
double
@Nullable District
getDistrictFromName
(String name) double
double
Gets the formatted name of the object.final double
Get town sale price.@Nullable TownBlock
Fetch the World this town homeblock is registered too.@Nullable Jail
getJail
(int i) int
@Nullable Collection
<Jail> getJails()
long
int
Get the Town's current TownLevel number, based on its population.int
@Nullable String
Used by Dynmap-Towny to get the town's *local* map-colour.int
int
double
int
getMayor()
long
@Nullable String
Used by Dynmap-Towny to get the town's *national* map colour.@Nullable Nation
Safe to use as long ashasNation()
has returned true.int
int
int
int
Gets the unmodifiable list of outlaws.int
org.bukkit.Location
getOutpostSpawn
(Integer index) Return the Location for this Outpost index.Gets the permissions of the object.@Nullable PlotGroup
double
double
double
@Nullable Jail
int
Returns an unmodifiable list of residents.long
@NotNull org.bukkit.Location
getSpawn()
Get the spawn location of this object.@Nullable org.bukkit.Location
getTownBlock
(WorldCoord worldCoord) double
double
getTownBlockCostN
(int inputN) Gets the unmodifiable collection of townblocks.int
getTreeString
(int depth) org.bukkit.World
getWorld()
Gets the world in which this object resides.boolean
boolean
hasDistrictName
(String name) boolean
boolean
boolean
boolean
int
hashCode()
boolean
boolean
boolean
hasJails()
boolean
hasMayor()
boolean
hasMobs()
boolean
hasMutualAlly
(Town town) boolean
boolean
boolean
boolean
boolean
boolean
hasPlotGroupName
(String name) boolean
boolean
hasResident
(Resident resident) boolean
hasResident
(String name) Whether a given object contains a resident.boolean
hasResident
(UUID uuid) boolean
hasResident
(org.bukkit.entity.Player player) boolean
hasResidentWithRank
(Resident resident, String rank) boolean
hasTownBlock
(TownBlock townBlock) Checks whether object has townblock or not.boolean
hasTownBlock
(WorldCoord worldCoord) boolean
hasTrustedResident
(Resident resident) boolean
hasTrustedTown
(Town town) boolean
boolean
boolean
boolean
hasWorld()
boolean
boolean
boolean
boolean
isAlliedWith
(Town othertown) boolean
isAllowedThisAmountOfResidents
(int residentCount, boolean isCapital) Is this town allowed to have the given number of residents?boolean
boolean
Whether a town is bankrupted.boolean
boolean
boolean
boolean
isFire()
final boolean
Whether the town is for sale.boolean
isHomeBlock
(TownBlock townBlock) boolean
isInsideTown
(@NotNull Position position) Tests whether a position is inside this town's boundariesboolean
isInsideTown
(@NotNull org.bukkit.Location location) Tests whether a location is inside this town's boundariesboolean
boolean
boolean
Is the Town Neutral or Peaceful?boolean
boolean
boolean
isPVP()
boolean
isRuined()
boolean
boolean
void
loadAllies
(List<Town> towns) Only to be used when loading the database.void
loadEnemies
(List<Town> towns) Only to be used when loading the database.void
loadOutlaws
(List<Resident> outlaws) void
loadTrustedTowns
(List<Town> towns) Only to be used when loading the database.void
playerBroadCastMessageToTown
(org.bukkit.entity.Player player, String message) void
playerSetsHomeBlock
(TownBlock townBlock, org.bukkit.Location location, org.bukkit.entity.Player player) boolean
boolean
boolean
void
removeAlly
(Town town) void
removeDistrict
(District district) void
removeEnemy
(Town town) void
removeJail
(Jail jail) void
removeMetaData
(@NotNull CustomDataField<?> md) Remove a specific metadata from the TownyObject.void
void
removeOutlaw
(Resident resident) void
removeOutpostSpawn
(Coord coord) void
removeOutpostSpawn
(org.bukkit.Location loc) void
removePlotGroup
(PlotGroup plotGroup) void
removeResident
(Resident resident) void
removeTownBlock
(TownBlock townBlock) Removes townblock from the list of existing townblocks.void
removeTrustedResident
(Resident resident) void
removeTrustedTown
(Town town) void
renameDistrict
(String oldName, District district) void
renamePlotGroup
(String oldName, PlotGroup group) void
save()
Schedules the object to be saved to the database.void
void
setAdminDisabledPVP
(boolean isPVPDisabled) void
setAdminEnabledMobs
(boolean isMobsForced) void
setAdminEnabledPVP
(boolean isPVPEnabled) void
setAllowedToWar
(boolean allowedToWar) void
setBonusBlocks
(int bonusBlocks) void
setCommercialPlotPrice
(double commercialPlotPrice) void
setCommercialPlotTax
(double commercialTax) void
setConquered
(boolean conquered) void
setConquered
(boolean conquered, boolean callEvent) void
setConqueredDays
(int conqueredDays) void
setDebtBalance
(double balance) void
setEmbassyPlotPrice
(double embassyPlotPrice) void
setEmbassyPlotTax
(double embassyPlotTax) void
setExplosion
(boolean isExplosion) void
setFire
(boolean isFire) final void
setForSale
(boolean isForSale) Sets the town for sale.final void
setForSalePrice
(double forSalePrice) Sets town sale price.void
setFounder
(String founderName) void
setHasMobs
(boolean hasMobs) void
setHasUnlimitedClaims
(boolean hasUnlimitedClaims) void
setHasUpkeep
(boolean hasUpkeep) void
setHomeBlock
(@Nullable TownBlock homeBlock) Sets the HomeBlock of a townvoid
setJoinedNationAt
(long joinedNationAt) void
setManualTownLevel
(int manualTownLevel) void
setMaxPercentTaxAmount
(double maxPercentTaxAmount) void
Sets a town resident to become mayor.void
void
setMovedHomeBlockAt
(long movedHomeBlockAt) void
void
void
setNationZoneEnabled
(boolean nationZoneEnabled) void
setNationZoneOverride
(int size) void
setOutpostSpawns
(List<org.bukkit.Location> outpostSpawns) void
setPermissions
(String line) The the permissions of this object.void
setPlotPrice
(double plotPrice) void
setPlotTax
(double plotTax) void
setPrimaryJail
(Jail jail) void
setPurchasedBlocks
(int purchasedBlocks) void
setPVP
(boolean isPVP) void
setRuined
(boolean b) void
setRuinedTime
(long time) void
setSpawn
(@Nullable org.bukkit.Location spawn) Sets the spawn point of this object.void
setTaxes
(double taxes) Sets the tax amount of this object.void
setTaxPercentage
(boolean isPercentage) void
setVisibleOnTopLists
(boolean visibleOnTopLists) void
setWorld
(TownyWorld world) Sets the world this town homeblock belongs to.@Nullable Position
Gets the spawn location of this object.void
spawnPosition
(@Nullable Position spawn) Sets the spawn position of this object.Methods inherited from class com.palmergames.bukkit.towny.object.Government
deleteReceivedInvite, deleteSentInvite, depositToBank, generateBankHistoryBook, getAccount, getBoard, getMapColor, getReceivedInvites, getRegistered, getSentInvites, getSpawnCost, getTag, getTaxes, getUUID, hasActiveWar, hasTag, isOpen, isPublic, newReceivedInvite, newSentInvite, setActiveWar, setBoard, setMapColorHexCode, setNeutral, setOpen, setPublic, setRegistered, setSpawnCost, setTag, setUUID, withdrawFromBank
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
clearResourcePacks, clearTitle, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, playSound, playSound, playSound, pointers, removeResourcePacks, removeResourcePacks, resetTitle, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendResourcePacks, sendTitlePart, showBossBar, stopSound
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom
Methods inherited from interface com.palmergames.bukkit.towny.object.SpawnLocation
hasSpawn
-
Constructor Details
-
Town
-
Town
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
getTownBlocks
Description copied from interface:TownBlockOwner
Gets the unmodifiable collection of townblocks.- Specified by:
getTownBlocks
in interfaceTownBlockOwner
- Specified by:
getTownBlocks
in classGovernment
- Returns:
- The townblocks this object contains.
-
getNumTownBlocks
public int getNumTownBlocks() -
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.
-
hasTownBlock
-
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.
-
getTownBlock
-
getTownBlockMap
-
getTownBlockTypeCache
- Returns:
- the plotTypeCache
-
getMayor
-
setTaxes
public void setTaxes(double taxes) Description copied from class:Government
Sets the tax amount of this object.- Specified by:
setTaxes
in classGovernment
- Parameters:
taxes
- The taxes as a percentage or flat number.
-
forceSetMayor
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
Sets a town resident to become mayor.- Parameters:
mayor
- - Resident to become mayor.
-
setMayor
-
getFounder
-
setFounder
-
getNation
- Throws:
NotRegisteredException
-
getNationOrNull
Safe to use as long ashasNation()
has returned true.- Returns:
- Nation of the Town or null if no Nation.
-
removeNation
public void removeNation() -
setNation
- Throws:
AlreadyRegisteredException
-
setNation
- Throws:
AlreadyRegisteredException
-
getResidents
Description copied from interface:ResidentList
Returns an unmodifiable list of residents.- Specified by:
getResidents
in interfaceResidentList
- Returns:
- The list of residents in this object.
-
getRank
-
hasResident
Description copied from interface:ResidentList
Whether a given object contains a resident.- Specified by:
hasResident
in interfaceResidentList
- Parameters:
name
- The name of the resident.- Returns:
true
if found,false
otherwise.
-
hasResident
-
hasResident
public boolean hasResident(org.bukkit.entity.Player player) -
hasResident
-
hasResidentWithRank
-
addResidentCheck
- Throws:
AlreadyRegisteredException
-
isMayor
-
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
-
getMaxTownBlocks
public int getMaxTownBlocks() -
getBonusBlocks
public int getBonusBlocks() -
getBonusBlockCost
public double getBonusBlockCost() -
getTownBlockCost
public double getTownBlockCost() -
getTownBlockCostN
- Throws:
TownyException
-
getBonusBlockCostN
- 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
Sets the HomeBlock of a town- Parameters:
homeBlock
- - The TownBlock to set as the HomeBlock
-
forceSetHomeBlock
Only to be called from the Loading methods.- Parameters:
homeBlock
- - TownBlock to forcefully set as HomeBlock- Throws:
TownyException
- - General TownyException
-
getHomeBlock
- Throws:
TownyException
-
getHomeBlockOrNull
-
setWorld
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
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
- 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 interfaceSpawnLocation
- Parameters:
spawn
- The Location of the new spawn.
-
getSpawn
Description copied from interface:SpawnLocation
Get the spawn location of this object.- Specified by:
getSpawn
in interfaceSpawnLocation
- Returns:
- The spawn location
- Throws:
TownyException
- If no location is found.
-
getSpawnOrNull
@Nullable public @Nullable org.bukkit.Location getSpawnOrNull()- Specified by:
getSpawnOrNull
in interfaceSpawnLocation
-
spawnPosition
Description copied from interface:SpawnPosition
Gets the spawn location of this object.- Specified by:
spawnPosition
in interfaceSpawnPosition
- Returns:
- The spawn location or
null
if none has been set.
-
spawnPosition
Description copied from interface:SpawnPosition
Sets the spawn position of this object.- Specified by:
spawnPosition
in interfaceSpawnPosition
- Parameters:
spawn
- The position of the new spawn.
-
hasHomeBlock
public boolean hasHomeBlock() -
hasWorld
public boolean hasWorld() -
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.
-
addOutpostSpawn
public void addOutpostSpawn(org.bukkit.Location location) -
addOutpostSpawn
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
Only to be called from the Loading methods.- Parameters:
position
- Location to set Outpost's spawn point
-
getOutpostSpawn
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
Get an unmodifiable List of all outpost spawns.- Returns:
- List of outpostSpawns
-
getOutpostSpawns
- Returns:
- Similar to
getAllOutpostSpawns()
, but with positions.
-
removeOutpostSpawn
-
removeOutpostSpawn
public void removeOutpostSpawn(org.bukkit.Location loc) -
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
-
setCommercialPlotPrice
public void setCommercialPlotPrice(double commercialPlotPrice) -
getCommercialPlotPrice
public double getCommercialPlotPrice() -
setEmbassyPlotPrice
public void setEmbassyPlotPrice(double embassyPlotPrice) -
getEmbassyPlotPrice
public double getEmbassyPlotPrice() -
isHomeBlock
-
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
- Overrides:
getTreeString
in classTownyObject
-
getOutlaws
Description copied from interface:ResidentList
Gets the unmodifiable list of outlaws.- Specified by:
getOutlaws
in interfaceResidentList
- Returns:
- The list of outlaws in this object.
-
hasOutlaw
-
hasOutlaw
-
addOutlaw
- Throws:
AlreadyRegisteredException
-
addOutlawCheck
- Throws:
AlreadyRegisteredException
-
removeOutlaw
-
loadOutlaws
-
hasValidUUID
public boolean hasValidUUID() -
setOutpostSpawns
-
isAlliedWith
-
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
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.
-
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
-
removeJail
-
hasJails
public boolean hasJails() -
hasJail
-
getJails
-
getJail
-
setPrimaryJail
-
getPrimaryJail
-
getJailedPlayerCount
public int getJailedPlayerCount()- Returns:
- the number of jailed residents in the town.
-
getJailedResidents
- Returns:
- an unmodifiable List of Residents which are jailed in the town.
-
renamePlotGroup
-
addPlotGroup
-
removePlotGroup
-
getPlotGroups
-
hasPlotGroups
public boolean hasPlotGroups() -
hasPlotGroupName
-
getPlotObjectGroupFromName
-
renameDistrict
-
addDistrict
-
removeDistrict
-
getDistricts
-
hasDistricts
public boolean hasDistricts() -
hasDistrictName
-
getDistrictFromName
-
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 interfaceBankEconomyHandler
- 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 classGovernment
- Returns:
- The
World
this object is in.
-
getBankAccountPrefix
Description copied from interface:BankEconomyHandler
The prefix to be used for the bank account.- Specified by:
getBankAccountPrefix
in interfaceBankEconomyHandler
- Returns:
- A string providing the prefix.
-
getFormattedName
Description copied from interface:Nameable
Gets the formatted name of the object.- Specified by:
getFormattedName
in interfaceNameable
- Returns:
- The formatted name.
-
getPrefix
-
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
Used by Dynmap-Towny to get the town's *local* map-colour.- Overrides:
getMapColorHexCode
in classGovernment
- Returns:
- String value of hex code or null.
-
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. -
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
-
hasTrustedResident
-
addTrustedResident
-
removeTrustedResident
-
getNationZoneSize
public int getNationZoneSize()- Specified by:
getNationZoneSize
in classGovernment
-
loadAllies
Only to be used when loading the database.- Parameters:
towns
- List<Town> which will be loaded in as allies.
-
addAlly
-
removeAlly
-
removeAllAllies
public boolean removeAllAllies() -
hasAlly
-
hasMutualAlly
-
loadTrustedTowns
Only to be used when loading the database.- Parameters:
towns
- List<Town> which will be loaded in as trusted towns.
-
addTrustedTown
-
removeTrustedTown
-
removeAllTrustedTowns
public boolean removeAllTrustedTowns() -
hasTrustedTown
-
loadEnemies
Only to be used when loading the database.- Parameters:
towns
- List<Town> which will be loaded in as enemies.
-
addEnemy
-
removeEnemy
-
removeAllEnemies
public boolean removeAllEnemies() -
hasEnemy
-
getEnemies
-
getAllies
-
getTrustedTowns
-
getMutualAllies
-
getAlliesUUIDs
-
getEnemiesUUIDs
-
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
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 classGovernment
- Returns:
- true if the object is Neutral or Peaceful.
- Since:
- 0.96.5.4
-
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.
-
getManualTownLevel
public int getManualTownLevel()- Returns:
- the manualTownLevel
-
setManualTownLevel
public void setManualTownLevel(int manualTownLevel) - Parameters:
manualTownLevel
- the manualTownLevel to set
-
getTownBlockTypeLimit
- Parameters:
type
- The townblock type to get the limit for.- Returns:
- The townblock type limit, or -1 if no limit is configured.
-
audiences
- Specified by:
audiences
in interfacenet.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 classTownyObject
- Returns:
- true if this TownyObject exists.
-
isVisibleOnTopLists
public boolean isVisibleOnTopLists() -
setVisibleOnTopLists
public void setVisibleOnTopLists(boolean visibleOnTopLists) -
playerBroadCastMessageToTown
-
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()
-