mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
[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:
parent
116a24f8b0
commit
8407547d57
6 changed files with 11 additions and 79 deletions
|
@ -13,7 +13,7 @@ starting point for future additions in this area.
|
|||
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
|
||||
index caaed7cf0b..2672b004db 100644
|
||||
index caaed7cf0..2672b004d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory {
|
||||
|
@ -26,7 +26,7 @@ index caaed7cf0b..2672b004db 100644
|
|||
case 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
|
||||
index 2733cda407..e7daa95078 100644
|
||||
index 2733cda40..e7daa9507 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack {
|
||||
|
@ -40,7 +40,7 @@ index 2733cda407..e7daa95078 100644
|
|||
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
|
||||
new file mode 100644
|
||||
index 0000000000..0e8acf12e4
|
||||
index 000000000..0e8acf12e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -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
|
||||
index 7c9c8d401a..b90a02ef6f 100644
|
||||
index 652866881..55afe8382 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
|
||||
|
@ -383,7 +383,7 @@ index 7c9c8d401a..b90a02ef6f 100644
|
|||
}
|
||||
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
|
||||
index 00f89f2296..ef9d40b8a0 100644
|
||||
index 00f89f229..ef9d40b8a 100644
|
||||
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
||||
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
||||
@@ -0,0 +0,0 @@ import static org.hamcrest.Matchers.*;
|
||||
|
|
|
@ -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.
|
||||
|
||||
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
|
||||
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ import com.mojang.brigadier.StringReader;
|
||||
|
@ -78,7 +78,7 @@ index 318c4204df..56787ed25c 100644
|
|||
|
||||
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
|
||||
index 1d0580ff7f..2733cda407 100644
|
||||
index 1d0580ff7..2733cda40 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -0,0 +0,0 @@ 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) {
|
||||
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
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -0,0 +0,0 @@ import java.lang.reflect.Constructor;
|
||||
|
|
|
@ -5,7 +5,7 @@ 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
|
||||
index b90a02ef6f..c9d4d45564 100644
|
||||
index 55afe8382..d92811925 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
|
||||
|
|
|
@ -16,7 +16,7 @@ Shulkers) may need to be changed in order for it to re-save properly
|
|||
No more crashing though.
|
||||
|
||||
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
|
||||
+++ b/src/main/java/net/minecraft/server/IChatBaseComponent.java
|
||||
@@ -0,0 +0,0 @@ public interface IChatBaseComponent extends Message, Iterable<IChatBaseComponent
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 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
|
||||
@@ -0,0 +0,0 @@ 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);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ 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) {
|
||||
--
|
|
@ -1 +1 @@
|
|||
Subproject commit 65bb2d0f7d4d1581a11717784d8c6b6dc023fa91
|
||||
Subproject commit fc10dec5f369d71a5f0baad17b386ec9706b0773
|
Loading…
Reference in a new issue