[Auto] Updated Upstream (CraftBukkit)

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

CraftBukkit Changes:
fc10dec5 Don't throw error on invalid data in CraftMetaItem.
This commit is contained in:
Aikar 2018-09-23 05:06:41 -04:00
parent 003c0e0766
commit 9787753c4f
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
6 changed files with 23 additions and 93 deletions

View File

@ -1,4 +1,4 @@
From 30ade2c15c450c37075fac67b3a4893d44e61353 Mon Sep 17 00:00:00 2001 From fe9f75e118fe7e2a336fbe522a55caf9ecdb5f74 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 28 May 2015 23:00:19 -0400 Date: Thu, 28 May 2015 23:00:19 -0400
Subject: [PATCH] Handle Item Meta Inconsistencies Subject: [PATCH] Handle Item Meta Inconsistencies
@ -18,7 +18,7 @@ For consistency, the old API methods now forward to use the
ItemMeta API equivalents, and should deprecate the old API's. ItemMeta API equivalents, and should deprecate the old API's.
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 318c4204df..56787ed25c 100644 index 318c4204d..56787ed25 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java --- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -7,6 +7,8 @@ import com.mojang.brigadier.StringReader; @@ -7,6 +7,8 @@ import com.mojang.brigadier.StringReader;
@ -78,7 +78,7 @@ index 318c4204df..56787ed25c 100644
public boolean hasEnchantments() { public boolean hasEnchantments() {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index 1d0580ff7f..2733cda407 100644 index 1d0580ff7..2733cda40 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -4,6 +4,7 @@ import static org.bukkit.craftbukkit.inventory.CraftMetaItem.ENCHANTMENTS; @@ -4,6 +4,7 @@ import static org.bukkit.craftbukkit.inventory.CraftMetaItem.ENCHANTMENTS;
@ -201,7 +201,7 @@ index 1d0580ff7f..2733cda407 100644
static Map<Enchantment, Integer> getEnchantments(net.minecraft.server.ItemStack item) { static Map<Enchantment, Integer> getEnchantments(net.minecraft.server.ItemStack item) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index ae5daa5374..7c9c8d401a 100644 index 99276f116..652866881 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -8,6 +8,7 @@ import java.lang.reflect.Constructor; @@ -8,6 +8,7 @@ import java.lang.reflect.Constructor;
@ -271,7 +271,7 @@ index ae5daa5374..7c9c8d401a 100644
for (int i = 0; i < ench.size(); i++) { for (int i = 0; i < ench.size(); i++) {
String id = ((NBTTagCompound) ench.get(i)).getString(ENCHANTMENTS_ID.NBT); String id = ((NBTTagCompound) ench.get(i)).getString(ENCHANTMENTS_ID.NBT);
@@ -473,13 +476,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -485,13 +488,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
void deserializeInternal(NBTTagCompound tag, Object context) { void deserializeInternal(NBTTagCompound tag, Object context) {
} }
@ -287,7 +287,7 @@ index ae5daa5374..7c9c8d401a 100644
for (Map.Entry<?, ?> entry : ench.entrySet()) { for (Map.Entry<?, ?> entry : ench.entrySet()) {
// Doctor older enchants // Doctor older enchants
String enchantKey = entry.getKey().toString(); String enchantKey = entry.getKey().toString();
@@ -700,13 +703,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -716,13 +719,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
} }
public Map<Enchantment, Integer> getEnchants() { public Map<Enchantment, Integer> getEnchants() {
@ -303,7 +303,7 @@ index ae5daa5374..7c9c8d401a 100644
} }
if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) { if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) {
@@ -1026,7 +1029,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -1042,7 +1045,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
clone.lore = new ArrayList<String>(this.lore); clone.lore = new ArrayList<String>(this.lore);
} }
if (this.enchantments != null) { if (this.enchantments != null) {
@ -312,7 +312,7 @@ index ae5daa5374..7c9c8d401a 100644
} }
if (this.hasAttributeModifiers()) { if (this.hasAttributeModifiers()) {
clone.attributeModifiers = HashMultimap.create(this.attributeModifiers); clone.attributeModifiers = HashMultimap.create(this.attributeModifiers);
@@ -1227,6 +1230,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -1243,6 +1246,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
} }
} }

View File

@ -1,4 +1,4 @@
From 528347621a6b1e6d07a0aeb890805990691b6167 Mon Sep 17 00:00:00 2001 From f6c8bf4768c9cd63fe5525d97e8e44ef826b8833 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 27 Jan 2018 17:04:14 -0500 Date: Sat, 27 Jan 2018 17:04:14 -0500
Subject: [PATCH] Add ArmorStand Item Meta Subject: [PATCH] Add ArmorStand Item Meta
@ -13,7 +13,7 @@ starting point for future additions in this area.
Fixes GH-559 Fixes GH-559
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index caaed7cf0b..2672b004db 100644 index caaed7cf0..2672b004d 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -191,6 +191,8 @@ public final class CraftItemFactory implements ItemFactory { @@ -191,6 +191,8 @@ public final class CraftItemFactory implements ItemFactory {
@ -26,7 +26,7 @@ index caaed7cf0b..2672b004db 100644
case CHEST: case CHEST:
case TRAPPED_CHEST: case TRAPPED_CHEST:
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index 2733cda407..e7daa95078 100644 index 2733cda40..e7daa9507 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -403,6 +403,8 @@ public final class CraftItemStack extends ItemStack { @@ -403,6 +403,8 @@ public final class CraftItemStack extends ItemStack {
@ -40,7 +40,7 @@ index 2733cda407..e7daa95078 100644
case TRAPPED_CHEST: case TRAPPED_CHEST:
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
new file mode 100644 new file mode 100644
index 0000000000..0e8acf12e4 index 000000000..0e8acf12e
--- /dev/null --- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
@@ -0,0 +1,309 @@ @@ -0,0 +1,309 @@
@ -354,7 +354,7 @@ index 0000000000..0e8acf12e4
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 7c9c8d401a..b90a02ef6f 100644 index 652866881..55afe8382 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -152,6 +152,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -152,6 +152,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@ -365,7 +365,7 @@ index 7c9c8d401a..b90a02ef6f 100644
.put(CraftMetaItem.class, "UNSPECIFIC") .put(CraftMetaItem.class, "UNSPECIFIC")
.build(); .build();
@@ -1223,7 +1224,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -1239,7 +1240,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
CraftMetaCharge.EXPLOSION.NBT, CraftMetaCharge.EXPLOSION.NBT,
CraftMetaBlockState.BLOCK_ENTITY_TAG.NBT, CraftMetaBlockState.BLOCK_ENTITY_TAG.NBT,
CraftMetaKnowledgeBook.BOOK_RECIPES.NBT, CraftMetaKnowledgeBook.BOOK_RECIPES.NBT,
@ -383,7 +383,7 @@ index 7c9c8d401a..b90a02ef6f 100644
} }
return HANDLED_TAGS; return HANDLED_TAGS;
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
index 00f89f2296..ef9d40b8a0 100644 index 00f89f229..ef9d40b8a 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
@@ -6,6 +6,7 @@ import static org.hamcrest.Matchers.*; @@ -6,6 +6,7 @@ import static org.hamcrest.Matchers.*;

View File

@ -1,11 +1,11 @@
From fb168424520dbd77c3e78a2d2a5b1c369864a356 Mon Sep 17 00:00:00 2001 From ffd4a2a4222744b839af420ca8d24eddac98dc9b Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu> From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Wed, 12 Sep 2018 18:53:55 +0300 Date: Wed, 12 Sep 2018 18:53:55 +0300
Subject: [PATCH] Implement an API for CanPlaceOn and CanDestroy NBT values Subject: [PATCH] Implement an API for CanPlaceOn and CanDestroy NBT values
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index b90a02ef6f..c9d4d45564 100644 index 55afe8382..d92811925 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -252,6 +252,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -252,6 +252,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@ -67,7 +67,7 @@ index b90a02ef6f..c9d4d45564 100644
Set<String> keys = tag.getKeys(); Set<String> keys = tag.getKeys();
for (String key : keys) { for (String key : keys) {
@@ -567,6 +598,25 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -579,6 +610,25 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
if (hasDamage()) { if (hasDamage()) {
itemTag.setInt(DAMAGE.NBT, damage); itemTag.setInt(DAMAGE.NBT, damage);
} }
@ -93,7 +93,7 @@ index b90a02ef6f..c9d4d45564 100644
for (Map.Entry<String, NBTBase> e : unhandledTags.entrySet()) { for (Map.Entry<String, NBTBase> e : unhandledTags.entrySet()) {
itemTag.set(e.getKey(), e.getValue()); itemTag.set(e.getKey(), e.getValue());
@@ -1231,7 +1281,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -1247,7 +1297,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
CraftMetaArmorStand.NO_BASE_PLATE.NBT, CraftMetaArmorStand.NO_BASE_PLATE.NBT,
CraftMetaArmorStand.SHOW_ARMS.NBT, CraftMetaArmorStand.SHOW_ARMS.NBT,
CraftMetaArmorStand.SMALL.NBT, CraftMetaArmorStand.SMALL.NBT,
@ -104,7 +104,7 @@ index b90a02ef6f..c9d4d45564 100644
// Paper end // Paper end
)); ));
} }
@@ -1278,4 +1330,35 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -1294,4 +1346,35 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
return spigot; return spigot;
} }
// Spigot end // Spigot end

View File

@ -1,4 +1,4 @@
From 62f6c5bbeaf52d39e1009c1c024c1acac9f5926a Mon Sep 17 00:00:00 2001 From 691b112b9931b505d5acb88a4ccdf7e994f03677 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 22 Sep 2018 15:56:59 -0400 Date: Sat, 22 Sep 2018 15:56:59 -0400
Subject: [PATCH] Return null if we get a ParseException in IChatBaseComponent Subject: [PATCH] Return null if we get a ParseException in IChatBaseComponent
@ -16,7 +16,7 @@ Shulkers) may need to be changed in order for it to re-save properly
No more crashing though. No more crashing though.
diff --git a/src/main/java/net/minecraft/server/IChatBaseComponent.java b/src/main/java/net/minecraft/server/IChatBaseComponent.java diff --git a/src/main/java/net/minecraft/server/IChatBaseComponent.java b/src/main/java/net/minecraft/server/IChatBaseComponent.java
index ff14b3e093..03c148f4f6 100644 index ff14b3e09..03c148f4f 100644
--- a/src/main/java/net/minecraft/server/IChatBaseComponent.java --- a/src/main/java/net/minecraft/server/IChatBaseComponent.java
+++ b/src/main/java/net/minecraft/server/IChatBaseComponent.java +++ b/src/main/java/net/minecraft/server/IChatBaseComponent.java
@@ -357,7 +357,15 @@ public interface IChatBaseComponent extends Message, Iterable<IChatBaseComponent @@ -357,7 +357,15 @@ public interface IChatBaseComponent extends Message, Iterable<IChatBaseComponent

View File

@ -1,70 +0,0 @@
From 5832e96cb9edff3b381bb51504a858329da67505 Mon Sep 17 00:00:00 2001
From: Senmori <thesenmori@gmail.com>
Date: Sat, 22 Sep 2018 12:55:43 -0400
Subject: [PATCH] Spigot PR 493
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index c9d4d45564..d928119254 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -423,22 +423,34 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
continue;
}
net.minecraft.server.AttributeModifier nmsModifier = GenericAttributes.a(entry);
- Preconditions.checkNotNull(nmsModifier, "Could not create AttributeModifier. %s", entry.toString());
+ if (nmsModifier == null) {
+ continue;
+ }
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);
String attributeName = entry.getString(ATTRIBUTES_IDENTIFIER.NBT);
- Preconditions.checkArgument(!Strings.isNullOrEmpty(attributeName), "Missing Attribute for AttributeModifier. %s", entry.toString());
+ if (attributeName == null || attributeName.isEmpty()) {
+ continue;
+ }
Attribute attribute = CraftAttributeMap.fromMinecraft(attributeName);
- Preconditions.checkNotNull(attribute, "Could not convert to Bukkit Attribute. %s", attributeName);
+ if (attribute == null) {
+ continue;
+ }
if (entry.hasKeyOfType(ATTRIBUTES_SLOT.NBT, CraftMagicNumbers.NBT.TAG_STRING)) {
String slotName = entry.getString(ATTRIBUTES_SLOT.NBT);
- Preconditions.checkArgument(!Strings.isNullOrEmpty(slotName), "Missing Slot when Slot is specified. %s", entry.toString());
+ if (slotName == null || slotName.isEmpty()) {
+ modifiers.put(attribute, attribMod);
+ continue;
+ }
EquipmentSlot slot = CraftEquipmentSlot.getSlot(EnumItemSlot.a(slotName.toLowerCase(Locale.ROOT))); // PAIL rename fromName
- Preconditions.checkNotNull(slot, "No Slot found when Slot was specified. %s", entry.toString());
+ if (slot == null) {
+ modifiers.put(attribute, attribMod);
+ continue;
+ }
attribMod = new AttributeModifier(attribMod.getUniqueId(), attribMod.getName(), attribMod.getAmount(), attribMod.getOperation(), slot);
}
@@ -667,10 +679,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
}
net.minecraft.server.AttributeModifier nmsModifier = CraftAttributeInstance.convert(entry.getValue());
NBTTagCompound sub = GenericAttributes.a(nmsModifier);
- Preconditions.checkState(!sub.isEmpty(), "Could not convert AttributeModifier. It was supplied in an invalid format. The following was supplied: %s", sub.toString());
+ if (sub.isEmpty()) {
+ continue;
+ }
String name = CraftAttributeMap.toMinecraft(entry.getKey());
- Preconditions.checkArgument(!Strings.isNullOrEmpty(name), "Could not convert to Bukkit Attribute. %s", entry.getKey().name());
+ if (name == null || name.isEmpty()) {
+ continue;
+ }
sub.setString(ATTRIBUTES_IDENTIFIER.NBT, name); // Attribute Name
if (entry.getValue().getSlot() != null) {
--
2.19.0

@ -1 +1 @@
Subproject commit 65bb2d0f7d4d1581a11717784d8c6b6dc023fa91 Subproject commit fc10dec5f369d71a5f0baad17b386ec9706b0773