mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-30 19:52:06 -07:00
[ci skip] Cleanup events (#10202)
This commit is contained in:
@@ -30,23 +30,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * Fired anytime the server intends to 'destroy' a block through some triggering reason.
|
||||
+ * This does not fire anytime a block is set to air, but only with more direct triggers such
|
||||
+ * as physics updates, pistons, Entities changing blocks, commands set to "Destroy".
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * This event is associated with the game playing a sound effect at the block in question, when
|
||||
+ * something can be described as "intend to destroy what is there",
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * Events such as leaves decaying, pistons retracting (where the block is moving), does NOT fire this event.
|
||||
+ *
|
||||
+ */
|
||||
+public class BlockDestroyEvent extends BlockExpEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final BlockData newState;
|
||||
+ private boolean willDrop;
|
||||
+ private boolean playEffect = true;
|
||||
+ private BlockData effectBlock;
|
||||
+
|
||||
+ private boolean cancelled = false;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockDestroyEvent(@NotNull Block block, @NotNull BlockData newState, @NotNull BlockData effectBlock, int xp, boolean willDrop) {
|
||||
@@ -58,6 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ /**
|
||||
+ * Get the effect that will be played when the block is broken.
|
||||
+ *
|
||||
+ * @return block break effect
|
||||
+ */
|
||||
+ @NotNull
|
||||
@@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the effect that will be played when the block is broken.
|
||||
+ * Note: {@link BlockDestroyEvent#playEffect()} must be true in order for this effect to be
|
||||
+ * Note: {@link BlockDestroyEvent#playEffect()} must be {@code true} in order for this effect to be
|
||||
+ * played.
|
||||
+ *
|
||||
+ * @param effectBlock block effect
|
||||
@@ -81,7 +81,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public BlockData getNewState() {
|
||||
+ return newState;
|
||||
+ return this.newState;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@@ -117,25 +117,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * If the event is cancelled, the block will remain in its previous state.
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
Reference in New Issue
Block a user