Begin switching to JSpecify annotations (#11448)
* Begin switching to JSpecify annotations * more * fixes
This commit is contained in:
parent
6d7a438fad
commit
f9c7f2a5c1
66 changed files with 750 additions and 920 deletions
|
@ -12,10 +12,10 @@ This can replace many uses of BlockPhysicsEvent
|
|||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c0742b58ca2c098c27394915b624889ece1a9168
|
||||
index 0000000000000000000000000000000000000000..122ccdef02c292c5705a6ac0a96e6095d28bd7bf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java
|
||||
@@ -0,0 +1,122 @@
|
||||
@@ -0,0 +1,120 @@
|
||||
+package com.destroystokyo.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
|
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..c0742b58ca2c098c27394915b624889e
|
|||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockExpEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired anytime the server intends to 'destroy' a block through some triggering reason.
|
||||
|
@ -36,11 +36,12 @@ index 0000000000000000000000000000000000000000..c0742b58ca2c098c27394915b624889e
|
|||
+ * <p>
|
||||
+ * Events such as leaves decaying, pistons retracting (where the block is moving), does NOT fire this event.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class BlockDestroyEvent extends BlockExpEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final BlockData newState;
|
||||
+ private final BlockData newState;
|
||||
+ private boolean willDrop;
|
||||
+ private boolean playEffect = true;
|
||||
+ private BlockData effectBlock;
|
||||
|
@ -48,7 +49,7 @@ index 0000000000000000000000000000000000000000..c0742b58ca2c098c27394915b624889e
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockDestroyEvent(@NotNull Block block, @NotNull BlockData newState, @NotNull BlockData effectBlock, int xp, boolean willDrop) {
|
||||
+ public BlockDestroyEvent(final Block block, final BlockData newState, final BlockData effectBlock, final int xp, final boolean willDrop) {
|
||||
+ super(block, xp);
|
||||
+ this.newState = newState;
|
||||
+ this.effectBlock = effectBlock;
|
||||
|
@ -60,7 +61,6 @@ index 0000000000000000000000000000000000000000..c0742b58ca2c098c27394915b624889e
|
|||
+ *
|
||||
+ * @return block break effect
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public BlockData getEffectBlock() {
|
||||
+ return this.effectBlock;
|
||||
+ }
|
||||
|
@ -72,14 +72,14 @@ index 0000000000000000000000000000000000000000..c0742b58ca2c098c27394915b624889e
|
|||
+ *
|
||||
+ * @param effectBlock block effect
|
||||
+ */
|
||||
+ public void setEffectBlock(@NotNull BlockData effectBlock) {
|
||||
+ public void setEffectBlock(final BlockData effectBlock) {
|
||||
+ this.effectBlock = effectBlock;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return The new state of this block (Air, or a Fluid type)
|
||||
+ */
|
||||
+ public @NotNull BlockData getNewState() {
|
||||
+ public BlockData getNewState() {
|
||||
+ return this.newState.clone();
|
||||
+ }
|
||||
+
|
||||
|
@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..c0742b58ca2c098c27394915b624889e
|
|||
+ /**
|
||||
+ * @param willDrop If the server is going to drop the block in question with this destroy event
|
||||
+ */
|
||||
+ public void setWillDrop(boolean willDrop) {
|
||||
+ public void setWillDrop(final boolean willDrop) {
|
||||
+ this.willDrop = willDrop;
|
||||
+ }
|
||||
+
|
||||
|
@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..c0742b58ca2c098c27394915b624889e
|
|||
+ /**
|
||||
+ * @param playEffect If the server should play the sound effect for this destruction
|
||||
+ */
|
||||
+ public void setPlayEffect(boolean playEffect) {
|
||||
+ public void setPlayEffect(final boolean playEffect) {
|
||||
+ this.playEffect = playEffect;
|
||||
+ }
|
||||
+
|
||||
|
@ -123,17 +123,15 @@ index 0000000000000000000000000000000000000000..c0742b58ca2c098c27394915b624889e
|
|||
+ * If the event is cancelled, the block will remain in its previous state.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue