Package org.kingdoms.constants.land
Class Land
- All Implemented Interfaces:
Keyed<SimpleChunkLocation>,SmartObject,org.kingdoms.constants.group.model.logs.Loggable,org.kingdoms.locale.provider.CascadingMessageContextProvider,org.kingdoms.locale.provider.MessageContextProvider
You can find a variety of different methods in
ChunkConnections as well.-
Field Summary
Fields inherited from class org.kingdoms.constants.base.KingdomsObject
lastLogsExpirationCheck, logs, metadata, statisticsFields inherited from class org.kingdoms.constants.base.CompressedSmartObject
objectState -
Constructor Summary
ConstructorsConstructorDescriptionLand(@Nullable UUID kingdom, @NonNull SimpleChunkLocation chunk) Land(@NonNull Kingdom kingdom, @NonNull SimpleChunkLocation chunk) Land(@NonNull SimpleChunkLocation chunk) Land(@NonNull SimpleChunkLocation location, @Nullable UUID kingdom, @Nullable UUID claimedBy, long since) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInvasion(@NonNull Invasion invasion) Adds an invasion that affects this land.voidaddMessageContextEdits(@NotNull MessagePlaceholderProvider context) voidendInvasions(Invasion.Result result) boolean@Nullable UUID@Nullable KingdomPlayerprotected org.kingdoms.data.handlers.abstraction.DataHandler<Land> Used for serialization of the smart object into a compressed state to determineCompressedSmartObject.shouldSave()A list of all ongoing invasions that are affecting this land with the keys as the invader's kingdom ID.@NonNull SimpleChunkLocationgetKey()@Nullable Kingdom<T extends KeyedKingdomsObject<?>>
@Nullable TgetKingdomBlock(@NonNull org.kingdoms.server.location.BlockVector3 location, Class<T> type) Gets the desired kingdom block at the specified location.@NonNull @Unmodifiable Map<org.kingdoms.server.location.BlockVector3, KingdomBlock> Gets a list of all blocks that is considered to belong to kingdoms plugin.@Nullable UUIDstatic @Nullable LandgetLand(@NonNull org.bukkit.Chunk chunk) static @Nullable LandgetLand(@NonNull org.bukkit.Location location) static @Nullable LandgetLand(@NonNull org.bukkit.block.Block block) static @Nullable LandgetLand(@NonNull SimpleChunkLocation loc) static @Nullable LandgetLand(@NonNull SimpleLocation loc) @NonNull SimpleChunkLocationstatic @Nullable NationZonegetNationZone(SimpleChunkLocation chunk) @NonNull @Unmodifiable Map<org.kingdoms.server.location.BlockVector3, ProtectionSign> longgetSince()<T extends Structure>
TgetStructure(@NonNull Class<T> type) getStructure(@NonNull Predicate<Structure> predicate) inthashCode()booleanbooleanstatic booleanisClaimed()shorthand method for null checking.booleanChecks whether this data is absolutely empty and can be deleted from the database.booleanbooleanisKingdomBlock(@NonNull org.kingdoms.server.location.BlockVector3 location) booleanbooleanremoveInvasion(@NonNull UUID kingdom) removeInvasion(@NonNull Kingdom kingdom) voidsetClaimedBy(@Nullable UUID claimedBy) voidsetKingdom(@Nullable UUID kingdom) voidsetSince(long since) voidUseunclaim(KingdomPlayer, UnclaimLandEvent.Reason)instead.voidsilentUnclaim(boolean removeExtras) Useunclaim(KingdomPlayer, UnclaimLandEvent.Reason)instead.booleansimpleEquals(@Nullable Land land) toString()unclaim(@Nullable KingdomPlayer by, UnclaimLandEvent.Reason reason) unclaim(@Nullable KingdomPlayer by, UnclaimLandEvent.Reason reason, boolean history) @NonNull @Bookmark(UNSAFE) Map<org.kingdoms.server.location.BlockVector3, KingdomBlock> @NonNull @Bookmark(UNSAFE) Map<org.kingdoms.server.location.BlockVector3, ProtectionSign> Methods 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
getMessageContext
-
Constructor Details
-
Land
public Land(@NonNull SimpleChunkLocation location, @Nullable UUID kingdom, @Nullable UUID claimedBy, long since) -
Land
-
Land
-
Land
-
-
Method Details
-
getLand
-
getLand
-
getLand
-
isClaimed
isClaimed()shorthand method for null checking. -
getLand
-
getLand
-
getNationZone
- See Also:
-
isHomeLand
public boolean isHomeLand() -
isClaimed
public boolean isClaimed() -
isNexusLand
public boolean isNexusLand() -
getStructure
-
getKingdomBlock
public <T extends KeyedKingdomsObject<?>> @Nullable T getKingdomBlock(@NonNull org.kingdoms.server.location.BlockVector3 location, Class<T> type) Gets the desired kingdom block at the specified location.- Returns:
- null if there's no kingdom block at that location or if there is, it's not the same type as the specified one.
- See Also:
-
isKingdomBlock
public boolean isKingdomBlock(@NonNull org.kingdoms.server.location.BlockVector3 location) - See Also:
-
getStructure
-
hashCode
public int hashCode() -
equals
-
simpleEquals
-
unclaim
-
unclaim
public UnclaimLandEvent unclaim(@Nullable KingdomPlayer by, UnclaimLandEvent.Reason reason, boolean history) -
silentUnclaim
@Internal public void silentUnclaim()Useunclaim(KingdomPlayer, UnclaimLandEvent.Reason)instead. -
silentUnclaim
@Internal public void silentUnclaim(boolean removeExtras) Useunclaim(KingdomPlayer, UnclaimLandEvent.Reason)instead. -
isDataEmpty
@Internal public boolean isDataEmpty()Description copied from interface:SmartObjectChecks whether this data is absolutely empty and can be deleted from the database. The definition of "empty" depends on the implementation.- Returns:
- true if the data is empty and should be deleted, otherwise false
-
getLocation
-
getKey
-
toString
- Overrides:
toStringin classCompressedSmartObject
-
getDataHandler
Description copied from class:CompressedSmartObjectUsed for serialization of the smart object into a compressed state to determineCompressedSmartObject.shouldSave()- Overrides:
getDataHandlerin classCompressedSmartObject
-
getKingdom
-
setKingdom
-
isBeingInvaded
public boolean isBeingInvaded() -
getKingdomId
-
getStructures
-
unsafeGetStructures
-
unsafeGetTurrets
-
unsafeGetProtectedBlocks
@Internal @Bookmark(UNSAFE) public @NonNull @Bookmark(UNSAFE) Map<org.kingdoms.server.location.BlockVector3,ProtectionSign> unsafeGetProtectedBlocks() -
getKingdomBlocks
public @NonNull @Unmodifiable Map<org.kingdoms.server.location.BlockVector3,KingdomBlock> getKingdomBlocks()Gets a list of all blocks that is considered to belong to kingdoms plugin. The value can be one of the following:KingdomBuildingProtectionSign- Another type if registered by an addon.
Note that multiple blocks can belong to the same object, so this is not a viable/efficient way to iterate through blocks. This map is unmodifiable and should only be used to check block locations.
-
unsafeGetKingdomBlocks
@Internal @Bookmark(UNSAFE) public @NonNull @Bookmark(UNSAFE) Map<org.kingdoms.server.location.BlockVector3,KingdomBlock> unsafeGetKingdomBlocks() -
getClaimedBy
-
setClaimedBy
-
getClaimer
-
getInvasions
A list of all ongoing invasions that are affecting this land with the keys as the invader's kingdom ID.- Returns:
- an unmodifiable map.
-
isUnderAttack
public boolean isUnderAttack() -
addInvasion
Adds an invasion that affects this land.- Parameters:
invasion- the invasion that's affecting this land.- Throws:
IllegalArgumentException- if the invasion is already added or the invasion doesn't affect this land.
-
endInvasions
-
removeInvasion
-
removeInvasion
-
getProtectedBlocks
public @NonNull @Unmodifiable Map<org.kingdoms.server.location.BlockVector3,ProtectionSign> getProtectedBlocks() -
getTurrets
-
getSince
public long getSince() -
setSince
public void setSince(long since) -
addMessageContextEdits
- Specified by:
addMessageContextEditsin interfaceorg.kingdoms.locale.provider.CascadingMessageContextProvider- Overrides:
addMessageContextEditsin classKingdomsObject
-