Swap some nullable annotations (#9696)
This commit is contained in:
parent
1c15111f08
commit
eea0c649ca
9 changed files with 186 additions and 72 deletions
|
@ -6,10 +6,10 @@ Subject: [PATCH] AnvilDamageEvent
|
|||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a83c286c1c11af25fc4d16af7a42b95ce90b9dee
|
||||
index 0000000000000000000000000000000000000000..aa5c3690fb898a7560a9551df91588a0cdc69fe2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
|
||||
@@ -0,0 +1,148 @@
|
||||
@@ -0,0 +1,151 @@
|
||||
+package com.destroystokyo.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
|
@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..a83c286c1c11af25fc4d16af7a42b95c
|
|||
+import org.bukkit.event.inventory.InventoryEvent;
|
||||
+import org.bukkit.inventory.AnvilInventory;
|
||||
+import org.bukkit.inventory.InventoryView;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
|
@ -26,11 +27,13 @@ index 0000000000000000000000000000000000000000..a83c286c1c11af25fc4d16af7a42b95c
|
|||
+ * Called when an anvil is damaged from being used
|
||||
+ */
|
||||
+public class AnvilDamagedEvent extends InventoryEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancel;
|
||||
+ private DamageState damageState;
|
||||
+
|
||||
+ public AnvilDamagedEvent(@NotNull InventoryView inventory, @NotNull BlockData blockData) {
|
||||
+ @ApiStatus.Internal
|
||||
+ public AnvilDamagedEvent(@NotNull InventoryView inventory, @Nullable BlockData blockData) {
|
||||
+ super(inventory);
|
||||
+ this.damageState = DamageState.getState(blockData);
|
||||
+ }
|
||||
|
@ -92,12 +95,12 @@ index 0000000000000000000000000000000000000000..a83c286c1c11af25fc4d16af7a42b95c
|
|||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -109,7 +112,7 @@ index 0000000000000000000000000000000000000000..a83c286c1c11af25fc4d16af7a42b95c
|
|||
+ DAMAGED(Material.DAMAGED_ANVIL),
|
||||
+ BROKEN(Material.AIR);
|
||||
+
|
||||
+ private Material material;
|
||||
+ private final Material material;
|
||||
+
|
||||
+ DamageState(@NotNull Material material) {
|
||||
+ this.material = material;
|
||||
|
@ -154,7 +157,7 @@ index 0000000000000000000000000000000000000000..a83c286c1c11af25fc4d16af7a42b95c
|
|||
+ return state;
|
||||
+ }
|
||||
+ }
|
||||
+ throw new IllegalArgumentException("Material not an anvil");
|
||||
+ throw new IllegalArgumentException("Material is not an anvil state");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue