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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddBonusBlocks(int bonusBlocks) voidaddDistrict(District district) voidvoidvoidaddMetaData(@NotNull CustomDataField<?> md) Add a specific metadata to this TownyObject.voidvoidaddOutlawCheck(Resident resident) voidaddOutpostSpawn(Position position) Add or update an outpost spawn for a town.voidaddOutpostSpawn(org.bukkit.Location location) voidaddPlotGroup(PlotGroup group) voidaddPurchasedBlocks(int purchasedBlocks) voidaddResidentCheck(Resident resident) voidaddTownBlock(TownBlock townBlock) Adds a townblock to the list of existing townblocks.voidaddTrustedResident(Resident resident) voidaddTrustedTown(Town town) @NotNull Iterable<? extends net.kyori.adventure.audience.Audience> intOnly use this if TownySettings.getTownBlockRatio() is greater than -1.voidvoidcollect(double amount) booleanbooleanexists()An internal method used to determine if an object exists in the TownyUniverse's maps.voidBegins search for new mayor.voidforceAddOutpostSpawn(Position position) Only to be called from the Loading methods.voidforceSetHomeBlock(TownBlock homeBlock) Only to be called from the Loading methods.voidforceSetMayor(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.doubleGets the max amount of money that can be in the bank.doubledoublegetBonusBlockCostN(int n) intdoubledoubleintdouble@Nullable DistrictgetDistrictFromName(String name) doubledoubleGets the formatted name of the object.final doubleGet town sale price.@Nullable TownBlockFetch the World this town homeblock is registered too.@Nullable JailgetJail(int i) int@Nullable Collection<Jail> getJails()longintGet the Town's current TownLevel number, based on its population.int@Nullable StringUsed by Dynmap-Towny to get the town's *local* map-colour.intintdoubleintgetMayor()long@Nullable StringUsed by Dynmap-Towny to get the town's *national* map colour.@Nullable NationSafe to use as long ashasNation()has returned true.intintintintGets the unmodifiable list of outlaws.intorg.bukkit.LocationgetOutpostSpawn(Integer index) Return the Location for this Outpost index.Gets the permissions of the object.@Nullable PlotGroupdoubledoubledouble@Nullable JailintReturns an unmodifiable list of residents.long@NotNull org.bukkit.LocationgetSpawn()Get the spawn location of this object.@Nullable org.bukkit.LocationgetTownBlock(WorldCoord worldCoord) doubledoublegetTownBlockCostN(int inputN) Gets the unmodifiable collection of townblocks.intgetTreeString(int depth) org.bukkit.WorldgetWorld()Gets the world in which this object resides.booleanbooleanhasDistrictName(String name) booleanbooleanbooleanbooleaninthashCode()booleanbooleanbooleanhasJails()booleanhasMayor()booleanhasMobs()booleanhasMutualAlly(Town town) booleanbooleanbooleanbooleanbooleanbooleanhasPlotGroupName(String name) booleanbooleanhasResident(Resident resident) booleanhasResident(String name) Whether a given object contains a resident.booleanhasResident(UUID uuid) booleanhasResident(org.bukkit.entity.Player player) booleanhasResidentWithRank(Resident resident, String rank) booleanhasTownBlock(TownBlock townBlock) Checks whether object has townblock or not.booleanhasTownBlock(WorldCoord worldCoord) booleanhasTrustedResident(Resident resident) booleanhasTrustedTown(Town town) booleanbooleanbooleanbooleanhasWorld()booleanbooleanbooleanbooleanisAlliedWith(Town othertown) booleanisAllowedThisAmountOfResidents(int residentCount, boolean isCapital) Is this town allowed to have the given number of residents?booleanbooleanWhether a town is bankrupted.booleanbooleanbooleanbooleanisFire()final booleanWhether the town is for sale.booleanisHomeBlock(TownBlock townBlock) booleanisInsideTown(@NotNull Position position) Tests whether a position is inside this town's boundariesbooleanisInsideTown(@NotNull org.bukkit.Location location) Tests whether a location is inside this town's boundariesbooleanbooleanbooleanIs the Town Neutral or Peaceful?booleanbooleanbooleanisPVP()booleanisRuined()booleanbooleanvoidloadAllies(List<Town> towns) Only to be used when loading the database.voidloadEnemies(List<Town> towns) Only to be used when loading the database.voidloadOutlaws(List<Resident> outlaws) voidloadTrustedTowns(List<Town> towns) Only to be used when loading the database.voidplayerBroadCastMessageToTown(org.bukkit.entity.Player player, String message) voidplayerSetsHomeBlock(TownBlock townBlock, org.bukkit.Location location, org.bukkit.entity.Player player) booleanbooleanbooleanvoidremoveAlly(Town town) voidremoveDistrict(District district) voidremoveEnemy(Town town) voidremoveJail(Jail jail) voidremoveMetaData(@NotNull CustomDataField<?> md) Remove a specific metadata from the TownyObject.voidvoidremoveOutlaw(Resident resident) voidremoveOutpostSpawn(Coord coord) voidremoveOutpostSpawn(org.bukkit.Location loc) voidremovePlotGroup(PlotGroup plotGroup) voidremoveResident(Resident resident) voidremoveTownBlock(TownBlock townBlock) Removes townblock from the list of existing townblocks.voidremoveTrustedResident(Resident resident) voidremoveTrustedTown(Town town) voidrenameDistrict(String oldName, District district) voidrenamePlotGroup(String oldName, PlotGroup group) voidsave()Schedules the object to be saved to the database.voidvoidsetAdminDisabledPVP(boolean isPVPDisabled) voidsetAdminEnabledMobs(boolean isMobsForced) voidsetAdminEnabledPVP(boolean isPVPEnabled) voidsetAllowedToWar(boolean allowedToWar) voidsetBonusBlocks(int bonusBlocks) voidsetCommercialPlotPrice(double commercialPlotPrice) voidsetCommercialPlotTax(double commercialTax) voidsetConquered(boolean conquered) voidsetConquered(boolean conquered, boolean callEvent) voidsetConqueredDays(int conqueredDays) voidsetDebtBalance(double balance) voidsetEmbassyPlotPrice(double embassyPlotPrice) voidsetEmbassyPlotTax(double embassyPlotTax) voidsetExplosion(boolean isExplosion) voidsetFire(boolean isFire) final voidsetForSale(boolean isForSale) Sets the town for sale.final voidsetForSalePrice(double forSalePrice) Sets town sale price.voidsetFounder(String founderName) voidsetHasMobs(boolean hasMobs) voidsetHasUnlimitedClaims(boolean hasUnlimitedClaims) voidsetHasUpkeep(boolean hasUpkeep) voidsetHomeBlock(@Nullable TownBlock homeBlock) Sets the HomeBlock of a townvoidsetJoinedNationAt(long joinedNationAt) voidsetManualTownLevel(int manualTownLevel) voidsetMaxPercentTaxAmount(double maxPercentTaxAmount) voidSets a town resident to become mayor.voidvoidsetMovedHomeBlockAt(long movedHomeBlockAt) voidvoidvoidsetNationZoneEnabled(boolean nationZoneEnabled) voidsetNationZoneOverride(int size) voidsetOutpostSpawns(List<org.bukkit.Location> outpostSpawns) voidsetPermissions(String line) The the permissions of this object.voidsetPlotPrice(double plotPrice) voidsetPlotTax(double plotTax) voidsetPrimaryJail(Jail jail) voidsetPurchasedBlocks(int purchasedBlocks) voidsetPVP(boolean isPVP) voidsetRuined(boolean b) voidsetRuinedTime(long time) voidsetSpawn(@Nullable org.bukkit.Location spawn) Sets the spawn point of this object.voidsetTaxes(double taxes) Sets the tax amount of this object.voidsetTaxPercentage(boolean isPercentage) voidsetVisibleOnTopLists(boolean visibleOnTopLists) voidsetWorld(TownyWorld world) Sets the world this town homeblock belongs to.@Nullable PositionGets the spawn location of this object.voidspawnPosition(@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, withdrawFromBankMethods 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
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, showDialog, stopSoundMethods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFromMethods 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:TownBlockOwnerGets the unmodifiable collection of townblocks.- Specified by:
getTownBlocksin interfaceTownBlockOwner- Specified by:
getTownBlocksin classGovernment- Returns:
- The townblocks this object contains.
-
getNumTownBlocks
public int getNumTownBlocks() -
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.
-
hasTownBlock
-
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.
-
getTownBlock
-
getTownBlockMap
-
getTownBlockTypeCache
- Returns:
- the plotTypeCache
-
getMayor
-
setTaxes
public void setTaxes(double taxes) Description copied from class:GovernmentSets the tax amount of this object.- Specified by:
setTaxesin 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:ResidentListReturns an unmodifiable list of residents.- Specified by:
getResidentsin interfaceResidentList- Returns:
- The list of residents in this object.
-
getRank
-
hasResident
Description copied from interface:ResidentListWhether a given object contains a resident.- Specified by:
hasResidentin interfaceResidentList- Parameters:
name- The name of the resident.- Returns:
trueif found,falseotherwise.
-
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:SpawnLocationSets the spawn point of this object.- Specified by:
setSpawnin interfaceSpawnLocation- Parameters:
spawn- The Location of the new spawn.
-
getSpawn
Description copied from interface:SpawnLocationGet the spawn location of this object.- Specified by:
getSpawnin interfaceSpawnLocation- Returns:
- The spawn location
- Throws:
TownyException- If no location is found.
-
getSpawnOrNull
@Nullable public @Nullable org.bukkit.Location getSpawnOrNull()- Specified by:
getSpawnOrNullin interfaceSpawnLocation
-
spawnPosition
Description copied from interface:SpawnPositionGets the spawn location of this object.- Specified by:
spawnPositionin interfaceSpawnPosition- Returns:
- The spawn location or
nullif none has been set.
-
spawnPosition
Description copied from interface:SpawnPositionSets the spawn position of this object.- Specified by:
spawnPositionin interfaceSpawnPosition- Parameters:
spawn- The position of the new spawn.
-
hasHomeBlock
public boolean hasHomeBlock() -
hasWorld
public boolean hasWorld() -
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.
-
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:
getTreeStringin classTownyObject
-
getOutlaws
Description copied from interface:ResidentListGets the unmodifiable list of outlaws.- Specified by:
getOutlawsin 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: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.
-
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:BankEconomyHandlerGets the max amount of money that can be in the bank.- Specified by:
getBankCapin interfaceBankEconomyHandler- Returns:
- The max amount of money.
-
getWorld
public org.bukkit.World getWorld()Description copied from class:GovernmentGets the world in which this object resides.- Specified by:
getWorldin classGovernment- Returns:
- The
Worldthis object is in.
-
getBankAccountPrefix
Description copied from interface:BankEconomyHandlerThe prefix to be used for the bank account.- Specified by:
getBankAccountPrefixin interfaceBankEconomyHandler- Returns:
- A string providing the prefix.
-
getFormattedName
Description copied from interface:NameableGets the formatted name of the object.- Specified by:
getFormattedNamein 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:
getMapColorHexCodein 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:SavableSchedules 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:
getNationZoneSizein 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:
isNeutralin 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:
audiencesin interfacenet.kyori.adventure.audience.ForwardingAudience
-
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.
-
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()
-