Class PlayerBlockLockEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
wtf.choco.locksecurity.api.event.block.PlayerBlockLockEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class PlayerBlockLockEvent
extends org.bukkit.event.player.PlayerEvent
implements org.bukkit.event.Cancellable
Called when a player locks a block.
Since:
3.0.0
Author:
Parker Hawke - Choco
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors 
    Constructor Description
    PlayerBlockLockEvent​(ILockSecurityPlayer player, ILockedBlock lockedBlock, org.bukkit.inventory.ItemStack unsmithedKey, org.bukkit.inventory.ItemStack smithedKey, org.bukkit.inventory.EquipmentSlot hand)  
  • Method Summary

    Modifier and Type Method Description
    org.bukkit.inventory.EquipmentSlot getHand()
    Get the hand used in this event.
    static org.bukkit.event.HandlerList getHandlerList()  
    org.bukkit.event.HandlerList getHandlers()  
    ILockedBlock getLockedBlock()
    Get the ILockedBlock involved in this event.
    ILockSecurityPlayer getPlayerWrapper()
    Get the ILockSecurityPlayer wrapper for the player involved in this event.
    org.bukkit.inventory.ItemStack getSmithedKey()
    Get the smithed key to be returned to the player once the event has succeeded.
    org.bukkit.inventory.ItemStack getUnsmithedKey()
    Get the unsmithed key used to lock the block.
    boolean isCancelled()  
    void setCancelled​(boolean cancel)  
    void setConsumeUnsmithedKey​(boolean consumeUnsmithedKey)
    Set whether or not to consumed the unsmithed key.
    void setSmithedKey​(org.bukkit.inventory.ItemStack key)
    Set the smithed key to be returned to the player once the event has succeeded.
    boolean shouldConsumeUnsmithedKey()
    Check whether or not the unsmithed key should be consumed.

    Methods inherited from class org.bukkit.event.player.PlayerEvent

    getPlayer

    Methods inherited from class org.bukkit.event.Event

    getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PlayerBlockLockEvent

      public PlayerBlockLockEvent​(@NotNull ILockSecurityPlayer player, @NotNull ILockedBlock lockedBlock, @NotNull org.bukkit.inventory.ItemStack unsmithedKey, @NotNull org.bukkit.inventory.ItemStack smithedKey, @NotNull org.bukkit.inventory.EquipmentSlot hand)
  • Method Details

    • getPlayerWrapper

      @NotNull public ILockSecurityPlayer getPlayerWrapper()
      Get the ILockSecurityPlayer wrapper for the player involved in this event.
      Returns:
      the player wrapper
    • getLockedBlock

      @NotNull public ILockedBlock getLockedBlock()
      Get the ILockedBlock involved in this event. This block has not yet been registered by the time this event has been called, therefore a reference should not be held if the event has been cancelled.
      Returns:
      the locked block
    • getUnsmithedKey

      @NotNull public org.bukkit.inventory.ItemStack getUnsmithedKey()
      Get the unsmithed key used to lock the block. Changes made to this item will not be reflected in the player's inventory.
      Returns:
      the unsmithed key
    • setSmithedKey

      public void setSmithedKey​(@Nullable org.bukkit.inventory.ItemStack key)
      Set the smithed key to be returned to the player once the event has succeeded.
      Parameters:
      key - the key to give
    • getSmithedKey

      @Nullable public org.bukkit.inventory.ItemStack getSmithedKey()
      Get the smithed key to be returned to the player once the event has succeeded.
      Returns:
      the smithed key
    • getHand

      @NotNull public org.bukkit.inventory.EquipmentSlot getHand()
      Get the hand used in this event.
      Returns:
      the hand
    • setConsumeUnsmithedKey

      public void setConsumeUnsmithedKey​(boolean consumeUnsmithedKey)
      Set whether or not to consumed the unsmithed key.
      Parameters:
      consumeUnsmithedKey - whether or not to consume the unsmithed key
    • shouldConsumeUnsmithedKey

      public boolean shouldConsumeUnsmithedKey()
      Check whether or not the unsmithed key should be consumed. For creative players, this value will already be set to false.
      Returns:
      whether or not to consume the unsmithed key
    • setCancelled

      public void setCancelled​(boolean cancel)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • getHandlers

      @NotNull public org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      @NotNull public static org.bukkit.event.HandlerList getHandlerList()