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.
  • Field Details

    • cause

      protected final StructureActionCause cause
    • actionType

      protected final StructureActionType actionType
    • responsible

      protected final IPlayer 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 - The Cuboid representing 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

      public @NonNull String toString()
      Overrides:
      toString in class AnimatedArchitectureSpigotEvent
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: ICancellableAnimatedArchitectureEvent
      Checks if this event has been cancelled or not.
      Specified by:
      isCancelled in interface ICancellableAnimatedArchitectureEvent
      Returns:
      True if it has been cancelled.
    • setCancelled

      public void setCancelled(boolean isCancelled)
      Description copied from interface: ICancellableAnimatedArchitectureEvent
      Sets the cancelled status of this event.
      Specified by:
      setCancelled in interface ICancellableAnimatedArchitectureEvent
      Parameters:
      isCancelled - True to cancel the event.
    • getNewCuboid

      public Cuboid getNewCuboid()
      Description copied from interface: IStructureEventTogglePrepare
      Gets the new coordinates of the structure after the toggle.
      Specified by:
      getNewCuboid in interface IStructureEventTogglePrepare
      Returns:
      The new coordinates of the structure after the toggle.
    • getSnapshot

      public StructureSnapshot getSnapshot()
      Description copied from interface: IStructureToggleEvent
      Before 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:
      getSnapshot in interface IStructureToggleEvent
      Returns:
      A snapshot of the structure created at the time the toggle action was requested.
    • getCause

      public StructureActionCause getCause()
      Description copied from interface: IStructureToggleEvent
      Gets what caused the structure action request to be created.
      Specified by:
      getCause in interface IStructureToggleEvent
      Returns:
      The cause of the structure action request.
    • getActionType

      public StructureActionType getActionType()
      Description copied from interface: IStructureToggleEvent
      Gets the type of the requested action.
      Specified by:
      getActionType in interface IStructureToggleEvent
      Returns:
      The type of the requested action.
    • getResponsible

      public IPlayer getResponsible()
      Description copied from interface: IStructureToggleEvent
      Gets 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:
      getResponsible in interface IStructureToggleEvent
      Returns:
      The player that is responsible for this event.
    • getTime

      public double getTime()
      Description copied from interface: IStructureToggleEvent
      Gets requested duration of the animation. This may differ from the final duration based on other factors (such as speed limits).
      Specified by:
      getTime in interface IStructureToggleEvent
      Returns:
      The requested duration of the animation (in seconds).
    • isAnimationSkipped

      public boolean isAnimationSkipped()
      Description copied from interface: IStructureToggleEvent
      Checks if the event requested the structure to skip its animation and open instantly.
      Specified by:
      isAnimationSkipped in interface IStructureToggleEvent
      Returns:
      True if the event requested the structure to skip its animation and open instantly.