Class Kingdom

All Implemented Interfaces:
org.kingdoms.abstraction.GroupOperator, KingdomOperator, NationOperator

@NonExtendable public class Kingdom extends Group implements KingdomOperator, NationOperator
  • Constructor Details

  • Method Details

    • generateInviteCode

      public InviteCode generateInviteCode(Duration expiration, UUID creator, int uses)
    • getKingdom

      public static @Nullable Kingdom getKingdom(@NonNull String name)
    • getKingdom

      public static @Nullable Kingdom getKingdom(@NonNull UUID id)
    • hasNation

      public boolean hasNation()
    • getMaxMembers

      public int getMaxMembers()
      Specified by:
      getMaxMembers in class Group
    • placeOrMoveNexus

      public NexusMoveEvent placeOrMoveNexus(@NonNull org.bukkit.Location toLocation, @Nullable KingdomPlayer kp)
      Specified by:
      placeOrMoveNexus in class Group
    • getMaxClaims

      public int getMaxClaims()
    • getMaxClaims

      public int getMaxClaims(String world)
    • updateChest

      public void updateChest()
    • isMember

      public boolean isMember(@NonNull KingdomPlayer kp)
    • isMember

      public boolean isMember(@NonNull org.bukkit.OfflinePlayer player)
    • isClaimed

      public boolean isClaimed(@NonNull SimpleChunkLocation location)
    • getKingdomsWithRelation

      public List<Kingdom> getKingdomsWithRelation(@NonNull KingdomRelation... relation)
    • getInviteCodes

      public @NonNull Map<String,InviteCode> getInviteCodes()
    • setInviteCodes

      public void setInviteCodes(@NonNull Map<String,InviteCode> inviteCodes)
    • countStructures

      public int countStructures(Predicate<Structure> filter)
    • getAllStructures

      public List<Structure> getAllStructures()
    • sendRelationshipRequest

      public @NonNull org.kingdoms.events.general.GroupRelationshipRequestEvent sendRelationshipRequest(@Nullable KingdomPlayer sender, @NonNull Kingdom kingdom, @NonNull KingdomRelation relation, long acceptTime)
    • sendRelationshipRequest

      public @NonNull org.kingdoms.events.general.GroupRelationshipRequestEvent sendRelationshipRequest(@Nullable KingdomPlayer sender, @NonNull Kingdom kingdom, @NonNull KingdomRelation relation)
    • getKingId

      public @Nullable UUID getKingId()
    • getKingdomPlayers

      public @NonNull List<KingdomPlayer> getKingdomPlayers()
      Specified by:
      getKingdomPlayers in class Group
    • getMembers

      public <T> @NonNull List<T> getMembers(@NonNull Function<@NonNull KingdomPlayer,@Nullable T> function)
    • getLands

      public @NonNull List<Land> getLands()
    • claim

      public @NonNull ClaimLandEvent claim(@NonNull SimpleChunkLocation loc, @NonNull KingdomPlayer claimer, ClaimLandEvent.Reason reason)
    • claim

      public @NonNull ClaimLandEvent claim(@NonNull Set<SimpleChunkLocation> locations, @Nullable KingdomPlayer claimer, @NonNull ClaimLandEvent.Reason reason, boolean history)
    • unclaim

      public @NonNull UnclaimLandEvent unclaim(@NonNull Set<SimpleChunkLocation> lands, @Nullable KingdomPlayer by, @NonNull UnclaimLandEvent.Reason reason, boolean history)
    • getRelations

      public @NonNull Map<UUID,KingdomRelation> getRelations()
      Overrides:
      getRelations in class Group
    • unclaimIf

      @Nonnull public UnclaimLandEvent unclaimIf(@Nullable KingdomPlayer by, UnclaimLandEvent.Reason reason, @Nullable Predicate<Land> filter)
    • getLandLocations

      public @Unmodifiable @NonNull Set<SimpleChunkLocation> getLandLocations()
    • unsafeGetLandLocations

      @Internal public @NonNull Set<SimpleChunkLocation> unsafeGetLandLocations()
    • getOnlineMembers

      public @NonNull List<org.bukkit.entity.Player> getOnlineMembers()
      Specified by:
      getOnlineMembers in class Group
    • getPlayerMembers

      public @NonNull List<org.bukkit.OfflinePlayer> getPlayerMembers()
      Specified by:
      getPlayerMembers in class Group
    • rename

      public GroupRenameEvent rename(@NonNull String name, @Nullable KingdomPlayer renamer)
      Specified by:
      rename in class Group
    • getRelationWith

      public @NonNull KingdomRelation getRelationWith(@Nullable Kingdom kingdom)
    • disband

      public KingdomDisbandEvent disband(@Nullable GroupDisband.Reason reason, @Nullable Runnable predataRemoval)
      Specified by:
      disband in class Group
    • hasAttribute

      public boolean hasAttribute(@Nullable Kingdom kingdom, org.kingdoms.constants.group.model.relationships.RelationAttribute attribute)
    • getKing

      public @NonNull KingdomPlayer getKing()
    • setKing

      public KingdomKingChangeEvent setKing(@NonNull KingdomPlayer newKing, @Nullable KingdomKingChangeEvent.Reason reason)
    • getLandsUnderAttack

      public @NonNull List<Land> getLandsUnderAttack()
    • isBeingInvaded

      public boolean isBeingInvaded()
    • updateRankNode

      public void updateRankNode(@NonNull String node, @NonNull String newNode)
      Specified by:
      updateRankNode in class Group
    • getInvasions

      public @NonNull Map<KingdomPlayer,Invasion> getInvasions()
      All lands that this kingdom is invading. Not the lands that are under attack.
      See Also:
    • isInvading

      public boolean isInvading()
      Checks if any of the members of this kingdom is invading another kingdom.
    • leaveNation

      public NationLeaveEvent leaveNation(LeaveReason reason)
    • getCompressedData

      public @NonNull String getCompressedData()
      Overrides:
      getCompressedData in class Group
    • toString

      public String toString()
      Overrides:
      toString in class Group
    • isUnderAttack

      public boolean isUnderAttack()
    • setHome

      public @NonNull KingdomSetHomeEvent setHome(@Nullable org.bukkit.Location home, @Nullable KingdomPlayer player)
      Specified by:
      setHome in class Group
      Returns:
      a cancelled event if the current home and the new home aren't different (in which case the event doesn't get called at all)
    • getLore

      public @Nullable String getLore()
    • setLore

      public KingdomLoreChangeEvent setLore(@Nullable String lore, KingdomPlayer by)
    • isPacifist

      public boolean isPacifist()
    • setPacifist

      public KingdomPacifismStateChangeEvent setPacifist(boolean pacifist)
    • setPacifist

      public KingdomPacifismStateChangeEvent setPacifist(boolean pacifist, KingdomPlayer by, org.kingdoms.events.KingdomsEventCallerContext<KingdomPacifismStateChangeEvent> callerContext)
    • getMiscUpgrades

      public @NonNull Map<org.kingdoms.constants.namespace.Namespace,Integer> getMiscUpgrades()
    • setMiscUpgrades

      public void setMiscUpgrades(@NonNull Map<org.kingdoms.constants.namespace.Namespace,Integer> miscUpgrades)
    • getPowerups

      public @NonNull Map<Powerup,Integer> getPowerups()
    • setPowerups

      public void setPowerups(Map<Powerup,Integer> powerups)
    • getChampionUpgrades

      public @NonNull Map<ChampionUpgrade,Integer> getChampionUpgrades()
    • setChampionUpgrades

      public void setChampionUpgrades(@NonNull Map<ChampionUpgrade,Integer> championUpgrades)
    • getUpgradeLevel

      public int getUpgradeLevel(@NonNull KingdomUpgrade upgrade)
      Returns:
      a negative number if the upgrade is disabled by the kingdom.
    • getUpgradeCost

      public long getUpgradeCost(@NonNull KingdomUpgrade upgrade)
    • setUpgradeLevel

      public void setUpgradeLevel(@NonNull KingdomUpgrade upgrade, int newLevel)
    • isStrongerThan

      public boolean isStrongerThan(Kingdom other)
      Applies the strength comparison formula from config.yml
      Returns:
      false if strength comparison is disabled or this kingdom isn't stronger than the specified kingdom, otherwise true.
    • findChampionSection

      public ConfigAccessor findChampionSection()
    • spawnChampion

      public @NonNull org.bukkit.entity.Creature spawnChampion(@NonNull org.bukkit.Location location)
      This method is not protected against mob conversions, illager patrols and other general protections that treats mobs as "kingdom mobs".
    • getNexusChest

      public @NonNull org.kingdoms.constants.group.KingdomsInventory getNexusChest()
    • setNexusChest

      public void setNexusChest(@NonNull org.kingdoms.constants.group.KingdomsInventory nexusChest)
    • getLastInvasion

      public long getLastInvasion()
    • setLastInvasion

      public void setLastInvasion(long lastInvasion)
    • getMight

      public double getMight()
      Specified by:
      getMight in class Group
    • getNationId

      public @Nullable UUID getNationId()
    • getNation

      public @Nullable Nation getNation()
      Specified by:
      getNation in interface NationOperator
    • setNation

      public void setNation(@Nullable UUID nation)
    • getTaxOrDefault

      public @NonNull String getTaxOrDefault()
      Specified by:
      getTaxOrDefault in class Group
    • calculateTax

      public double calculateTax()
      Specified by:
      calculateTax in class Group
    • getTax

      public double getTax(@NonNull org.bukkit.OfflinePlayer player)
    • payTaxes

      public @NonNull Pair<Boolean,Double> payTaxes(@NonNull org.bukkit.OfflinePlayer player)
    • isInSameNationAs

      public boolean isInSameNationAs(@Nullable Kingdom kingdom)
    • joinNation

      public NationJoinEvent joinNation(@NonNull Nation nation, KingdomPlayer player)
    • getNationInvites

      public @NonNull Map<UUID,KingdomInvite> getNationInvites()
    • setNationInvites

      public void setNationInvites(@NonNull Map<UUID,KingdomInvite> nationInvites)
    • getMaxLandsModifier

      public int getMaxLandsModifier()
    • setMaxLandsModifier

      public void setMaxLandsModifier(int maxLandsModifier)
    • getChampionType

      public @NonNull String getChampionType()
    • setChampionType

      public void setChampionType(@NonNull String championType)
    • getPower

      public double getPower()
    • canBeOverclaimed

      public boolean canBeOverclaimed()
      Whether any of the claims of the kingdom can be overclaimed by another kingdom.
      See Also:
    • getChallenges

      public Map<UUID,Long> getChallenges()
      The returned map keys represents the kingdoms that have challenged this kingdom and the values are the starting time of the challenges from epoch in milliseconds. There is no easy way to get the kingdoms that this kingdom has challenged unless the LogKingdomChallenger logs are checked.

      No expired challenges are present in this map. This map can be modified and the changes will be reflected accordingly.

      See Also:
    • setChallenges

      public void setChallenges(Map<UUID,Long> challenges)
      See Also:
    • getKingdom

      public @NonNull Kingdom getKingdom()
      Specified by:
      getKingdom in interface KingdomOperator
    • getGroup

      @Nullable public @Nullable Group getGroup()
      Specified by:
      getGroup in interface org.kingdoms.abstraction.GroupOperator
      Specified by:
      getGroup in interface KingdomOperator
      Specified by:
      getGroup in interface NationOperator