geforkt von Mirrors/Paper
d3087536e9
Upstream has released updates that appear 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: 33a2b476 PR-734: Make PlayerInventory#getItem Nullable CraftBukkit Changes: 953d3ddc SPIGOT-3034: PlayerKickEvent.setLeaveMessage(String) doesn't actually do anything 2c47af0c SPIGOT-6963: CraftMetaBlockState#getBlockState applied TileEntity ids without the minecraft namespace prefix.
298 Zeilen
14 KiB
Diff
298 Zeilen
14 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -0,0 +0,0 @@ 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();
|
|
}
|
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/Location.java
|
|
+++ b/src/main/java/org/bukkit/Location.java
|
|
@@ -0,0 +0,0 @@ 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);
|
|
}
|
|
|
|
@@ -0,0 +0,0 @@ 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);
|
|
}
|
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -0,0 +0,0 @@ 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();
|
|
|
|
/**
|
|
diff --git a/src/main/java/org/bukkit/entity/LingeringPotion.java b/src/main/java/org/bukkit/entity/LingeringPotion.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/entity/LingeringPotion.java
|
|
+++ b/src/main/java/org/bukkit/entity/LingeringPotion.java
|
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
|
|
@@ -0,0 +0,0 @@ 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/CraftingInventory.java b/src/main/java/org/bukkit/inventory/CraftingInventory.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/inventory/CraftingInventory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/CraftingInventory.java
|
|
@@ -0,0 +0,0 @@ public interface CraftingInventory extends Inventory {
|
|
*
|
|
* @return The contents. Individual entries may be null.
|
|
*/
|
|
- @NotNull
|
|
- ItemStack[] getMatrix();
|
|
+ @Nullable ItemStack @NotNull [] getMatrix(); // Paper - make array elements nullable instead array
|
|
|
|
/**
|
|
* Set the item in the result slot of the crafting inventory.
|
|
@@ -0,0 +0,0 @@ public interface CraftingInventory extends Inventory {
|
|
* @throws IllegalArgumentException if the length of contents is greater
|
|
* than the size of the crafting matrix.
|
|
*/
|
|
- void setMatrix(@NotNull ItemStack[] contents);
|
|
+ void setMatrix(@Nullable ItemStack @NotNull [] contents); // Paper - make array elements nullable instead array
|
|
|
|
/**
|
|
* Get the current recipe formed on the crafting inventory, if any.
|
|
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/inventory/Inventory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
|
|
@@ -0,0 +0,0 @@ public interface Inventory extends Iterable<ItemStack> {
|
|
*
|
|
* @return An array of ItemStacks from the inventory. Individual items may be null.
|
|
*/
|
|
- @NotNull
|
|
- public ItemStack[] getContents();
|
|
+ public @Nullable ItemStack @NotNull [] getContents(); // Paper - make array elements nullable instead array
|
|
|
|
/**
|
|
* Completely replaces the inventory's contents. Removes all existing
|
|
@@ -0,0 +0,0 @@ public interface Inventory extends Iterable<ItemStack> {
|
|
* @throws IllegalArgumentException If the array has more items than the
|
|
* inventory.
|
|
*/
|
|
- public void setContents(@NotNull ItemStack[] items) throws IllegalArgumentException;
|
|
+ public void setContents(@Nullable ItemStack @NotNull [] items) throws IllegalArgumentException; // Paper - make array elements nullable instead array
|
|
|
|
/**
|
|
* Return the contents from the section of the inventory where items can
|
|
@@ -0,0 +0,0 @@ public interface Inventory extends Iterable<ItemStack> {
|
|
*
|
|
* @return inventory storage contents. Individual items may be null.
|
|
*/
|
|
- @NotNull
|
|
- public ItemStack[] getStorageContents();
|
|
+ public @Nullable ItemStack @NotNull [] getStorageContents(); // Paper - make array elements nullable instead array
|
|
|
|
/**
|
|
* Put the given ItemStacks into the storage slots
|
|
@@ -0,0 +0,0 @@ public interface Inventory extends Iterable<ItemStack> {
|
|
* @throws IllegalArgumentException If the array has more items than the
|
|
* inventory.
|
|
*/
|
|
- public void setStorageContents(@NotNull ItemStack[] items) throws IllegalArgumentException;
|
|
+ public void setStorageContents(@Nullable ItemStack @NotNull [] items) throws IllegalArgumentException; // Paper - make array elements nullable instead array
|
|
|
|
/**
|
|
* Checks if the inventory contains any ItemStacks with the given
|
|
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
@@ -0,0 +0,0 @@ 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;
|
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
@@ -0,0 +0,0 @@ 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;
|
|
@@ -0,0 +0,0 @@ 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);
|
|
}
|
|
@@ -0,0 +0,0 @@ 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/inventory/PlayerInventory.java b/src/main/java/org/bukkit/inventory/PlayerInventory.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/inventory/PlayerInventory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/PlayerInventory.java
|
|
@@ -0,0 +0,0 @@ public interface PlayerInventory extends Inventory {
|
|
*
|
|
* @return All the ItemStacks from the armor slots. Individual items can be null.
|
|
*/
|
|
- @NotNull
|
|
- public ItemStack[] getArmorContents();
|
|
+ public @Nullable ItemStack @NotNull [] getArmorContents(); // Paper - make array elements nullable instead array
|
|
|
|
/**
|
|
* Get all additional ItemStacks stored in this inventory.
|
|
@@ -0,0 +0,0 @@ public interface PlayerInventory extends Inventory {
|
|
*
|
|
* @return All additional ItemStacks. Individual items can be null.
|
|
*/
|
|
- @NotNull
|
|
- public ItemStack[] getExtraContents();
|
|
+ public @Nullable ItemStack @NotNull [] getExtraContents(); // Paper - make array elements nullable instead array
|
|
|
|
/**
|
|
* Return the ItemStack from the helmet slot
|
|
@@ -0,0 +0,0 @@ public interface PlayerInventory extends Inventory {
|
|
*
|
|
* @param slot the slot to get the ItemStack
|
|
*
|
|
- * @return the ItemStack in the given slot or null if there is not one
|
|
+ * @return the ItemStack in the given slot
|
|
*/
|
|
- @Nullable
|
|
+ @NotNull // Paper
|
|
public ItemStack getItem(@NotNull EquipmentSlot slot);
|
|
|
|
/**
|
|
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
|
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
|
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
|
/**
|
|
* Checks for existence of a localized name.
|
|
*
|
|
+ * @deprecated Use {@link ItemMeta#displayName()} and check if it is instanceof a {@link net.kyori.adventure.text.TranslatableComponent}.
|
|
* @return true if this has a localized name
|
|
*/
|
|
+ @Deprecated // Paper - Deprecate old localized API
|
|
boolean hasLocalizedName();
|
|
|
|
/**
|
|
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
|
* Plugins should check that hasLocalizedName() returns <code>true</code>
|
|
* before calling this method.
|
|
*
|
|
+ * @deprecated Use {@link ItemMeta#displayName()} and cast it to a {@link net.kyori.adventure.text.TranslatableComponent}. No longer used by the client.
|
|
* @return the localized name that is set
|
|
*/
|
|
+ @Deprecated // Paper - Deprecate old localized API
|
|
@NotNull
|
|
String getLocalizedName();
|
|
|
|
/**
|
|
* Sets the localized name.
|
|
*
|
|
+ * @deprecated Use {@link ItemMeta#displayName(Component)} with a {@link net.kyori.adventure.text.TranslatableComponent}. No longer used by the client.
|
|
* @param name the name to set
|
|
*/
|
|
+ @Deprecated // Paper - Deprecate old localized API
|
|
void setLocalizedName(@Nullable String name);
|
|
|
|
/**
|
|
diff --git a/src/main/java/org/bukkit/material/Step.java b/src/main/java/org/bukkit/material/Step.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/material/Step.java
|
|
+++ b/src/main/java/org/bukkit/material/Step.java
|
|
@@ -0,0 +0,0 @@ public class Step extends TexturedMaterial {
|
|
*
|
|
* @deprecated Magic value
|
|
*/
|
|
+ @Deprecated // Paper
|
|
@Override
|
|
protected int getTextureIndex() {
|
|
return getData() & 0x7;
|