From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 24 Mar 2019 18:39:01 -0400 Subject: [PATCH] Flip some Spigot API null annotations 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 a69e0b0c9f515256c6406ef8ff55f72c98dabe0d..7dd3fc9301de9a88313179088f6b5ce4c1362f06 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -1389,7 +1389,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(); } @@ -1686,7 +1686,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 9c91c49ed7302c12fcb1d8e9bc58712efc199954..d5d67b3d84cd88ed0f858497e68535ec0162c700 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) { 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 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 17f8dd9870a47227a7c9bb09cceedb94f7190ead..139a96d01e3a7e2e298592ce5d485dfc21c9c6c7 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1171,7 +1171,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(); /** @@ -1441,7 +1441,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 Tag getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class clazz); /** 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..290c3f0fd6e8c3407d421b697e0ee01584f4cebd 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; @@ -546,7 +547,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(); }