Swap some nullable annotations (#9696)

This commit is contained in:
Lulu13022002
2023-09-14 12:44:12 +02:00
parent 11f2c20c6a
commit abbdae4f53
9 changed files with 171 additions and 57 deletions

View File

@@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+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..00000000000000000000000000000000
+ * 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..00000000000000000000000000000000
+
+ @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..00000000000000000000000000000000
+ 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..00000000000000000000000000000000
+ return state;
+ }
+ }
+ throw new IllegalArgumentException("Material not an anvil");
+ throw new IllegalArgumentException("Material is not an anvil state");
+ }
+ }
+}