diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/BannedItemNames.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/BannedItemNames.java index 62d13474..085b417f 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/BannedItemNames.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/BannedItemNames.java @@ -12,6 +12,8 @@ import org.bukkit.event.Listener; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.EnumSet; @@ -78,7 +80,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if ( itemStack == null || whitelistedTypes.contains(itemStack.getType()) diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/BannedMaterials.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/BannedMaterials.java index df162763..838dfd9d 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/BannedMaterials.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/BannedMaterials.java @@ -7,6 +7,8 @@ import me.xginko.aef.utils.ItemUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.EnumSet; import java.util.List; @@ -65,7 +67,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/IllegalItemModule.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/IllegalItemModule.java index f99de6bc..b0edc56e 100644 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/IllegalItemModule.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/IllegalItemModule.java @@ -38,7 +38,9 @@ import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.util.Arrays; @@ -49,9 +51,6 @@ public abstract class IllegalItemModule extends AEFModule implements Listener { - public abstract ItemLegality legalityOf(ItemStack itemStack); - public abstract void handleItem(ItemStack itemStack, ItemLegality legality); - protected final AEFPermission bypassPermission; protected final IllegalHandling handling; protected final Set optionalListeners; @@ -62,6 +61,7 @@ public IllegalItemModule(String configPath, AEFPermission bypassPermission) { super(configPath); this.bypassPermission = bypassPermission; this.optionalListeners = new HashSet<>(); + String configuredHandling = config.getString(configPath + ".handling", IllegalHandling.PREVENT_USE_ONLY.name(), "Available options:\n" + Arrays.stream(IllegalHandling.values()) .map(option -> option.name() + " - " + option.description()) @@ -157,6 +157,10 @@ private void onChunkLoad(ChunkLoadEvent event) { this.createIfAbsent = eventClass -> new ExpiringSet<>(delay); } + public abstract @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack); + + public abstract void handleItem(ItemStack itemStack, ItemLegality legality); + @Override public void enable() { plugin.getServer().getPluginManager().registerEvents(this, plugin); @@ -170,7 +174,7 @@ public void disable() { optionalListeners.clear(); } - public ItemLegality legalityOf(Iterable itemStacks) { + public ItemLegality legalityOf(@Nullable Iterable itemStacks) { if (itemStacks == null) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/IllegalPotions.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/IllegalPotions.java index 640abe98..2383479c 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/IllegalPotions.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/IllegalPotions.java @@ -7,6 +7,8 @@ import me.xginko.aef.utils.MaterialUtil; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.PotionMeta; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; public class IllegalPotions extends IllegalItemModule { @@ -27,7 +29,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || !MaterialUtil.POTIONS.contains(itemStack.getType()) || !itemStack.hasItemMeta()) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/InvalidStackSize.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/InvalidStackSize.java index c12fb63c..9e8694eb 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/InvalidStackSize.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/InvalidStackSize.java @@ -6,6 +6,8 @@ import me.xginko.aef.utils.ItemUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.EnumSet; import java.util.List; @@ -47,7 +49,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType().isAir()) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/ItemAttributes.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/ItemAttributes.java index dba2cbfc..df8637b8 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/ItemAttributes.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/ItemAttributes.java @@ -8,6 +8,8 @@ import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.EnumSet; import java.util.List; @@ -49,7 +51,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType().isAir() || !itemStack.hasItemMeta()) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/PlayerHeads.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/PlayerHeads.java index 86e85d57..4fe7f19e 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/PlayerHeads.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/PlayerHeads.java @@ -6,6 +6,8 @@ import me.xginko.aef.utils.ItemUtil; import me.xginko.aef.utils.MaterialUtil; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; public class PlayerHeads extends IllegalItemModule { @@ -26,7 +28,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/SpawnEggs.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/SpawnEggs.java index 9ca06e55..2ffeb7c0 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/SpawnEggs.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/SpawnEggs.java @@ -8,6 +8,8 @@ import me.xginko.aef.utils.ItemUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.EnumSet; @@ -49,7 +51,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || whitelistedTypes.contains(itemStack.getType())) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/Unbreakables.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/Unbreakables.java index 46b38f42..895d4022 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/Unbreakables.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/Unbreakables.java @@ -8,6 +8,8 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.Damageable; import org.bukkit.inventory.meta.ItemMeta; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.EnumSet; import java.util.List; @@ -53,7 +55,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType().isAir() || !itemStack.hasItemMeta()) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/HigherEnchants.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/HigherEnchants.java index 204f436c..d1bab08d 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/HigherEnchants.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/HigherEnchants.java @@ -8,6 +8,8 @@ import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.EnumSet; import java.util.HashSet; @@ -63,7 +65,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType().isAir()) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/InapplicableEnchants.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/InapplicableEnchants.java index e298cde1..dde4d37d 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/InapplicableEnchants.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/InapplicableEnchants.java @@ -8,6 +8,8 @@ import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.EnumSet; import java.util.List; @@ -51,7 +53,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType().isAir()) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/IncompatibleEnchants.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/IncompatibleEnchants.java index cb700dc8..4a2f981e 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/IncompatibleEnchants.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/IncompatibleEnchants.java @@ -8,6 +8,8 @@ import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.EnumSet; @@ -76,7 +78,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType() == Material.AIR) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CommandItems.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CommandItems.java index 7c691148..9a806a4d 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CommandItems.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CommandItems.java @@ -6,6 +6,8 @@ import me.xginko.aef.modules.illegals.items.IllegalItemModule; import me.xginko.aef.utils.MaterialUtil; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; public class CommandItems extends IllegalItemModule { @@ -27,7 +29,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType().isAir()) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CustomNBTFilter.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CustomNBTFilter.java index 7e7b1dfe..d0a835ba 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CustomNBTFilter.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CustomNBTFilter.java @@ -8,6 +8,8 @@ import me.xginko.aef.utils.ItemUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.EnumSet; import java.util.HashSet; @@ -52,7 +54,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType().isAir()) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/NBTFilledStorageItem.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/NBTFilledStorageItem.java index 766344eb..ef941ca7 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/NBTFilledStorageItem.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/NBTFilledStorageItem.java @@ -10,6 +10,8 @@ import me.xginko.aef.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.EnumSet; import java.util.Objects; @@ -55,7 +57,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType().isAir()) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/BannedItemNames.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/BannedItemNames.java index 0e929b2f..89817925 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/BannedItemNames.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/BannedItemNames.java @@ -6,6 +6,8 @@ import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.EnumSet; @@ -56,7 +58,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if ( itemStack == null || whitelistedTypes.contains(itemStack.getType()) diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/BannedMaterials.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/BannedMaterials.java index df162763..838dfd9d 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/BannedMaterials.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/BannedMaterials.java @@ -7,6 +7,8 @@ import me.xginko.aef.utils.ItemUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.EnumSet; import java.util.List; @@ -65,7 +67,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/IllegalItemModule.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/IllegalItemModule.java index 913c65ed..19549a31 100644 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/IllegalItemModule.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/IllegalItemModule.java @@ -38,7 +38,9 @@ import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.PolyNull; +import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.util.Arrays; @@ -49,13 +51,9 @@ public abstract class IllegalItemModule extends AEFModule implements Listener { - public abstract ItemLegality legalityOf(ItemStack itemStack); - public abstract void handleItem(ItemStack itemStack, ItemLegality legality); - protected final AEFPermission bypassPermission; protected final IllegalHandling handling; protected final Set optionalListeners; - private final Cache, ExpiringSet> listenerCooldowns; private final Function, @PolyNull ExpiringSet> createIfAbsent; @@ -159,6 +157,10 @@ private void onChunkLoad(ChunkLoadEvent event) { this.createIfAbsent = eventClass -> new ExpiringSet<>(delay); } + public abstract @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack); + + public abstract void handleItem(ItemStack itemStack, ItemLegality legality); + @Override public void enable() { plugin.getServer().getPluginManager().registerEvents(this, plugin); diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/IllegalPotions.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/IllegalPotions.java index 98b6a86c..8ebebaad 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/IllegalPotions.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/IllegalPotions.java @@ -7,6 +7,8 @@ import me.xginko.aef.utils.MaterialUtil; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.PotionMeta; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; public class IllegalPotions extends IllegalItemModule { @@ -27,7 +29,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || !MaterialUtil.POTIONS.contains(itemStack.getType()) || !itemStack.hasItemMeta()) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/InvalidStackSize.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/InvalidStackSize.java index 86056fba..ca5fe750 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/InvalidStackSize.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/InvalidStackSize.java @@ -7,6 +7,8 @@ import me.xginko.aef.utils.ItemUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.EnumSet; @@ -49,7 +51,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType() == Material.AIR) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/PlayerHeads.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/PlayerHeads.java index 364b1b1d..1fd8040a 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/PlayerHeads.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/PlayerHeads.java @@ -6,6 +6,8 @@ import me.xginko.aef.utils.ItemUtil; import me.xginko.aef.utils.MaterialUtil; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; public class PlayerHeads extends IllegalItemModule { @@ -26,7 +28,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/SpawnEggs.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/SpawnEggs.java index fdc6b846..ed2d6b41 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/SpawnEggs.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/SpawnEggs.java @@ -8,6 +8,8 @@ import me.xginko.aef.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.EnumSet; @@ -49,7 +51,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || whitelistedTypes.contains(itemStack.getType())) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/Unbreakables.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/Unbreakables.java index 625595fd..787e5327 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/Unbreakables.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/Unbreakables.java @@ -9,6 +9,8 @@ import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.EnumSet; @@ -58,7 +60,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType() == Material.AIR) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/datavalues/CustomDataValues.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/datavalues/CustomDataValues.java index 749d3349..66513f50 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/datavalues/CustomDataValues.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/datavalues/CustomDataValues.java @@ -8,6 +8,8 @@ import me.xginko.aef.utils.PlatformUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.EnumSet; @@ -55,7 +57,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType() == Material.AIR) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/datavalues/IllegalGoldenApples.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/datavalues/IllegalGoldenApples.java index 313105a3..7c163c1f 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/datavalues/IllegalGoldenApples.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/datavalues/IllegalGoldenApples.java @@ -10,6 +10,8 @@ import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.EnumMap; import java.util.Map; @@ -44,7 +46,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/HigherEnchants.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/HigherEnchants.java index c2a8002b..572bc019 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/HigherEnchants.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/HigherEnchants.java @@ -8,6 +8,8 @@ import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.EnumSet; @@ -62,7 +64,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType() == Material.AIR) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/InapplicableEnchants.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/InapplicableEnchants.java index 268cd7eb..8509d6bd 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/InapplicableEnchants.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/InapplicableEnchants.java @@ -9,6 +9,8 @@ import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.EnumSet; @@ -53,7 +55,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType() == Material.AIR) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/IncompatibleEnchants.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/IncompatibleEnchants.java index c8b64ce6..947aa350 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/IncompatibleEnchants.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/IncompatibleEnchants.java @@ -8,6 +8,8 @@ import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.EnumSet; @@ -76,7 +78,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType() == Material.AIR) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CommandItems.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CommandItems.java index ef548a4c..2b877cbd 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CommandItems.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CommandItems.java @@ -7,6 +7,8 @@ import me.xginko.aef.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; public class CommandItems extends IllegalItemModule { @@ -28,7 +30,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType() == Material.AIR) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CustomNBTFilter.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CustomNBTFilter.java index abfe838d..3b42cb5f 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CustomNBTFilter.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CustomNBTFilter.java @@ -8,6 +8,8 @@ import me.xginko.aef.utils.ItemUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.EnumSet; @@ -52,7 +54,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType() == Material.AIR) { return ItemLegality.LEGAL; } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/nbt/NBTFilledStorageItem.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/nbt/NBTFilledStorageItem.java index 8f6060c8..d80c7577 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/nbt/NBTFilledStorageItem.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/nbt/NBTFilledStorageItem.java @@ -9,6 +9,8 @@ import me.xginko.aef.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.EnumSet; import java.util.Objects; @@ -54,7 +56,7 @@ public boolean shouldEnable() { } @Override - public ItemLegality legalityOf(ItemStack itemStack) { + public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getType() == Material.AIR) { return ItemLegality.LEGAL; }