Class StructureEventTogglePrepare
java.lang.Object
org.bukkit.event.Event
nl.pim16aap2.animatedarchitecture.spigot.core.events.AnimatedArchitectureSpigotEvent
nl.pim16aap2.animatedarchitecture.spigot.core.events.StructureEventTogglePrepare
- All Implemented Interfaces:
IAnimatedArchitectureEvent, ICancellableAnimatedArchitectureEvent, IStructureEventTogglePrepare, IStructureToggleEvent
public class StructureEventTogglePrepare
extends AnimatedArchitectureSpigotEvent
implements IStructureEventTogglePrepare
Implementation of
IStructureEventTogglePrepare for the Spigot platform.-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StructureActionTypeprotected final booleanprotected final StructureActionCauseprotected final IPlayerprotected final double -
Constructor Summary
ConstructorsConstructorDescriptionStructureEventTogglePrepare(StructureSnapshot snapshot, StructureActionCause cause, StructureActionType actionType, IPlayer responsible, double time, boolean animationSkipped, Cuboid newCuboid) Constructs a structure action event. -
Method Summary
Modifier and TypeMethodDescriptionGets the type of the requested action.getCause()Gets what caused the structure action request to be created.static org.bukkit.event.HandlerListorg.bukkit.event.HandlerListGets the new coordinates of the structure after the toggle.Gets the UUID of the player responsible for this structure action.Before the structure is animated, a snapshot of the data is created which is then used for all calculations.doublegetTime()Gets requested duration of the animation.booleanChecks if the event requested the structure to skip its animation and open instantly.booleanChecks if this event has been cancelled or not.voidsetCancelled(boolean isCancelled) Sets the cancelled status of this event.@NonNull StringtoString()Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronousMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IAnimatedArchitectureEvent
getEventName, isAsynchronousMethods inherited from interface IStructureToggleEvent
getActionType, getCause, getResponsible, getSnapshot, getTime, isAnimationSkipped
-
Field Details
-
cause
-
actionType
-
responsible
-
time
protected final double time -
animationSkipped
protected final boolean animationSkipped
-
-
Constructor Details
-
StructureEventTogglePrepare
public StructureEventTogglePrepare(StructureSnapshot snapshot, StructureActionCause cause, StructureActionType actionType, IPlayer responsible, double time, boolean animationSkipped, Cuboid newCuboid) Constructs a structure action event.- Parameters:
snapshot- A snapshot of the structure.cause- What caused the action.actionType- The type of action.responsible- Who is responsible for this structure. This player may be online, but does not have to be.time- The number of seconds the structure will take to open. Note that there are other factors that affect the total time as well.animationSkipped- If true, the structure will skip the animation and open instantly.newCuboid- TheCuboidrepresenting the area the structure will take up after the toggle.
-
-
Method Details
-
getHandlers
public org.bukkit.event.HandlerList getHandlers() -
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList() -
toString
- Overrides:
toStringin classAnimatedArchitectureSpigotEvent
-
isCancelled
public boolean isCancelled()Description copied from interface:ICancellableAnimatedArchitectureEventChecks if this event has been cancelled or not.- Specified by:
isCancelledin interfaceICancellableAnimatedArchitectureEvent- Returns:
- True if it has been cancelled.
-
setCancelled
public void setCancelled(boolean isCancelled) Description copied from interface:ICancellableAnimatedArchitectureEventSets the cancelled status of this event.- Specified by:
setCancelledin interfaceICancellableAnimatedArchitectureEvent- Parameters:
isCancelled- True to cancel the event.
-
getNewCuboid
Description copied from interface:IStructureEventTogglePrepareGets the new coordinates of the structure after the toggle.- Specified by:
getNewCuboidin interfaceIStructureEventTogglePrepare- Returns:
- The new coordinates of the structure after the toggle.
-
getSnapshot
Description copied from interface:IStructureToggleEventBefore the structure is animated, a snapshot of the data is created which is then used for all calculations.The snapshots are read-only, so this snapshot contains the old data of the structure before the animation was applied.
- Specified by:
getSnapshotin interfaceIStructureToggleEvent- Returns:
- A snapshot of the structure created at the time the toggle action was requested.
-
getCause
Description copied from interface:IStructureToggleEventGets what caused the structure action request to be created.- Specified by:
getCausein interfaceIStructureToggleEvent- Returns:
- The cause of the structure action request.
-
getActionType
Description copied from interface:IStructureToggleEventGets the type of the requested action.- Specified by:
getActionTypein interfaceIStructureToggleEvent- Returns:
- The type of the requested action.
-
getResponsible
Description copied from interface:IStructureToggleEventGets the UUID of the player responsible for this structure action. This either means the player who directly requested this action or, if it was requested indirectly (e.g. via redstone), the prime owner of the structure. Therefore, this player might not be online.- Specified by:
getResponsiblein interfaceIStructureToggleEvent- Returns:
- The player that is responsible for this event.
-
getTime
public double getTime()Description copied from interface:IStructureToggleEventGets requested duration of the animation. This may differ from the final duration based on other factors (such as speed limits).- Specified by:
getTimein interfaceIStructureToggleEvent- Returns:
- The requested duration of the animation (in seconds).
-
isAnimationSkipped
public boolean isAnimationSkipped()Description copied from interface:IStructureToggleEventChecks if the event requested the structure to skip its animation and open instantly.- Specified by:
isAnimationSkippedin interfaceIStructureToggleEvent- Returns:
- True if the event requested the structure to skip its animation and open instantly.
-