From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 24 Mar 2019 18:39:01 -0400 Subject: [PATCH] Fix Spigot annotation mistakes while some of these may of been true, they are extreme cases and cause a ton of noise to plugin developers. These do not help plugin developers if they bring moise noise than value. diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java index a10ad183431d2a67e8f49062fba37e7fc3b760dc..5c7681809a27796e398170fc72bf0a950e52a971 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -1519,7 +1519,7 @@ public final class Bukkit { * * @return the scoreboard manager or null if no worlds are loaded. */ - @Nullable + @NotNull // Paper public static ScoreboardManager getScoreboardManager() { return server.getScoreboardManager(); } @@ -1816,7 +1816,7 @@ public final class Bukkit { * @param clazz the class of the tag entries * @return the tag or null */ - @Nullable + @UndefinedNullability // Paper public static Tag getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class clazz) { return server.getTag(registry, tag, clazz); } diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java index 88b3e0323dbc4f0fce31b147c7aaa08d65745852..23ca89dde7f6ac9082d4b97fce2959425f3680cb 100644 --- a/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java @@ -46,7 +46,7 @@ public class Location implements Cloneable, ConfigurationSerializable { * @param y The y-coordinate of this new location * @param z The z-coordinate of this new location */ - public Location(@Nullable final World world, final double x, final double y, final double z) { + public Location(@UndefinedNullability final World world, final double x, final double y, final double z) { // Paper this(world, x, y, z, 0, 0); } @@ -60,7 +60,7 @@ public class Location implements Cloneable, ConfigurationSerializable { * @param yaw The absolute rotation on the x-plane, in degrees * @param pitch The absolute rotation on the y-plane, in degrees */ - public Location(@Nullable final World world, final double x, final double y, final double z, final float yaw, final float pitch) { + public Location(@UndefinedNullability final World world, final double x, final double y, final double z, final float yaw, final float pitch) { // Paper if (world != null) { this.world = new WeakReference<>(world); } @@ -102,7 +102,7 @@ public class Location implements Cloneable, ConfigurationSerializable { * @throws IllegalArgumentException when world is unloaded * @see #isWorldLoaded() */ - @Nullable + @UndefinedNullability // Paper public World getWorld() { if (this.world == null) { return null; diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java index 27353a3eb4669ee457fe7d65dc5dd5e8c23c8283..5162e8b356e73ac41d6f4f5a0ea0efeda85382c7 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1286,7 +1286,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi * * @return the scoreboard manager or null if no worlds are loaded. */ - @Nullable + @NotNull // Paper ScoreboardManager getScoreboardManager(); /** @@ -1556,7 +1556,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi * @param clazz the class of the tag entries * @return the tag or null */ - @Nullable + @UndefinedNullability // Paper Tag getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class clazz); /** diff --git a/src/main/java/org/bukkit/entity/LingeringPotion.java b/src/main/java/org/bukkit/entity/LingeringPotion.java index f124b35ec76e6cb6a1a0dc464005087043c3efd0..94a2fef0dc9e13c754cd31d5eabc1bde2dbbe6a5 100644 --- a/src/main/java/org/bukkit/entity/LingeringPotion.java +++ b/src/main/java/org/bukkit/entity/LingeringPotion.java @@ -5,4 +5,5 @@ package org.bukkit.entity; * * @deprecated lingering status depends on only on the potion item. */ +@Deprecated // Paper public interface LingeringPotion extends ThrownPotion { } diff --git a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java index 2ff1b1308571d8f8056d3359e8a8ba4a589c3726..e669ad8ecd182c6899c7820414e6ee1f7312d699 100644 --- a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java +++ b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java @@ -68,6 +68,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab * @return experience level costs offered * @deprecated Use {@link #getOffers()} instead of this method */ + @Deprecated // Paper @NotNull public int[] getExpLevelCostsOffered() { int[] levelOffers = new int[offers.length]; diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java index 71e5ee496a947fbd8e3ec579833b157c76b51833..d773e8594f91017bddd7ea8aada3a1ff2781d05b 100644 --- a/src/main/java/org/bukkit/inventory/ItemFactory.java +++ b/src/main/java/org/bukkit/inventory/ItemFactory.java @@ -3,6 +3,7 @@ package org.bukkit.inventory; import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.Server; +import org.bukkit.UndefinedNullability; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; @@ -25,7 +26,7 @@ public interface ItemFactory { * @return a new ItemMeta that could be applied to an item stack of the * specified material */ - @Nullable + @UndefinedNullability // Paper ItemMeta getItemMeta(@NotNull final Material material); /** diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java index 686e2a0b9fe061816b41435ef2337870dbdca8e5..aacf8ea85909299355d16cad0386072ec542a70e 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -8,6 +8,7 @@ import java.util.Set; // Paper import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.UndefinedNullability; import org.bukkit.Utility; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.enchantments.Enchantment; @@ -68,6 +69,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor * @param damage durability / damage * @deprecated see {@link #setDurability(short)} */ + @Deprecated // Paper public ItemStack(@NotNull final Material type, final int amount, final short damage) { this(type, amount, damage, null); } @@ -546,7 +548,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor * * @return a copy of the current ItemStack's ItemData */ - @Nullable + @UndefinedNullability // Paper public ItemMeta getItemMeta() { return this.meta == null ? Bukkit.getItemFactory().getItemMeta(this.type) : this.meta.clone(); } diff --git a/src/main/java/org/bukkit/material/Step.java b/src/main/java/org/bukkit/material/Step.java index 9f502e7ee05d0512e190a1722cc112ece068c4e2..10c0465cf58d680bfa9a0f9233f94e8b6d5a9b93 100644 --- a/src/main/java/org/bukkit/material/Step.java +++ b/src/main/java/org/bukkit/material/Step.java @@ -78,6 +78,7 @@ public class Step extends TexturedMaterial { * * @deprecated Magic value */ + @Deprecated // Paper @Override protected int getTextureIndex() { return getData() & 0x7;