Paper/Spigot-API-Patches/0178-Flip-some-Spigot-API-null-annotations.patch
Shane Freeder 77b05b9c8e
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
6a4242cb #468: Allow delegation of certain elements to Vanilla when using a custom ChunkGenerator
c6697f90 SPIGOT-5559: Add EntityPotionEffectEvent causes for PATROL_CAPTAIN and WITHER_ROSE
9c1fa040 #467: Add method to remove a recipe by its key
3961d1aa Add nb-configuration.xml to .gitignore

CraftBukkit Changes:
d70084e5 Remove unused seed in CustomChunkGenerator
8a66d4c7 #619: Allow delegation of certain elements to Vanilla when using a custom ChunkGenerator
c2dc19d3 Craftbukkit -> CraftBukkit
ae45e092 SPIGOT-5559: Add EntityPotionEffectEvent causes for bee, raiders and wither rose
00980376 #618: Add method to remove a recipe by its key

Spigot Changes:
c574e08b Rebuild patches
13c24cc4 Rebuild patches
2020-02-02 11:53:48 +00:00

131 lines
5.4 KiB
Diff

From 150224b84389e4e41390bb346b9789e8f8a6152f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 389180290..93de987d5 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1167,7 +1167,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();
}
@@ -1464,7 +1464,7 @@ public final class Bukkit {
* @param clazz the class of the tag entries
* @return the tag or null
*/
- @Nullable
+ @UndefinedNullability // Paper
public static <T extends Keyed> Tag<T> getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class<T> 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 6e1a1124a..77d9cd0a1 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 fbb21b4a3..2733793a5 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -974,7 +974,7 @@ public interface Server extends PluginMessageRecipient {
*
* @return the scoreboard manager or null if no worlds are loaded.
*/
- @Nullable
+ @NotNull // Paper
ScoreboardManager getScoreboardManager();
/**
@@ -1244,7 +1244,7 @@ public interface Server extends PluginMessageRecipient {
* @param clazz the class of the tag entries
* @return the tag or null
*/
- @Nullable
+ @UndefinedNullability
<T extends Keyed> Tag<T> getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class<T> clazz);
/**
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index 3cada3487..03ba22659 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 4940ba6a9..d7d6a3e83 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 {
*
* @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();
}
--
2.25.0