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
Direct Known Subclasses:
Nation, Town

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)
  • Field Details

    • uuid

      protected UUID uuid
    • account

      protected BankAccount account
    • spawn

      protected Position spawn
    • tag

      protected String tag
    • board

      protected String board
    • isNeutral

      protected boolean isNeutral
    • taxes

      protected double taxes
    • mapColorHexCode

      protected String mapColorHexCode
  • Constructor Details

    • Government

      protected Government(String name)
  • Method Details

    • getReceivedInvites

      public final List<Invite> getReceivedInvites()
      Description copied from interface: InviteReceiver
      Gets the collection of invites received.
      Specified by:
      getReceivedInvites in interface InviteReceiver
      Returns:
      An unmodifiable collection of received invites.
    • newReceivedInvite

      public final void newReceivedInvite(Invite invite) throws TooManyInvitesException
      Description copied from interface: InviteReceiver
      Adds an invite to the received collection.
      Specified by:
      newReceivedInvite in interface InviteReceiver
      Parameters:
      invite - The invite to add.
      Throws:
      TooManyInvitesException - When the invite cap is reached.
    • deleteReceivedInvite

      public final void deleteReceivedInvite(Invite invite)
      Description copied from interface: InviteReceiver
      Removes an invite from the received collection.
      Specified by:
      deleteReceivedInvite in interface InviteReceiver
      Parameters:
      invite - The invite to remove.
    • getSentInvites

      public final List<Invite> getSentInvites()
      Description copied from interface: InviteSender
      Gets the collection of outgoing invites.
      Specified by:
      getSentInvites in interface InviteSender
      Returns:
      The outgoing invites.
    • newSentInvite

      public final void newSentInvite(Invite invite) throws TooManyInvitesException
      Description copied from interface: InviteSender
      Adds an outgoing invite.
      Specified by:
      newSentInvite in interface InviteSender
      Parameters:
      invite - The outgoing invite to add.
      Throws:
      TooManyInvitesException - When the outgoing invite limit has been reached.
    • deleteSentInvite

      public final void deleteSentInvite(Invite invite)
      Description copied from interface: InviteSender
      Removes an outgoing invite.
      Specified by:
      deleteSentInvite in interface InviteSender
      Parameters:
      invite - The invite to remove from the outgoing collection.
    • setBoard

      public final void setBoard(String board)
      Sets the board of the government.
      Parameters:
      board - A string for the new board.
    • getBoard

      public String 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

      public final void setTag(String text)
      Sets the concise string representation of this object.
      Parameters:
      text - An upper-cased four or less letter string.
    • getTag

      public final 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

      public final void withdrawFromBank(Resident resident, int amount) throws TownyException
      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

      public final void depositToBank(Resident resident, int amount) throws TownyException
      Puts money into the bank.
      Parameters:
      resident - The resident to take money from.
      amount - The amount to take.
      Throws:
      TownyException - On general error.
    • getAccount

      public BankAccount getAccount()
      Description copied from interface: BankEconomyHandler
      Gets the bank account associated with this object
      Specified by:
      getAccount in interface BankEconomyHandler
      Specified by:
      getAccount in interface EconomyHandler
      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

      public UUID getUUID()
      Specified by:
      getUUID in interface Identifiable
    • setUUID

      public void setUUID(UUID uuid)
      Description copied from interface: Identifiable
      This should only be used by internal loading methods!
      Specified by:
      setUUID in interface Identifiable
      Parameters:
      uuid - the UUID to set.
    • getMapColorHexCode

      public String getMapColorHexCode()
    • getMapColor

      @Nullable public @Nullable Color getMapColor()
      Gets the map color of a government if it has one.
      Returns:
      The Color this object is in.
    • setMapColorHexCode

      public void setMapColorHexCode(String mapColorHexCode)
    • getTownBlocks

      public abstract Collection<TownBlock> 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.