Swap some nullable annotations (#9696)

This commit is contained in:
Lulu13022002 2023-09-14 12:44:12 +02:00 committed by GitHub
parent 1c15111f08
commit eea0c649ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 186 additions and 72 deletions

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerArmorChangeEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..faea096dac02d339667c02a0011b6f8313fd8c12
index 0000000000000000000000000000000000000000..57521010ff0574f1bbc96727948a6185fd37e9ee
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java
@@ -0,0 +1,137 @@
@@ -0,0 +1,139 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.Material;
@ -22,6 +22,7 @@ index 0000000000000000000000000000000000000000..faea096dac02d339667c02a0011b6f83
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
@ -36,10 +37,11 @@ index 0000000000000000000000000000000000000000..faea096dac02d339667c02a0011b6f83
+ private static final HandlerList HANDLERS = new HandlerList();
+
+ @NotNull private final SlotType slotType;
+ @Nullable private final ItemStack oldItem;
+ @Nullable private final ItemStack newItem;
+ @NotNull private final ItemStack oldItem;
+ @NotNull private final ItemStack newItem;
+
+ public PlayerArmorChangeEvent(@NotNull Player player, @NotNull SlotType slotType, @Nullable ItemStack oldItem, @Nullable ItemStack newItem) {
+ @ApiStatus.Internal
+ public PlayerArmorChangeEvent(@NotNull Player player, @NotNull SlotType slotType, @NotNull ItemStack oldItem, @NotNull ItemStack newItem) {
+ super(player);
+ this.slotType = slotType;
+ this.oldItem = oldItem;
@ -61,7 +63,7 @@ index 0000000000000000000000000000000000000000..faea096dac02d339667c02a0011b6f83
+ *
+ * @return old item
+ */
+ @Nullable
+ @NotNull
+ public ItemStack getOldItem() {
+ return this.oldItem;
+ }
@ -71,7 +73,7 @@ index 0000000000000000000000000000000000000000..faea096dac02d339667c02a0011b6f83
+ *
+ * @return new item
+ */
+ @Nullable
+ @NotNull
+ public ItemStack getNewItem() {
+ return this.newItem;
+ }
@ -137,10 +139,10 @@ index 0000000000000000000000000000000000000000..faea096dac02d339667c02a0011b6f83
+ }
+
+ /**
+ * Gets whether or not this material can be equipped to a slot
+ * Gets whether this material can be equipped to a slot
+ *
+ * @param material material to check
+ * @return whether or not this material can be equipped
+ * @return whether this material can be equipped
+ */
+ public static boolean isEquipable(@NotNull Material material) {
+ return getByMaterial(material) != null;