Class Government
java.lang.Object
com.palmergames.bukkit.towny.object.TownyObject
com.palmergames.bukkit.towny.object.Government
- All Implemented Interfaces:
InviteReceiver,InviteSender,BankEconomyHandler,EconomyHandler,Identifiable,Inviteable,Nameable,ResidentList,Savable,SpawnLocation,SpawnPosition,net.kyori.adventure.audience.Audience,net.kyori.adventure.audience.ForwardingAudience,net.kyori.adventure.pointer.Pointered
public abstract class Government
extends TownyObject
implements BankEconomyHandler, ResidentList, Inviteable, Identifiable, SpawnLocation, SpawnPosition, net.kyori.adventure.audience.ForwardingAudience
A class which represents the structure of objects that
occupy areas or interactive managed sub-objects.
- Author:
- Suneet Tipirneni (Siris)
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.kyori.adventure.audience.ForwardingAudience
net.kyori.adventure.audience.ForwardingAudience.Single -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voiddeleteReceivedInvite(Invite invite) Removes an invite from the received collection.final voiddeleteSentInvite(Invite invite) Removes an outgoing invite.final voiddepositToBank(Resident resident, int amount) Puts money into the bank.voidgenerateBankHistoryBook(org.bukkit.entity.Player player, int desiredPages) Opens a book gui of bank transactions for the player to browse.Gets the bank account associated with this objectgetBoard()Gets the board of the government.@Nullable ColorGets the map color of a government if it has one.abstract intGets the collection of invites received.final longGets the date when this was registered.Gets the collection of outgoing invites.final doubleGets the cost of spawning to this location.final StringgetTag()Gets the concise string representation of this object.doublegetTaxes()Gets the taxes as a percentage or as a flat number.abstract Collection<TownBlock> getUUID()abstract org.bukkit.WorldgetWorld()Gets the world in which this object resides.booleanfinal booleanhasTag()Whether or not this object has a tag.booleanIs the object Neutral or Peaceful?final booleanisOpen()Indicates if any resident can join without an invitation or not.final booleanisPublic()Whether the spawn is visitable by non-members, and also whether the homeblock coordinates are visible.final voidnewReceivedInvite(Invite invite) Adds an invite to the received collection.final voidnewSentInvite(Invite invite) Adds an outgoing invite.voidsetActiveWar(boolean active) final voidSets the board of the government.voidsetMapColorHexCode(String mapColorHexCode) final voidsetNeutral(boolean neutral) Sets the neutrality/peacefulness of the object.final voidsetOpen(boolean isOpen) Sets this to be open to any resident joining without an invitation or not.final voidsetPublic(boolean isPublic) Sets the spawn to be visitable by non-member players, also sets whether the homeblock coordinates are visible.final voidsetRegistered(long registered) Sets the date when this was registered.final voidsetSpawnCost(double spawnCost) Sets the cost of spawning to this location.final voidSets the concise string representation of this object.abstract voidsetTaxes(double taxes) Sets the tax amount of this object.voidThis should only be used by internal loading methods!final voidwithdrawFromBank(Resident resident, int amount) Takes money from the bank.Methods inherited from class com.palmergames.bukkit.towny.object.TownyObject
addMetaData, addMetaData, exists, getMetadata, getMetadata, getMetadata, getName, getTreeDepth, getTreeString, hasMeta, hasMeta, hasMeta, removeMetaData, removeMetaData, removeMetaData, removeMetaData, setName, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, 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 com.palmergames.bukkit.towny.object.economy.BankEconomyHandler
getBankAccountPrefix, getBankCapMethods inherited from interface net.kyori.adventure.audience.ForwardingAudience
audiences, clearResourcePacks, clearTitle, closeDialog, 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 com.palmergames.bukkit.towny.object.Nameable
getFormattedName, getNameMethods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFromMethods inherited from interface com.palmergames.bukkit.towny.object.ResidentList
getOutlaws, getResidents, hasResidentMethods inherited from interface com.palmergames.bukkit.towny.object.SpawnLocation
getSpawn, getSpawnOrNull, hasSpawn, setSpawnMethods inherited from interface com.palmergames.bukkit.towny.object.SpawnPosition
spawnPosition, spawnPosition
-
Field Details
-
uuid
-
account
-
spawn
-
tag
-
board
-
isNeutral
protected boolean isNeutral -
taxes
protected double taxes -
mapColorHexCode
-
-
Constructor Details
-
Government
-
-
Method Details
-
getReceivedInvites
Description copied from interface:InviteReceiverGets the collection of invites received.- Specified by:
getReceivedInvitesin interfaceInviteReceiver- Returns:
- An unmodifiable collection of received invites.
-
newReceivedInvite
Description copied from interface:InviteReceiverAdds an invite to the received collection.- Specified by:
newReceivedInvitein interfaceInviteReceiver- Parameters:
invite- The invite to add.- Throws:
TooManyInvitesException- When the invite cap is reached.
-
deleteReceivedInvite
Description copied from interface:InviteReceiverRemoves an invite from the received collection.- Specified by:
deleteReceivedInvitein interfaceInviteReceiver- Parameters:
invite- The invite to remove.
-
getSentInvites
Description copied from interface:InviteSenderGets the collection of outgoing invites.- Specified by:
getSentInvitesin interfaceInviteSender- Returns:
- The outgoing invites.
-
newSentInvite
Description copied from interface:InviteSenderAdds an outgoing invite.- Specified by:
newSentInvitein interfaceInviteSender- Parameters:
invite- The outgoing invite to add.- Throws:
TooManyInvitesException- When the outgoing invite limit has been reached.
-
deleteSentInvite
Description copied from interface:InviteSenderRemoves an outgoing invite.- Specified by:
deleteSentInvitein interfaceInviteSender- Parameters:
invite- The invite to remove from the outgoing collection.
-
setBoard
Sets the board of the government.- Parameters:
board- A string for the new board.
-
getBoard
Gets the board of the government.- Returns:
- A string representing the board.
-
setPublic
public final void setPublic(boolean isPublic) Sets the spawn to be visitable by non-member players, also sets whether the homeblock coordinates are visible.- Parameters:
isPublic- false for not hidden, true otherwise.
-
isPublic
public final boolean isPublic()Whether the spawn is visitable by non-members, and also whether the homeblock coordinates are visible.- Returns:
- false for not hidden, true otherwise.
-
setOpen
public final void setOpen(boolean isOpen) Sets this to be open to any resident joining without an invitation or not.- Parameters:
isOpen- true for invitation-less joining, false otherwise.
-
isOpen
public final boolean isOpen()Indicates if any resident can join without an invitation or not.- Returns:
- true for invitation-less joining, false otherwise.
-
setNeutral
public final void setNeutral(boolean neutral) Sets the neutrality/peacefulness of the object.- Parameters:
neutral- whether the object will be neutral or peaceful.- Since:
- 0.96.5.4
-
isNeutral
public boolean isNeutral()Is the object Neutral or Peaceful?- Returns:
- true if the object is Neutral or Peaceful.
- Since:
- 0.96.5.4
-
setRegistered
public final void setRegistered(long registered) Sets the date when this was registered.- Parameters:
registered- A long of unix time when this was registered.
-
getRegistered
public final long getRegistered()Gets the date when this was registered.- Returns:
- A long of unix time when this was registered.
-
setSpawnCost
public final void setSpawnCost(double spawnCost) Sets the cost of spawning to this location.- Parameters:
spawnCost- The cost to spawn.
-
getSpawnCost
public final double getSpawnCost()Gets the cost of spawning to this location.- Returns:
- The cost to spawn.
-
setTag
Sets the concise string representation of this object.- Parameters:
text- An upper-cased four or less letter string.
-
getTag
Gets the concise string representation of this object.- Returns:
- An upper-cased four or less letter string, representing the tag.
-
hasTag
public final boolean hasTag()Whether or not this object has a tag.- Returns:
- true if present, false otherwise.
-
withdrawFromBank
Takes money from the bank.- Parameters:
resident- The resident to give the money to.amount- The amount to give.- Throws:
TownyException- On general error.
-
depositToBank
Puts money into the bank.- Parameters:
resident- The resident to take money from.amount- The amount to take.- Throws:
TownyException- On general error.
-
getAccount
Description copied from interface:BankEconomyHandlerGets the bank account associated with this object- Specified by:
getAccountin interfaceBankEconomyHandler- Specified by:
getAccountin interfaceEconomyHandler- Returns:
- The BankAccount of this object.
-
setTaxes
public abstract void setTaxes(double taxes) Sets the tax amount of this object.- Parameters:
taxes- The taxes as a percentage or flat number.
-
getTaxes
public double getTaxes()Gets the taxes as a percentage or as a flat number.- Returns:
- The tax number.
-
getWorld
public abstract org.bukkit.World getWorld()Gets the world in which this object resides.- Returns:
- The
Worldthis object is in.
-
getUUID
- Specified by:
getUUIDin interfaceIdentifiable
-
setUUID
Description copied from interface:IdentifiableThis should only be used by internal loading methods!- Specified by:
setUUIDin interfaceIdentifiable- Parameters:
uuid- the UUID to set.
-
getMapColorHexCode
-
getMapColor
Gets the map color of a government if it has one.- Returns:
- The
Colorthis object is in.
-
setMapColorHexCode
-
getTownBlocks
-
hasActiveWar
public boolean hasActiveWar() -
setActiveWar
public void setActiveWar(boolean active) -
getNationZoneSize
public abstract int getNationZoneSize() -
generateBankHistoryBook
public void generateBankHistoryBook(org.bukkit.entity.Player player, int desiredPages) Opens a book gui of bank transactions for the player to browse.- Parameters:
player- Player who will get a book GUI opened.desiredPages- The number of pages requested.
-