Package org.kingdoms.constants.group
Class Kingdom
java.lang.Object
org.kingdoms.constants.metadata.KingdomsObject<UUID>
org.kingdoms.constants.group.Group
org.kingdoms.constants.group.Kingdom
- All Implemented Interfaces:
org.kingdoms.abstraction.GroupOperator,KingdomOperator,NationOperator
-
Field Summary
Fields inherited from class org.kingdoms.constants.group.Group
attributes, bank, book, hidden, home, id, members, name, nexus, owner, permanent, publicHome, publicHomeCost, ranks, relations, relationshipRequests, requiresInvite, resourcePoints, shieldSince, shieldTime, since, tag, taxFields inherited from class org.kingdoms.constants.metadata.KingdomsObject
metadata -
Constructor Summary
ConstructorsConstructorDescriptionKingdom(@NonNull UUID id, @NonNull Map<UUID, KingdomRelationshipRequest> relationshipRequests, @NonNull Set<UUID> mails, @NonNull Map<UUID, Long> challenges, @NonNull Map<String, InviteCode> inviteCodes, @NonNull LinkedList<AuditLog> logs, @NonNull Map<org.kingdoms.constants.namespace.Namespace, Integer> miscUpgrades, @NonNull Map<Powerup, Integer> powerups, @NonNull Map<ChampionUpgrade, Integer> championUpgrades, @NonNull Set<SimpleChunkLocation> lands, @NonNull RankMap ranks, @NonNull Map<UUID, KingdomRelation> relations, @NonNull Set<UUID> members, @Nullable String lore, @NonNull String championType, boolean pacifist, @Nullable UUID king, @Nullable UUID nation, @NonNull String name, @Nullable String tag, @Nullable String tax, @Nullable SimpleLocation nexus, @Nullable org.kingdoms.server.location.ImmutableLocation home, @NonNull Map<String, BookChapter> book, Map<Integer, org.bukkit.inventory.ItemStack> nexusChest, @Nullable String flag, Color color, long resourcePoints, int maxLandsModifier, double bank, long lastInvasion, long since, boolean publicHome, boolean permanent, boolean requiresInvite, long shieldTime, long shieldSince, @NonNull Map<KingdomRelation, Set<org.kingdoms.constants.group.model.relationships.RelationAttribute>> attributes) -
Method Summary
Modifier and TypeMethodDescriptiondoublebooleanWhether any of the claims of the kingdom can be overclaimed by another kingdom.@NonNull ClaimLandEventclaim(@NonNull Set<SimpleChunkLocation> locations, @Nullable KingdomPlayer claimer, @NonNull ClaimLandEvent.Reason reason, boolean history) @NonNull ClaimLandEventclaim(@NonNull SimpleChunkLocation loc, @NonNull KingdomPlayer claimer, ClaimLandEvent.Reason reason) intcountStructures(Predicate<Structure> filter) disband(@Nullable GroupDisband.Reason reason, @Nullable Runnable predataRemoval) generateInviteCode(Duration expiration, UUID creator, int uses) 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.@NonNull String@NonNull Map<ChampionUpgrade,Integer> @NonNull String@Nullable GroupgetGroup()@NonNull Map<KingdomPlayer,Invasion> All lands that this kingdom is invading.@NonNull Map<String,InviteCode> @NonNull KingdomPlayergetKing()@NonNull KingdomForKingdomOperatorstatic @Nullable KingdomgetKingdom(@NonNull String name) static @Nullable KingdomgetKingdom(@NonNull UUID id) @NonNull List<KingdomPlayer>getKingdomsWithRelation(@NonNull KingdomRelation... relation) @Nullable UUID@Unmodifiable @NonNull Set<SimpleChunkLocation>getLands()long@Nullable StringgetLore()intintgetMaxClaims(String world) intint<T> @NonNull List<T>getMembers(@NonNull Function<@NonNull KingdomPlayer, @Nullable T> function) doublegetMight()@Nullable Nation@Nullable UUID@NonNull Map<UUID,KingdomInvite> @NonNull org.kingdoms.constants.group.KingdomsInventory@NonNull List<org.bukkit.entity.Player>@NonNull List<org.bukkit.OfflinePlayer>doublegetPower()@NonNull Map<UUID,KingdomRelation> @NonNull KingdomRelationgetRelationWith(@Nullable Kingdom kingdom) doublegetTax(@NonNull org.bukkit.OfflinePlayer player) @NonNull StringlonggetUpgradeCost(@NonNull KingdomUpgrade upgrade) intgetUpgradeLevel(@NonNull KingdomUpgrade upgrade) booleanhasAttribute(@Nullable Kingdom kingdom, org.kingdoms.constants.group.model.relationships.RelationAttribute attribute) booleanbooleanbooleanisClaimed(@NonNull SimpleChunkLocation location) booleanisInSameNationAs(@Nullable Kingdom kingdom) booleanChecks if any of the members of this kingdom is invading another kingdom.booleanisMember(@NonNull org.bukkit.OfflinePlayer player) booleanisMember(@NonNull KingdomPlayer kp) booleanbooleanisStrongerThan(Kingdom other) Applies the strength comparison formula from config.ymlbooleanjoinNation(@NonNull Nation nation, KingdomPlayer player) leaveNation(LeaveReason reason) payTaxes(@NonNull org.bukkit.OfflinePlayer player) placeOrMoveNexus(@NonNull org.bukkit.Location toLocation, @Nullable KingdomPlayer kp) rename(@NonNull String name, @Nullable KingdomPlayer renamer) @NonNull org.kingdoms.events.general.GroupRelationshipRequestEventsendRelationshipRequest(@Nullable KingdomPlayer sender, @NonNull Kingdom kingdom, @NonNull KingdomRelation relation) @NonNull org.kingdoms.events.general.GroupRelationshipRequestEventsendRelationshipRequest(@Nullable KingdomPlayer sender, @NonNull Kingdom kingdom, @NonNull KingdomRelation relation, long acceptTime) voidsetChallenges(Map<UUID, Long> challenges) voidsetChampionType(@NonNull String championType) voidsetChampionUpgrades(@NonNull Map<ChampionUpgrade, Integer> championUpgrades) @NonNull KingdomSetHomeEventsetHome(@Nullable org.bukkit.Location home, @Nullable KingdomPlayer player) voidsetInviteCodes(@NonNull Map<String, InviteCode> inviteCodes) setKing(@NonNull KingdomPlayer newKing, @Nullable KingdomKingChangeEvent.Reason reason) voidsetLastInvasion(long lastInvasion) setLore(@Nullable String lore, KingdomPlayer by) voidsetMaxLandsModifier(int maxLandsModifier) voidsetMiscUpgrades(@NonNull Map<org.kingdoms.constants.namespace.Namespace, Integer> miscUpgrades) voidvoidsetNationInvites(@NonNull Map<UUID, KingdomInvite> nationInvites) voidsetNexusChest(@NonNull org.kingdoms.constants.group.KingdomsInventory nexusChest) setPacifist(boolean pacifist) setPacifist(boolean pacifist, KingdomPlayer by, org.kingdoms.events.KingdomsEventCallerContext<KingdomPacifismStateChangeEvent> callerContext) voidsetPowerups(Map<Powerup, Integer> powerups) voidsetUpgradeLevel(@NonNull KingdomUpgrade upgrade, int newLevel) @NonNull org.bukkit.entity.CreaturespawnChampion(@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".toString()@NonNull UnclaimLandEventunclaim(@NonNull Set<SimpleChunkLocation> lands, @Nullable KingdomPlayer by, @NonNull UnclaimLandEvent.Reason reason, boolean history) unclaimIf(@Nullable KingdomPlayer by, UnclaimLandEvent.Reason reason, @Nullable Predicate<Land> filter) @NonNull Set<SimpleChunkLocation>voidvoidupdateRankNode(@NonNull String node, @NonNull String newNode) Methods inherited from class org.kingdoms.constants.group.Group
abstractPlaceOrMoveNexus, activateShield, activateShield, addBank, addResourcePoints, addToResourcePoints, countRelationships, deactivateShield, disband, equals, getAttributes, getBank, getBook, getColor, getDataKey, getFlag, getHome, getId, getLogs, getMailIds, getMails, getMembers, getName, getNewestLog, getNexus, getOwnerId, getPublicHomeCost, getRanks, getReceivedMails, getRelationshipRequests, getResourcePoints, getSentMails, getShieldSince, getShieldTime, getShieldTimeLeft, getSince, getTag, getTax, getTopComparator, hasAttribute, hashCode, hasMoney, hasResourcePoints, hasShield, isFull, isHidden, isHomePublic, isMember, isPermanent, log, renameTag, requiresInvite, sendMail, sendMail, setAttributes, setBank, setBook, setColor, setFlag, setHidden, setName, setNexus, setPermanent, setPublicHome, setPublicHomeCost, setRanks, setRelations, setRelationshipRequests, setRelationShipWith, setRequiresInvite, setResourcePoints, setShieldSince, setShieldTime, setSince, setTag, setTax, unsafeGetMembers, unsafeGetRelationsMethods inherited from class org.kingdoms.constants.metadata.KingdomsObject
compressBoolean, compressCollecton, compressCollecton, compressColor, compressInventory, compressLocation, compressLocation, compressMap, compressMetadata, compressString, compressUUID, getMetadata, getSaveMeta, setMetadata, setSaveMeta, shouldSave
-
Constructor Details
-
Kingdom
public Kingdom(@NonNull UUID id, @NonNull Map<UUID, KingdomRelationshipRequest> relationshipRequests, @NonNull Set<UUID> mails, @NonNull Map<UUID, Long> challenges, @NonNull Map<String, InviteCode> inviteCodes, @NonNull LinkedList<AuditLog> logs, @NonNull Map<org.kingdoms.constants.namespace.Namespace, Integer> miscUpgrades, @NonNull Map<Powerup, Integer> powerups, @NonNull Map<ChampionUpgrade, Integer> championUpgrades, @NonNull Set<SimpleChunkLocation> lands, @NonNull RankMap ranks, @NonNull Map<UUID, KingdomRelation> relations, @NonNull Set<UUID> members, @Nullable String lore, @NonNull String championType, boolean pacifist, @Nullable UUID king, @Nullable UUID nation, @NonNull String name, @Nullable String tag, @Nullable String tax, @Nullable SimpleLocation nexus, @Nullable org.kingdoms.server.location.ImmutableLocation home, @NonNull Map<String, BookChapter> book, Map<Integer, org.bukkit.inventory.ItemStack> nexusChest, @Nullable String flag, Color color, long resourcePoints, int maxLandsModifier, double bank, long lastInvasion, long since, boolean publicHome, boolean permanent, boolean requiresInvite, long shieldTime, long shieldSince, @NonNull Map<KingdomRelation, Set<org.kingdoms.constants.group.model.relationships.RelationAttribute>> attributes) -
Kingdom
-
-
Method Details
-
generateInviteCode
-
getKingdom
-
getKingdom
-
hasNation
public boolean hasNation() -
getMaxMembers
public int getMaxMembers()- Specified by:
getMaxMembersin classGroup
-
placeOrMoveNexus
public NexusMoveEvent placeOrMoveNexus(@NonNull org.bukkit.Location toLocation, @Nullable KingdomPlayer kp) - Specified by:
placeOrMoveNexusin classGroup
-
getMaxClaims
public int getMaxClaims() -
getMaxClaims
-
updateChest
public void updateChest() -
isMember
-
isMember
public boolean isMember(@NonNull org.bukkit.OfflinePlayer player) -
isClaimed
-
getKingdomsWithRelation
-
getInviteCodes
-
setInviteCodes
-
countStructures
-
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
-
getKingdomPlayers
- Specified by:
getKingdomPlayersin classGroup
-
getMembers
public <T> @NonNull List<T> getMembers(@NonNull Function<@NonNull KingdomPlayer, @Nullable T> function) -
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
- Overrides:
getRelationsin classGroup
-
unclaimIf
@Nonnull public UnclaimLandEvent unclaimIf(@Nullable KingdomPlayer by, UnclaimLandEvent.Reason reason, @Nullable Predicate<Land> filter) -
getLandLocations
-
unsafeGetLandLocations
-
getOnlineMembers
- Specified by:
getOnlineMembersin classGroup
-
getPlayerMembers
- Specified by:
getPlayerMembersin classGroup
-
rename
-
getRelationWith
-
disband
public KingdomDisbandEvent disband(@Nullable GroupDisband.Reason reason, @Nullable Runnable predataRemoval) -
hasAttribute
public boolean hasAttribute(@Nullable Kingdom kingdom, org.kingdoms.constants.group.model.relationships.RelationAttribute attribute) -
getKing
-
setKing
public KingdomKingChangeEvent setKing(@NonNull KingdomPlayer newKing, @Nullable KingdomKingChangeEvent.Reason reason) -
getLandsUnderAttack
-
isBeingInvaded
public boolean isBeingInvaded() -
updateRankNode
- Specified by:
updateRankNodein classGroup
-
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
-
getCompressedData
- Overrides:
getCompressedDatain classGroup
-
toString
-
isUnderAttack
public boolean isUnderAttack() -
setHome
public @NonNull KingdomSetHomeEvent setHome(@Nullable org.bukkit.Location home, @Nullable KingdomPlayer player) -
getLore
-
setLore
-
isPacifist
public boolean isPacifist() -
setPacifist
-
setPacifist
public KingdomPacifismStateChangeEvent setPacifist(boolean pacifist, KingdomPlayer by, org.kingdoms.events.KingdomsEventCallerContext<KingdomPacifismStateChangeEvent> callerContext) -
getMiscUpgrades
-
setMiscUpgrades
-
getPowerups
-
setPowerups
-
getChampionUpgrades
-
setChampionUpgrades
-
getUpgradeLevel
- Returns:
- a negative number if the upgrade is disabled by the kingdom.
-
getUpgradeCost
-
setUpgradeLevel
-
isStrongerThan
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
-
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() -
getNationId
-
getNation
- Specified by:
getNationin interfaceNationOperator
-
setNation
-
getTaxOrDefault
- Specified by:
getTaxOrDefaultin classGroup
-
calculateTax
public double calculateTax()- Specified by:
calculateTaxin classGroup
-
getTax
public double getTax(@NonNull org.bukkit.OfflinePlayer player) -
payTaxes
-
isInSameNationAs
-
joinNation
-
getNationInvites
-
setNationInvites
-
getMaxLandsModifier
public int getMaxLandsModifier() -
setMaxLandsModifier
public void setMaxLandsModifier(int maxLandsModifier) -
getChampionType
-
setChampionType
-
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
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 theLogKingdomChallengerlogs 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
- See Also:
-
getKingdom
ForKingdomOperator- Specified by:
getKingdomin interfaceKingdomOperator
-
getGroup
- Specified by:
getGroupin interfaceorg.kingdoms.abstraction.GroupOperator- Specified by:
getGroupin interfaceKingdomOperator- Specified by:
getGroupin interfaceNationOperator
-