Class Nation

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 class Nation extends Government
  • Constructor Details Link icon

    • Nation Link icon

      public Nation(String name)
  • Method Details Link icon

    • equals Link icon

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • addAlly Link icon

      public void addAlly(Nation nation)
    • removeAlly Link icon

      public boolean removeAlly(Nation nation)
    • removeAllAllies Link icon

      public boolean removeAllAllies()
    • hasAlly Link icon

      public boolean hasAlly(Nation nation)
    • hasMutualAlly Link icon

      public boolean hasMutualAlly(Nation nation)
    • addEnemy Link icon

      public void addEnemy(Nation nation)
    • removeEnemy Link icon

      public boolean removeEnemy(Nation nation)
    • removeAllEnemies Link icon

      public boolean removeAllEnemies()
    • hasEnemy Link icon

      public boolean hasEnemy(Nation nation)
    • getTowns Link icon

      public List<Town> getTowns()
    • isKing Link icon

      public boolean isKing(Resident resident)
    • hasCapital Link icon

      public boolean hasCapital()
    • hasAssistant Link icon

      public boolean hasAssistant(Resident resident)
    • isCapital Link icon

      public boolean isCapital(Town town)
    • hasTown Link icon

      public boolean hasTown(String name)
    • hasTown Link icon

      public boolean hasTown(Town town)
    • addTown Link icon

      public void addTown(Town town)
    • forceSetCapital Link icon

      public void forceSetCapital(Town capital) throws EmptyNationException
      Only to be called from the loading methods.
      Parameters:
      capital - - Town to make capital.
      Throws:
      EmptyNationException - Thrown when no capital can be set.
    • setCapital Link icon

      public void setCapital(Town capital)
    • getCapital Link icon

      public Town getCapital()
    • findNewCapital Link icon

      public boolean findNewCapital()
      Finds the town in the nation with the most residents and makes it the capital.
      Returns:
      whether it successfully set a capital.
    • getSpawn Link icon

      @NotNull public @NotNull org.bukkit.Location getSpawn() throws TownyException
      Description copied from interface: SpawnLocation
      Get the spawn location of this object.
      Returns:
      The spawn location
      Throws:
      TownyException - If no location is found.
    • spawnPosition Link icon

      @Nullable public @Nullable Position spawnPosition()
      Description copied from interface: SpawnPosition
      Gets the spawn location of this object.
      Returns:
      The spawn location or null if none has been set.
    • setSpawn Link icon

      public void setSpawn(@Nullable @Nullable org.bukkit.Location spawn)
      Description copied from interface: SpawnLocation
      Sets the spawn point of this object.
      Parameters:
      spawn - The Location of the new spawn.
    • spawnPosition Link icon

      public void spawnPosition(@Nullable @Nullable Position spawn)
      Description copied from interface: SpawnPosition
      Sets the spawn position of this object.
      Parameters:
      spawn - The position of the new spawn.
    • getAssistants Link icon

      public List<Resident> getAssistants()
    • setEnemies Link icon

      public void setEnemies(List<Nation> enemies)
    • getEnemies Link icon

      public List<Nation> getEnemies()
    • setAllies Link icon

      public void setAllies(List<Nation> allies)
    • getAllies Link icon

      public List<Nation> getAllies()
    • hasReachedMaximumAllies Link icon

      public boolean hasReachedMaximumAllies()
    • getMutualAllies Link icon

      public List<Nation> getMutualAllies()
    • getNumTowns Link icon

      public int getNumTowns()
    • getNumResidents Link icon

      public int getNumResidents()
    • canAddResidents Link icon

      public boolean canAddResidents(int additionalResidents)
    • hasReachedMaxResidents Link icon

      public boolean hasReachedMaxResidents()
    • hasReachedMaxTowns Link icon

      public boolean hasReachedMaxTowns()
    • removeTown Link icon

      protected void removeTown(Town town) throws EmptyNationException
      Should only be called by Town.removeNation(); Removes town from towns list and will choose a new Capital if necessary.
      Parameters:
      town - - Town to remove from nation.
      Throws:
      EmptyNationException - - Thrown when last town is being removed.
    • setTaxes Link icon

      public void setTaxes(double taxes)
      Description copied from class: Government
      Sets the tax amount of this object.
      Specified by:
      setTaxes in class Government
      Parameters:
      taxes - The taxes as a percentage or flat number.
    • getMaxPercentTaxAmount Link icon

      public double getMaxPercentTaxAmount()
    • setMaxPercentTaxAmount Link icon

      public void setMaxPercentTaxAmount(double maxPercentTaxAmount)
    • setTaxPercentage Link icon

      public void setTaxPercentage(boolean isPercentage)
    • isTaxPercentage Link icon

      public boolean isTaxPercentage()
    • clear Link icon

      public void clear()
    • removeOutOfRangeTowns Link icon

      @Deprecated public void removeOutOfRangeTowns()
      Deprecated.
      since 0.100.0.9 use ProximityUtil.removeOutOfRangeTowns(Nation) instead.
      Method for rechecking town distances to a new nation capital/moved nation capital homeblock. Results in towns whose homeblocks are no longer close enough to the capital homeblock being removed from the nation.
    • gatherOutOfRangeTowns Link icon

      @Deprecated public List<Town> gatherOutOfRangeTowns(List<Town> towns, Town capital)
      Deprecated.
      since 0.100.0.9 use ProximityUtil.gatherOutOfRangeTowns(Nation) instead.
      A method which returns a list of Towns too far from the given capital town.
      Parameters:
      towns - - The list of towns to check.
      capital - - The Town from which to check the distance.
      Returns:
      removedTowns - A list of Towns which would be removed by removeOutOfRangeTowns().
    • setKing Link icon

      public void setKing(Resident king) throws TownyException
      Throws:
      TownyException
    • hasResident Link icon

      public boolean hasResident(Resident resident)
    • collect Link icon

      public void collect(double amount)
    • getResidents Link icon

      public List<Resident> getResidents()
      Description copied from interface: ResidentList
      Returns an unmodifiable list of residents.
      Returns:
      The list of residents in this object.
    • getTreeString Link icon

      public List<String> getTreeString(int depth)
      Overrides:
      getTreeString in class TownyObject
    • hasResident Link icon

      public boolean hasResident(String name)
      Description copied from interface: ResidentList
      Whether a given object contains a resident.
      Parameters:
      name - The name of the resident.
      Returns:
      true if found, false otherwise.
    • getOutlaws Link icon

      public Collection<Resident> getOutlaws()
      Description copied from interface: ResidentList
      Gets the unmodifiable list of outlaws.
      Returns:
      The list of outlaws in this object.
    • hasValidUUID Link icon

      public boolean hasValidUUID()
    • newSentAllyInvite Link icon

      public void newSentAllyInvite(Invite invite) throws TooManyInvitesException
      Throws:
      TooManyInvitesException
    • deleteSentAllyInvite Link icon

      public void deleteSentAllyInvite(Invite invite)
    • getSentAllyInvites Link icon

      public List<Invite> getSentAllyInvites()
    • getTownBlocks Link icon

      public Collection<TownBlock> getTownBlocks()
      Specified by:
      getTownBlocks in class Government
    • getNumTownblocks Link icon

      public int getNumTownblocks()
    • getKing Link icon

      public Resident getKing()
    • hasKing Link icon

      public boolean hasKing()
    • getFormattedName Link icon

      public String getFormattedName()
      Description copied from interface: Nameable
      Gets the formatted name of the object.
      Returns:
      The formatted name.
    • addMetaData Link icon

      public void addMetaData(@NotNull @NotNull CustomDataField<?> md)
      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 class TownyObject
      Parameters:
      md - CustomDataField to add.
    • removeMetaData Link icon

      public void removeMetaData(@NotNull @NotNull CustomDataField<?> md)
      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 class TownyObject
      Parameters:
      md - CustomDataField to remove.
    • getWorld Link icon

      public org.bukkit.World getWorld()
      Description copied from class: Government
      Gets the world in which this object resides.
      Specified by:
      getWorld in class Government
      Returns:
      The World this object is in.
    • getBankAccountPrefix Link icon

      public String getBankAccountPrefix()
      Description copied from interface: BankEconomyHandler
      The prefix to be used for the bank account.
      Returns:
      A string providing the prefix.
    • getBankCap Link icon

      public double getBankCap()
      Description copied from interface: BankEconomyHandler
      Gets the max amount of money that can be in the bank.
      Returns:
      The max amount of money.
    • isAlliedWith Link icon

      public boolean isAlliedWith(Nation nation)
      Shows if the nation is allied with the specified nation.
      Parameters:
      nation - The nation that is allied.
      Returns:
      true if it is allied, false otherwise.
    • save Link icon

      public void save()
      Description copied from interface: Savable
      Schedules the object to be saved to the database.
    • getNationZoneSize Link icon

      public int getNationZoneSize()
      Specified by:
      getNationZoneSize in class Government
    • getNationLevel Link icon

      public TownySettings.NationLevel getNationLevel()
      Get the Nation's current NationLevel.

      Note that Nation Levels are not hard-coded. They can be defined by the server administrator, and may be different from the default configuration.

      Returns:
      NationLevel of the nation.
    • getLevelNumber Link icon

      public int getLevelNumber()
      Get the Nation's current Nation Level number, ie: 1 to TownySettings.getNationLevelMax(). This is used as a key to determine which NationLevel a Nation receives, and ultimately which attributes that Nation will receive.

      Note that Nation Levels are not hard-coded. They can be defined by the server administrator, and may be different from the default configuration.

      Returns:
      Nation Level (int) for current population or amount of towns.
    • audiences Link icon

      @NotNull public @NotNull Iterable<? extends net.kyori.adventure.audience.Audience> audiences()
    • getConqueredTax Link icon

      public double getConqueredTax()
    • setConqueredTax Link icon

      public void setConqueredTax(double conqueredTax)
    • exists Link icon

      @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 class TownyObject
      Returns:
      true if this TownyObject exists.
    • playerBroadCastMessageToNation Link icon

      public void playerBroadCastMessageToNation(org.bukkit.entity.Player player, String message)
    • getSanctionedTowns Link icon

      public List<Town> getSanctionedTowns()
    • hasSanctionedTown Link icon

      public boolean hasSanctionedTown(Town town)
    • addSanctionedTown Link icon

      public void addSanctionedTown(Town town)
    • removeSanctionedTown Link icon

      public void removeSanctionedTown(Town town)
    • getSanctionedTownsForSaving Link icon

      public List<String> getSanctionedTownsForSaving()
    • loadSanctionedTowns Link icon

      public void loadSanctionedTowns(String[] tokens)