Package org.kingdoms.constants.group
Class Kingdom
- All Implemented Interfaces:
org.kingdoms.abstraction.GroupOperator,KingdomOperator,org.kingdoms.abstraction.Levellable,org.kingdoms.abstraction.NamespacedFlagsContainer,NationOperator,Keyed<UUID>,SmartObject,org.kingdoms.constants.group.model.logs.Loggable,org.kingdoms.constants.themes.ThemeContainer,org.kingdoms.locale.provider.CascadingMessageContextProvider,org.kingdoms.locale.provider.MessageContextProvider
-
Field Summary
Fields inherited from class org.kingdoms.constants.group.Group
attributes, bank, book, colors, flags, home, id, level, members, name, nexus, owner, ranks, relations, relationshipRequests, resourcePoints, shield, since, tag, taxesFields inherited from class org.kingdoms.constants.base.KingdomsObject
lastLogsExpirationCheck, logs, metadata, statisticsFields inherited from class org.kingdoms.constants.base.CompressedSmartObject
objectState -
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 org.kingdoms.constants.namespace.NamespacedMap<Integer> miscUpgrades, @NonNull org.kingdoms.constants.namespace.NamespacedMap<Integer> powerups, @NonNull org.kingdoms.constants.namespace.NamespacedMap<Integer> championUpgrades, @NonNull Set<SimpleChunkLocation> lands, @NonNull RankMap ranks, @NonNull Map<UUID, KingdomRelation> relations, @NonNull Set<UUID> members, @Nullable String lore, @NonNull String championType, @Nullable UUID king, @Nullable UUID nation, @NonNull String name, @Nullable String tag, int level, @Nullable org.kingdoms.constants.namespace.NamespacedMap<org.kingdoms.utils.compilers.expressions.MathExpression> taxes, @Nullable SimpleLocation nexus, org.kingdoms.server.location.Location home, @NonNull Map<String, BookChapter> book, Map<Integer, org.bukkit.inventory.ItemStack> nexusChest, @Nullable GroupBanner flag, GroupBanner banner, org.kingdoms.constants.namespace.NamespacedMap<Color> colors, org.kingdoms.constants.economy.Balance resourcePoints, int maxLandsModifier, org.kingdoms.constants.economy.Balance bank, org.kingdoms.constants.namespace.NamespacedFlags flags, org.kingdoms.constants.stats.Statistics stats, long lastInvasion, long since, org.kingdoms.constants.group.Shield shield, @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) 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 org.kingdoms.constants.namespace.NamespacedMap<Integer> protected org.kingdoms.data.handlers.abstraction.DataHandler<Kingdom> Used for serialization of the smart object into a compressed state to determineCompressedSmartObject.shouldSave()@Nullable GroupgetGroup()@NonNull Map<KingdomPlayer, Invasion> All lands that this kingdom is invading.@NonNull Map<String, InviteCode> @Nullable 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()longintgetLevel()This option is affected by forced levels config option if it's enabled (e.g.@Nullable StringgetLore()intNote, in some servers different worlds have different max claims.intgetMaxClaims(String world) intint@NonNull org.kingdoms.constants.namespace.NamespacedMap<Integer> @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 org.kingdoms.constants.namespace.NamespacedMap<Integer> @NonNull Map<UUID, KingdomRelation> @NonNull KingdomRelationgetRelationWith(@Nullable Kingdom kingdom) doublegetTax(@NonNull org.bukkit.OfflinePlayer player) longgetUpgradeCost(@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) booleanbooleanbooleanisStrongerThan(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(org.kingdoms.server.location.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 org.kingdoms.constants.namespace.NamespacedMap<Integer> championUpgrades) @NonNull KingdomSetHomeEventsetHome(org.kingdoms.server.location.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 org.kingdoms.constants.namespace.NamespacedMap<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(org.kingdoms.constants.namespace.NamespacedMap<Integer> powerups) voidsetPrivate(boolean privatee) 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) @Bookmark(UNSAFE) @NonNull String@Bookmark(UNSAFE) @NonNull Set<SimpleChunkLocation> voidvoidupdateRankNode(@NonNull String node, @NonNull String newNode) Methods inherited from class org.kingdoms.constants.group.Group
abstractPlaceOrMoveNexus, addMessageContextEdits, changeLevel, countRelationships, equals, getAttributes, getBank, getBankruptcy, getBanner, getBook, getColors, getFlag, getFlags, getHome, getId, getKey, getMailIds, getMails, getMembers, getName, getNexus, getOwnerId, getRanks, getRawLevel, getReceivedMails, getRelationshipRequests, getResourcePoints, getSentMails, getShield, getSince, getTag, getTax, getTaxes, getThemes, hasAttribute, hashCode, hasOwner, isFull, isHidden, isHomePublic, isMember, isPermanent, renameTag, requiresInvite, sendMail, sendMail, setAttributes, setBanner, setBook, setColor, setFlag, setFlags, setHidden, setLevel, setName, setNexus, setPermanent, setPublicHome, setRanks, setRelations, setRelationshipRequests, setRelationShipWith, setRequiresInvite, setSince, setTag, setTax, unsafeGetMembers, unsafeGetRelationsMethods inherited from class org.kingdoms.constants.base.KingdomsObject
getLogs, getMetadata, getNewestLog, getNewestLog, getStatistics, log, setLogs, setMetadata, setStatisticsMethods inherited from class org.kingdoms.constants.base.CompressedSmartObject
ensureValidObject, getCompressedData, hasObjectExpired, invalidateObject, isNewData, isObjectStateSaved, saveObjectState, shouldSaveMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.kingdoms.locale.provider.CascadingMessageContextProvider
getMessageContextMethods inherited from interface org.kingdoms.constants.base.SmartObject
isDataEmpty
-
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 org.kingdoms.constants.namespace.NamespacedMap<Integer> miscUpgrades, @NonNull org.kingdoms.constants.namespace.NamespacedMap<Integer> powerups, @NonNull org.kingdoms.constants.namespace.NamespacedMap<Integer> championUpgrades, @NonNull Set<SimpleChunkLocation> lands, @NonNull RankMap ranks, @NonNull Map<UUID, KingdomRelation> relations, @NonNull Set<UUID> members, @Nullable String lore, @NonNull String championType, @Nullable UUID king, @Nullable UUID nation, @NonNull String name, @Nullable String tag, int level, @Nullable org.kingdoms.constants.namespace.NamespacedMap<org.kingdoms.utils.compilers.expressions.MathExpression> taxes, @Nullable SimpleLocation nexus, org.kingdoms.server.location.Location home, @NonNull Map<String, BookChapter> book, Map<Integer, org.bukkit.inventory.ItemStack> nexusChest, @Nullable GroupBanner flag, GroupBanner banner, org.kingdoms.constants.namespace.NamespacedMap<Color> colors, org.kingdoms.constants.economy.Balance resourcePoints, int maxLandsModifier, org.kingdoms.constants.economy.Balance bank, org.kingdoms.constants.namespace.NamespacedFlags flags, org.kingdoms.constants.stats.Statistics stats, long lastInvasion, long since, org.kingdoms.constants.group.Shield shield, @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(org.kingdoms.server.location.Location toLocation, @Nullable KingdomPlayer kp) - Specified by:
placeOrMoveNexusin classGroup
-
getMaxClaims
public int getMaxClaims()Note, in some servers different worlds have different max claims. This will return the value for worlds that are not special (by default) and all have the same value for the same kingdom.- See Also:
-
getMaxClaims
-
updateChest
public void updateChest() -
isMember
-
isMember
public boolean isMember(@NonNull org.bukkit.OfflinePlayer player) -
isClaimed
-
getKingdomsWithRelation
-
getInviteCodes
-
setInviteCodes
-
getLevel
public int getLevel()Description copied from class:GroupThis option is affected by forced levels config option if it's enabled (e.g.KingdomsConfig.GROUP_LEVELS_KINGDOMS_FORCE) The raw level is accessed fromGroup.getRawLevel()but you shouldn't need to use that method in almost all cases. -
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
-
getOnlineMembers
- Specified by:
getOnlineMembersin classGroup
-
getPlayerMembers
- Specified by:
getPlayerMembersin classGroup
-
getKingdomPlayers
- Specified by:
getKingdomPlayersin classGroup
-
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
@Internal @Bookmark(UNSAFE) public @Bookmark(UNSAFE) @NonNull Set<SimpleChunkLocation> unsafeGetLandLocations() -
rename
-
getRelationWith
-
disband
-
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
-
toString
-
isUnderAttack
public boolean isUnderAttack() -
setHome
public @NonNull KingdomSetHomeEvent setHome(org.kingdoms.server.location.Location home, @Nullable KingdomPlayer player) -
getLore
-
setLore
-
isPacifist
public boolean isPacifist() -
isPrivate
public boolean isPrivate() -
setPrivate
public void setPrivate(boolean privatee) -
setPacifist
-
setPacifist
public KingdomPacifismStateChangeEvent setPacifist(boolean pacifist, KingdomPlayer by, org.kingdoms.events.KingdomsEventCallerContext<KingdomPacifismStateChangeEvent> callerContext) -
getMiscUpgrades
-
setMiscUpgrades
public void setMiscUpgrades(@NonNull org.kingdoms.constants.namespace.NamespacedMap<Integer> miscUpgrades) -
getPowerups
-
setPowerups
-
getChampionUpgrades
-
setChampionUpgrades
public void setChampionUpgrades(@NonNull org.kingdoms.constants.namespace.NamespacedMap<Integer> championUpgrades) -
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) -
getNationId
-
getNation
- Specified by:
getNationin interfaceNationOperator
-
setNation
-
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
-
unsafeGetChampionType
-
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- Overrides:
getGroupin classGroup
-
getDataHandler
Description copied from class:CompressedSmartObjectUsed for serialization of the smart object into a compressed state to determineCompressedSmartObject.shouldSave()- Overrides:
getDataHandlerin classCompressedSmartObject
-