Finish converting all events to jspecify annotations
This commit is contained in:
		
					parent
					
						
							
								fa97c59a4e
							
						
					
				
			
			
				commit
				
					
						29a25df60e
					
				
			
		
					 78 changed files with 757 additions and 883 deletions
				
			
		| 
						 | 
				
			
			@ -12,16 +12,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
@@ -0,0 +0,0 @@
 | 
			
		||||
+package com.destroystokyo.paper.event.player;
 | 
			
		||||
+
 | 
			
		||||
+import java.util.Set;
 | 
			
		||||
+import org.bukkit.Material;
 | 
			
		||||
+import org.bukkit.entity.Player;
 | 
			
		||||
+import org.bukkit.event.HandlerList;
 | 
			
		||||
+import org.bukkit.event.player.PlayerEvent;
 | 
			
		||||
+import org.bukkit.inventory.ItemStack;
 | 
			
		||||
+
 | 
			
		||||
+import java.util.Set;
 | 
			
		||||
+import org.jetbrains.annotations.ApiStatus;
 | 
			
		||||
+import org.jetbrains.annotations.NotNull;
 | 
			
		||||
+import org.jetbrains.annotations.Nullable;
 | 
			
		||||
+import org.jspecify.annotations.NullMarked;
 | 
			
		||||
+import org.jspecify.annotations.Nullable;
 | 
			
		||||
+
 | 
			
		||||
+import static org.bukkit.Material.*;
 | 
			
		||||
+
 | 
			
		||||
| 
						 | 
				
			
			@ -30,16 +29,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+ * <p>
 | 
			
		||||
+ * Not currently called for environmental factors though it <strong>MAY BE IN THE FUTURE</strong>
 | 
			
		||||
+ */
 | 
			
		||||
+@NullMarked
 | 
			
		||||
+public class PlayerArmorChangeEvent extends PlayerEvent {
 | 
			
		||||
+
 | 
			
		||||
+    private static final HandlerList HANDLER_LIST = new HandlerList();
 | 
			
		||||
+
 | 
			
		||||
+    @NotNull private final SlotType slotType;
 | 
			
		||||
+    @NotNull private final ItemStack oldItem;
 | 
			
		||||
+    @NotNull private final ItemStack newItem;
 | 
			
		||||
+    private final SlotType slotType;
 | 
			
		||||
+    private final ItemStack oldItem;
 | 
			
		||||
+    private final ItemStack newItem;
 | 
			
		||||
+
 | 
			
		||||
+    @ApiStatus.Internal
 | 
			
		||||
+    public PlayerArmorChangeEvent(@NotNull Player player, @NotNull SlotType slotType, @NotNull ItemStack oldItem, @NotNull ItemStack newItem) {
 | 
			
		||||
+    public PlayerArmorChangeEvent(final Player player, final SlotType slotType, final ItemStack oldItem, final ItemStack newItem) {
 | 
			
		||||
+        super(player);
 | 
			
		||||
+        this.slotType = slotType;
 | 
			
		||||
+        this.oldItem = oldItem;
 | 
			
		||||
| 
						 | 
				
			
			@ -51,7 +51,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+     *
 | 
			
		||||
+     * @return type of slot being altered
 | 
			
		||||
+     */
 | 
			
		||||
+    @NotNull
 | 
			
		||||
+    public SlotType getSlotType() {
 | 
			
		||||
+        return this.slotType;
 | 
			
		||||
+    }
 | 
			
		||||
| 
						 | 
				
			
			@ -61,7 +60,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+     *
 | 
			
		||||
+     * @return old item
 | 
			
		||||
+     */
 | 
			
		||||
+    @NotNull
 | 
			
		||||
+    public ItemStack getOldItem() {
 | 
			
		||||
+        return this.oldItem;
 | 
			
		||||
+    }
 | 
			
		||||
| 
						 | 
				
			
			@ -71,18 +69,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+     *
 | 
			
		||||
+     * @return new item
 | 
			
		||||
+     */
 | 
			
		||||
+    @NotNull
 | 
			
		||||
+    public ItemStack getNewItem() {
 | 
			
		||||
+        return this.newItem;
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    @NotNull
 | 
			
		||||
+    @Override
 | 
			
		||||
+    public HandlerList getHandlers() {
 | 
			
		||||
+        return HANDLER_LIST;
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    @NotNull
 | 
			
		||||
+    public static HandlerList getHandlerList() {
 | 
			
		||||
+        return HANDLER_LIST;
 | 
			
		||||
+    }
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +90,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+
 | 
			
		||||
+        private final Set<Material> types;
 | 
			
		||||
+
 | 
			
		||||
+        SlotType(Material... types) {
 | 
			
		||||
+        SlotType(final Material... types) {
 | 
			
		||||
+            this.types = Set.of(types);
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
| 
						 | 
				
			
			@ -105,7 +100,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+         *
 | 
			
		||||
+         * @return immutable set of material types
 | 
			
		||||
+         */
 | 
			
		||||
+        @NotNull
 | 
			
		||||
+        public Set<Material> getTypes() {
 | 
			
		||||
+            return this.types;
 | 
			
		||||
+        }
 | 
			
		||||
| 
						 | 
				
			
			@ -116,9 +110,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+         * @param material material to get slot by
 | 
			
		||||
+         * @return slot type the material will go in, or {@code null} if it won't
 | 
			
		||||
+         */
 | 
			
		||||
+        @Nullable
 | 
			
		||||
+        public static SlotType getByMaterial(@NotNull Material material) {
 | 
			
		||||
+            for (SlotType slotType : values()) {
 | 
			
		||||
+        public static @Nullable SlotType getByMaterial(final Material material) {
 | 
			
		||||
+            for (final SlotType slotType : values()) {
 | 
			
		||||
+                if (slotType.getTypes().contains(material)) {
 | 
			
		||||
+                    return slotType;
 | 
			
		||||
+                }
 | 
			
		||||
| 
						 | 
				
			
			@ -132,7 +125,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+         * @param material material to check
 | 
			
		||||
+         * @return whether this material can be equipped
 | 
			
		||||
+         */
 | 
			
		||||
+        public static boolean isEquipable(@NotNull Material material) {
 | 
			
		||||
+        public static boolean isEquipable(final Material material) {
 | 
			
		||||
+            return getByMaterial(material) != null;
 | 
			
		||||
+        }
 | 
			
		||||
+    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue