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

Please note that this build includes changes to meet upstreams
requirements for nullability annotations. While we aim for a level of
accuracy, these might not be 100% correct, if there are any issues,
please speak to us on discord, or open an issue on the tracker to
discuss.

Bukkit Changes:
9a6a1de3 Remove nullability annotations from enum constructors
3f0591ea SPIGOT-2540: Add nullability annotations to entire Bukkit API

CraftBukkit Changes:
8d8475fc SPIGOT-4666: Force parameter in HumanEntity#sleep
8b1588e2 Fix ExplosionPrimeEvent#setFire not working with EnderCrystals
39a287b7 Don't ignore newlines in PlayerListHeader/Footer

Spigot Changes:
cf694d87 Add nullability annotations
This commit is contained in:
Shane Freeder
2019-03-20 00:28:15 +00:00
parent 2b722719b3
commit a7ba5db3de
260 changed files with 2328 additions and 2021 deletions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack API additions for quantity/flags/lore
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 26ab1278..fb47fc29 100644
index 1c7bbbcef..845a9255d 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -0,0 +0,0 @@ package org.bukkit.inventory;
@@ -18,15 +18,6 @@ index 26ab1278..fb47fc29 100644
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
@@ -0,0 +0,0 @@ import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.MaterialData;
+import javax.annotation.Nullable;
+
/**
* Represents a stack of items
*/
@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
// Requires access to NMS
return ensureServerConversions().getMaxItemUseDuration();
@@ -36,6 +27,7 @@ index 26ab1278..fb47fc29 100644
+ * Clones the itemstack and returns it a single quantity.
+ * @return The new itemstack with 1 quantity
+ */
+ @NotNull
+ public ItemStack asOne() {
+ return asQuantity(1);
+ }
@@ -45,6 +37,7 @@ index 26ab1278..fb47fc29 100644
+ * @param qty The quantity of the cloned item
+ * @return The new itemstack with specified quantity
+ */
+ @NotNull
+ public ItemStack asQuantity(int qty) {
+ ItemStack clone = clone();
+ clone.setAmount(qty);
@@ -55,6 +48,7 @@ index 26ab1278..fb47fc29 100644
+ * Adds 1 to this itemstack. Will not go over the items max stack size.
+ * @return The same item (not a clone)
+ */
+ @NotNull
+ public ItemStack add() {
+ return add(1);
+ }
@@ -65,6 +59,7 @@ index 26ab1278..fb47fc29 100644
+ * @param qty The amount to add
+ * @return The same item (not a clone)
+ */
+ @NotNull
+ public ItemStack add(int qty) {
+ setAmount(Math.min(getMaxStackSize(), getAmount() + qty));
+ return this;
@@ -74,6 +69,7 @@ index 26ab1278..fb47fc29 100644
+ * Subtracts 1 to this itemstack. Going to 0 or less will invalidate the item.
+ * @return The same item (not a clone)
+ */
+ @NotNull
+ public ItemStack subtract() {
+ return subtract(1);
+ }
@@ -84,6 +80,7 @@ index 26ab1278..fb47fc29 100644
+ * @param qty The amount to add
+ * @return The same item (not a clone)
+ */
+ @NotNull
+ public ItemStack subtract(int qty) {
+ setAmount(Math.max(0, getAmount() - qty));
+ return this;
@@ -111,7 +108,7 @@ index 26ab1278..fb47fc29 100644
+ *
+ * @param lore the lore that will be set
+ */
+ public void setLore(List<String> lore) {
+ public void setLore(@Nullable List<String> lore) {
+ ItemMeta itemMeta = getItemMeta();
+ itemMeta.setLore(lore);
+ setItemMeta(itemMeta);
@@ -122,7 +119,7 @@ index 26ab1278..fb47fc29 100644
+ *
+ * @param itemFlags The hideflags which shouldn't be rendered
+ */
+ public void addItemFlags(ItemFlag... itemFlags) {
+ public void addItemFlags(@NotNull ItemFlag... itemFlags) {
+ ItemMeta itemMeta = getItemMeta();
+ itemMeta.addItemFlags(itemFlags);
+ setItemMeta(itemMeta);
@@ -133,7 +130,7 @@ index 26ab1278..fb47fc29 100644
+ *
+ * @param itemFlags Hideflags which should be removed
+ */
+ public void removeItemFlags(ItemFlag... itemFlags) {
+ public void removeItemFlags(@NotNull ItemFlag... itemFlags) {
+ ItemMeta itemMeta = getItemMeta();
+ itemMeta.removeItemFlags(itemFlags);
+ setItemMeta(itemMeta);
@@ -144,6 +141,7 @@ index 26ab1278..fb47fc29 100644
+ *
+ * @return A set of all itemFlags set
+ */
+ @NotNull
+ public Set<ItemFlag> getItemFlags() {
+ ItemMeta itemMeta = getItemMeta();
+ return itemMeta.getItemFlags();
@@ -155,7 +153,7 @@ index 26ab1278..fb47fc29 100644
+ * @param flag the flag to check
+ * @return if it is present
+ */
+ public boolean hasItemFlag(ItemFlag flag) {
+ public boolean hasItemFlag(@NotNull ItemFlag flag) {
+ ItemMeta itemMeta = getItemMeta();
+ return itemMeta.hasItemFlag(flag);
+ }