Interface IStructureConst
- All Superinterfaces:
IPropertyHolderConst
- All Known Implementing Classes:
Structure, StructureSnapshot
Please read the documentation of nl.pim16aap2.animatedarchitecture.core.structures for more information about
the structure system.
Never cast an IStructureConst to a Structure, even when it looks like it might be possible. Doing so
can lead to all kinds of issues, including deadlocks.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if this structure can move perpetually.booleanstatic StringformatNameAndUid(String name, long uid) Formats a name and UID into a string.Gets the rectangle describing the limits within an animation of this door takes place.default StringGets the basic information of this structure.default intRetrieve the total number of blocks thisStructureis made out of.default longGets the id of the chunk in which the power block resides.Gets theCuboidrepresenting the area taken up by this structure.Cycle theMovementDirectiondirection thisStructurewill open in.default Vector3DiGets the dimensions of this structure.default Vector3DiGets a copy of the maximum position of this structure.default Vector3DiGets the minimum position of this structure.doubleGets the lower time limit for an animation.getName()Gets the name of this structure.default StringGets the name and UID of this structure formatted as "name (uid)".Gets theMovementDirectionthisStructurewill open if currently closed.Attempts to get theStructureOwnerof this structure represented by the UUID of a player.default Optional<StructureOwner> Attempts to get theStructureOwnerof this structure represented by anIPlayer.Gets allStructureOwners of this structure, including the original creator.default PermissionLevelgetPermissionLevel(IPlayer player) Gets the permission level of a player for this structure.default PermissionLevelgetPermissionLevel(ICommandSender commandSender) Gets the permission level of a command sender for this structure.Gets the position of power block of this structure.Gets the prime owner (permission = 0) of this structure.Gets thePropertyContainerSnapshotof this structure.Returns a (read-only)StructureSnapshotof this structure.getType()Returns theStructureTypeof this structure.longgetUid()Gets the UID of theStructureas used in the database.getWorld()Gets the IWorld thisStructureexists in.booleanisLocked()Check if theStructureis currently locked.booleanChecks if a player with a given UUID is a (co-)owner of this structure with any level of ownership.booleanisOwner(UUID player, PermissionLevel permissionLevel) Checks if a player with a given UUID is a (co-)owner of this structure with a given level of ownership.default booleanChecks if a player with a given UUID is a (co-)owner of this structure with any level of ownership.default booleanisOwner(IPlayer player, PermissionLevel permissionLevel) Checks if a player with a given UUID is a (co-)owner of this structure with a given level of ownership.Methods inherited from interface IPropertyHolderConst
getPropertyValue, getRequiredPropertyValue, hasProperties, hasProperties, hasProperties, hasProperty, propertyCount
-
Method Details
-
getPermissionLevel
Gets the permission level of a command sender for this structure.- Parameters:
commandSender- The command sender to check the permission level for.- Returns:
- The permission level of the command sender for this structure.
-
getPermissionLevel
Gets the permission level of a player for this structure.- Parameters:
player- The player to check the permission level for.- Returns:
- The permission level of the player for this structure.
-
getSnapshot
StructureSnapshot getSnapshot()Returns a (read-only)StructureSnapshotof this structure.Repeated calls to this method may or may not return the same instance unless the underlying structure has been modified, in which case a new snapshot reflecting the changes will be returned.
- Returns:
- A
StructureSnapshotof this structure.
-
getType
StructureType getType()Returns theStructureTypeof this structure.- Returns:
- The
StructureTypeof this structure.
-
getCuboid
-
getAnimationRange
Rectangle getAnimationRange()Gets the rectangle describing the limits within an animation of this door takes place.At no point during an animation will any animated block leave this cuboid, though not guarantees are given regarding how tight the cuboid fits around the animated blocks.
- Returns:
- The animation range.
-
getName
-
formatNameAndUid
-
getNameAndUid
Gets the name and UID of this structure formatted as "name (uid)".- Returns:
- The name and UID of this structure formatted as "name (uid)".
-
getWorld
-
getUid
-
getBasicInfo
Gets the basic information of this structure.This includes the name, UID, type, and prime owner of this structure.
- Returns:
- The basic information of this structure.
-
getMinimumAnimationTime
double getMinimumAnimationTime()Gets the lower time limit for an animation.Because animated blocks have a speed limit, as determined by
IConfig.maxBlockSpeed(), there is also a minimum amount of time for its animation.The exact time limit depends on the shape, size, and type of structure.
- Returns:
- The lower animation time limit for this structure in seconds.
-
isLocked
-
getPrimeOwner
StructureOwner getPrimeOwner()Gets the prime owner (permission = 0) of this structure. In most cases, this will be the original creator of the structure.- Returns:
- The prime owner of this structure.
-
getOwners
Collection<StructureOwner> getOwners()Gets allStructureOwners of this structure, including the original creator.- Returns:
- All
StructureOwners of this structure, including the original creator.
-
getOwner
Attempts to get theStructureOwnerof this structure represented by the UUID of a player.- Parameters:
player- The UUID of the player that may or may not be an owner of this structure.- Returns:
- The
StructureOwnerof this structure for the given player, if this player is aStructureOwnerof this structure.
-
getOwner
Attempts to get theStructureOwnerof this structure represented by anIPlayer.- Parameters:
player- The player that may or may not be an owner of this structure.- Returns:
- The
StructureOwnerof this structure for the given player, if this player is aStructureOwnerof this structure.
-
isOwner
Checks if a player with a given UUID is a (co-)owner of this structure with any level of ownership.If the level of ownership matters, use
getOwner(UUID)instead.- Parameters:
player- The UUID of a player.- Returns:
- True if the player with the given UUID is an owner of this structure with any level of ownership.
-
isOwner
Checks if a player with a given UUID is a (co-)owner of this structure with any level of ownership.If the level of ownership matters, use
getOwner(UUID)instead.- Parameters:
player- The player.- Returns:
- True if the player with the given UUID is an owner of this structure with any level of ownership.
-
isOwner
Checks if a player with a given UUID is a (co-)owner of this structure with a given level of ownership.- Parameters:
player- The UUID of a player.permissionLevel- The maximum level of ownership the player may have.E.g. when permissionLevel is
PermissionLevel.ADMIN, this method will return true if the player has admin access or lower (PermissionLevel.ADMINorPermissionLevel.CREATOR).- Returns:
- True if the player with the given UUID is an owner of this structure with the given level of ownership (or lower).
-
isOwner
Checks if a player with a given UUID is a (co-)owner of this structure with a given level of ownership.- Parameters:
player- The player.permissionLevel- The maximum level of ownership the player may have.E.g. when permissionLevel is
PermissionLevel.ADMIN, this method will return true if the player has admin access or lower (PermissionLevel.ADMINorPermissionLevel.CREATOR).- Returns:
- True if the player with the given UUID is an owner of this structure with the given level of ownership (or lower).
-
getOpenDirection
MovementDirection getOpenDirection()Gets theMovementDirectionthisStructurewill open if currently closed.Note that if it's currently in the open status, it is supposed go in the opposite direction, as the closing direction is the opposite of the opening direction. This isn't taken into account by this method.
- Returns:
- The
MovementDirectionthisStructurewill open in.
-
getPowerBlock
Vector3Di getPowerBlock()Gets the position of power block of this structure.- Returns:
- The position of the power block of this structure.
-
getMinimum
Gets the minimum position of this structure.- Returns:
- The minimum coordinates of this structure.
-
getMaximum
Gets a copy of the maximum position of this structure.- Returns:
- A copy of the maximum position of this structure.
-
getBlockCount
-
getDimensions
Gets the dimensions of this structure.If a structure has a min and max X value of 120, for example, it would have an X-dimension of 0. If the min X value is 119 instead, it would have an X-dimension of 1.
- Returns:
- The dimensions of this structure.
-
getChunkId
default long getChunkId()Gets the id of the chunk in which the power block resides.See
LocationUtil.getChunkId(Vector3Di)for more information about chunk ids.- Returns:
- The chunk id of the chunk in which the power block resides.
-
getCycledOpenDirection
MovementDirection getCycledOpenDirection()Cycle theMovementDirectiondirection thisStructurewill open in. By default, it will loop over all valid directions. SeeStructureType.getValidOpenDirectionsList(). However, subclasses may override this behavior.Note that this does not actually change the open direction; it merely tells you which direction comes next!
- Returns:
- The new
MovementDirectiondirection thisStructurewill open in.
-
equals
-
getPropertyContainerSnapshot
IPropertyContainerConst getPropertyContainerSnapshot()Gets thePropertyContainerSnapshotof this structure.- Returns:
- The
PropertyContainerSnapshotof this structure.
-
canMovePerpetually
boolean canMovePerpetually()Checks if this structure can move perpetually.- Returns:
- True if this structure can move perpetually.
-