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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
deleteReceivedInvite
(Invite invite) Removes an invite from the received collection.final void
deleteSentInvite
(Invite invite) Removes an outgoing invite.final void
depositToBank
(Resident resident, int amount) Puts money into the bank.void
generateBankHistoryBook
(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 Color
Gets the map color of a government if it has one.abstract int
Gets the collection of invites received.final long
Gets the date when this was registered.Gets the collection of outgoing invites.final double
Gets the cost of spawning to this location.final String
getTag()
Gets the concise string representation of this object.double
getTaxes()
Gets the taxes as a percentage or as a flat number.abstract Collection
<TownBlock> getUUID()
abstract org.bukkit.World
getWorld()
Gets the world in which this object resides.boolean
final boolean
hasTag()
Whether or not this object has a tag.boolean
Is the object Neutral or Peaceful?final boolean
isOpen()
Indicates if any resident can join without an invitation or not.final boolean
isPublic()
Whether the spawn is visitable by non-members, and also whether the homeblock coordinates are visible.final void
newReceivedInvite
(Invite invite) Adds an invite to the received collection.final void
newSentInvite
(Invite invite) Adds an outgoing invite.void
setActiveWar
(boolean active) final void
Sets the board of the government.void
setMapColorHexCode
(String mapColorHexCode) final void
setNeutral
(boolean neutral) Sets the neutrality/peacefulness of the object.final void
setOpen
(boolean isOpen) Sets this to be open to any resident joining without an invitation or not.final void
setPublic
(boolean isPublic) Sets the spawn to be visitable by non-member players, also sets whether the homeblock coordinates are visible.final void
setRegistered
(long registered) Sets the date when this was registered.final void
setSpawnCost
(double spawnCost) Sets the cost of spawning to this location.final void
Sets the concise string representation of this object.abstract void
setTaxes
(double taxes) Sets the tax amount of this object.void
This should only be used by internal loading methods!final void
withdrawFromBank
(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, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, 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 com.palmergames.bukkit.towny.object.economy.BankEconomyHandler
getBankAccountPrefix, getBankCap
Methods inherited from interface net.kyori.adventure.audience.ForwardingAudience
audiences, 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 com.palmergames.bukkit.towny.object.Nameable
getFormattedName, getName
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom
Methods inherited from interface com.palmergames.bukkit.towny.object.ResidentList
getOutlaws, getResidents, hasResident
Methods inherited from interface com.palmergames.bukkit.towny.object.SpawnLocation
getSpawn, getSpawnOrNull, hasSpawn, setSpawn
Methods 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:InviteReceiver
Gets the collection of invites received.- Specified by:
getReceivedInvites
in interfaceInviteReceiver
- Returns:
- An unmodifiable collection of received invites.
-
newReceivedInvite
Description copied from interface:InviteReceiver
Adds an invite to the received collection.- Specified by:
newReceivedInvite
in interfaceInviteReceiver
- Parameters:
invite
- The invite to add.- Throws:
TooManyInvitesException
- When the invite cap is reached.
-
deleteReceivedInvite
Description copied from interface:InviteReceiver
Removes an invite from the received collection.- Specified by:
deleteReceivedInvite
in interfaceInviteReceiver
- Parameters:
invite
- The invite to remove.
-
getSentInvites
Description copied from interface:InviteSender
Gets the collection of outgoing invites.- Specified by:
getSentInvites
in interfaceInviteSender
- Returns:
- The outgoing invites.
-
newSentInvite
Description copied from interface:InviteSender
Adds an outgoing invite.- Specified by:
newSentInvite
in interfaceInviteSender
- Parameters:
invite
- The outgoing invite to add.- Throws:
TooManyInvitesException
- When the outgoing invite limit has been reached.
-
deleteSentInvite
Description copied from interface:InviteSender
Removes an outgoing invite.- Specified by:
deleteSentInvite
in 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:BankEconomyHandler
Gets the bank account associated with this object- Specified by:
getAccount
in interfaceBankEconomyHandler
- Specified by:
getAccount
in 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
World
this object is in.
-
getUUID
- Specified by:
getUUID
in interfaceIdentifiable
-
setUUID
Description copied from interface:Identifiable
This should only be used by internal loading methods!- Specified by:
setUUID
in interfaceIdentifiable
- Parameters:
uuid
- the UUID to set.
-
getMapColorHexCode
-
getMapColor
Gets the map color of a government if it has one.- Returns:
- The
Color
this 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.
-