Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5376

A new event: "PickBlockEvent"

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • 1.14.4-R0.1-SNAPSHOT
    • Yes

      A simple event to be ran when a player uses the pickblock function.

      public class PickBlockEvent extends BlockEvent implements Cancellable {
          private Player picker;
      
          private static HandlerList handlers = new HandlerList();
          private boolean cancelled = false;
      
          public PickBlockEvent(@NotNull Block block) {
              super(block);
          }
      
          @Override
          public boolean isCancelled()
          { return cancelled; }
          @Override
          public void setCancelled(boolean cancel)
          { this.cancelled = cancel; }
          
          /**
          * modified depending on how Minecraft handles block picking
          * (could only be a material)
          */
          public void setPickedItemStack(ItemStack stack) {
              this.pickedStack = pickedStack;
          }
      
          public Player getPicker() {
              return this.picker;
          }
      
          @NotNull @Override
          public HandlerList getHandlers()
          { return handlers; }
          @NotNull
          public static HandlerList getHandlerList()
          { return handlers; }
      }
      

       

       

            Unassigned Unassigned
            ASangarin Aria Sangarin
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: