Updated Upstream (CraftBukkit/Spigot)

We pretty much reverted most of Spigots changes here as ours is better.

I guess least Spigot is trying to get closer to us? but missed..

CraftBukkit Changes:
0bf75bbd SPIGOT-4686: Enchantment ordering nondeterministic

Spigot Changes:
f09662d0 Rebuild patches
This commit is contained in:
Aikar 2019-04-02 23:27:20 -04:00
parent 96f8b1af6c
commit e9b353ff02
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
5 changed files with 39 additions and 39 deletions

View file

@ -1,4 +1,4 @@
From ee2d92df4b299fe51ad0ff6a50b52829403e1d2c Mon Sep 17 00:00:00 2001
From e9ff7c6aaa5bb9f3dc8adf8bac2f09b89b0de4ed Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 28 May 2015 23:00:19 -0400
Subject: [PATCH] Handle Item Meta Inconsistencies
@ -201,7 +201,7 @@ index f907d4f3b..eeb2c5689 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 99a2c8c8b..5e823e1b1 100644
index ef6437f38..2508cfcfa 100644
--- a/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;
@ -220,15 +220,15 @@ index 99a2c8c8b..5e823e1b1 100644
import net.minecraft.server.NBTBase;
import net.minecraft.server.NBTTagCompound;
import net.minecraft.server.NBTTagList;
@@ -65,6 +67,7 @@ import java.io.IOException;
import java.util.Arrays;
@@ -66,6 +68,7 @@ import java.util.Arrays;
import java.util.EnumSet;
import java.util.LinkedHashMap;
import java.util.Set;
+import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.server.EnumChatFormat;
@@ -256,7 +259,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -257,7 +260,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
private IChatBaseComponent displayName;
private IChatBaseComponent locName;
private List<String> lore;
@ -237,7 +237,7 @@ index 99a2c8c8b..5e823e1b1 100644
private Multimap<Attribute, AttributeModifier> attributeModifiers;
private int repairCost;
private int hideFlag;
@@ -267,7 +270,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -268,7 +271,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
private static final CraftCustomTagTypeRegistry TAG_TYPE_REGISTRY = new CraftCustomTagTypeRegistry();
private NBTTagCompound internalTag;
@ -246,16 +246,16 @@ index 99a2c8c8b..5e823e1b1 100644
private final CraftCustomItemTagContainer publicItemTagContainer = new CraftCustomItemTagContainer(TAG_TYPE_REGISTRY);
CraftMetaItem(CraftMetaItem meta) {
@@ -283,7 +286,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -284,7 +287,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
}
if (meta.enchantments != null) { // Spigot
- this.enchantments = new HashMap<Enchantment, Integer>(meta.enchantments);
- this.enchantments = new LinkedHashMap<Enchantment, Integer>(meta.enchantments);
+ this.enchantments = new EnchantmentMap(meta.enchantments); // Paper
}
if (meta.hasAttributeModifiers()) {
@@ -366,13 +369,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -367,13 +370,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
}
}
@ -266,12 +266,12 @@ index 99a2c8c8b..5e823e1b1 100644
}
NBTTagList ench = tag.getList(key.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND);
- Map<Enchantment, Integer> enchantments = new HashMap<Enchantment, Integer>(ench.size());
- Map<Enchantment, Integer> enchantments = new LinkedHashMap<Enchantment, Integer>(ench.size());
+ EnchantmentMap enchantments = new EnchantmentMap(); // Paper
for (int i = 0; i < ench.size(); i++) {
String id = ((NBTTagCompound) ench.get(i)).getString(ENCHANTMENTS_ID.NBT);
@@ -514,13 +517,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -515,13 +518,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
}
}
@ -282,12 +282,12 @@ index 99a2c8c8b..5e823e1b1 100644
return null;
}
- Map<Enchantment, Integer> enchantments = new HashMap<Enchantment, Integer>(ench.size());
- Map<Enchantment, Integer> enchantments = new LinkedHashMap<Enchantment, Integer>(ench.size());
+ EnchantmentMap enchantments = new EnchantmentMap(); // Paper
for (Map.Entry<?, ?> entry : ench.entrySet()) {
// Doctor older enchants
String enchantKey = entry.getKey().toString();
@@ -755,13 +758,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -756,13 +759,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
}
public Map<Enchantment, Integer> getEnchants() {
@ -298,21 +298,21 @@ index 99a2c8c8b..5e823e1b1 100644
public boolean addEnchant(Enchantment ench, int level, boolean ignoreRestrictions) {
Validate.notNull(ench, "Enchantment cannot be null");
if (enchantments == null) {
- enchantments = new HashMap<Enchantment, Integer>(4);
- enchantments = new LinkedHashMap<Enchantment, Integer>(4);
+ enchantments = new EnchantmentMap(); // Paper
}
if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) {
@@ -1088,7 +1091,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1089,7 +1092,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
clone.lore = new ArrayList<String>(this.lore);
}
if (this.enchantments != null) {
- clone.enchantments = new HashMap<Enchantment, Integer>(this.enchantments);
- clone.enchantments = new LinkedHashMap<Enchantment, Integer>(this.enchantments);
+ clone.enchantments = new EnchantmentMap(this.enchantments); // Paper
}
if (this.hasAttributeModifiers()) {
clone.attributeModifiers = HashMultimap.create(this.attributeModifiers);
@@ -1294,6 +1297,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1295,6 +1298,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
}
}

View file

@ -1,4 +1,4 @@
From c6493182e686f8709c559c049d181ef5660fb1a4 Mon Sep 17 00:00:00 2001
From 333352ba334991b9539be95219b489c566d95bd9 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 27 Jan 2018 17:04:14 -0500
Subject: [PATCH] Add ArmorStand Item Meta
@ -356,10 +356,10 @@ index 000000000..c00b89c8d
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 5e823e1b1..eaf4cd11c 100644
index 2508cfcfa..570f695d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -155,6 +155,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -156,6 +156,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
.put(CraftMetaCharge.class, "FIREWORK_EFFECT")
.put(CraftMetaKnowledgeBook.class, "KNOWLEDGE_BOOK")
.put(CraftMetaTropicalFishBucket.class, "TROPICAL_FISH_BUCKET")
@ -367,7 +367,7 @@ index 5e823e1b1..eaf4cd11c 100644
.put(CraftMetaItem.class, "UNSPECIFIC")
.build();
@@ -1290,7 +1291,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1291,7 +1292,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
CraftMetaCharge.EXPLOSION.NBT,
CraftMetaBlockState.BLOCK_ENTITY_TAG.NBT,
CraftMetaKnowledgeBook.BOOK_RECIPES.NBT,

View file

@ -1,4 +1,4 @@
From 79274884292748c5830bd23cdd4b329093e56e7e Mon Sep 17 00:00:00 2001
From 7586c4a617d2bfa2125e91fcd391fcefc9fd9d17 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Wed, 12 Sep 2018 18:53:55 +0300
Subject: [PATCH] Implement an API for CanPlaceOn and CanDestroy NBT values
@ -32,10 +32,10 @@ index 8e8390282..f52936581 100644
this.s = this::l;
if (this.i.canRead() && this.i.peek() == '#') {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index eaf4cd11c..be2e736eb 100644
index 570f695d8..ec91ab72d 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -81,6 +81,12 @@ import javax.annotation.Nullable;
@@ -82,6 +82,12 @@ import javax.annotation.Nullable;
import static org.spigotmc.ValidateUtils.*;
// Spigot end
@ -48,7 +48,7 @@ index eaf4cd11c..be2e736eb 100644
/**
* Children must include the following:
*
@@ -256,6 +262,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -257,6 +263,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@Specific(Specific.To.NBT)
static final ItemMetaKey DAMAGE = new ItemMetaKey("Damage");
static final ItemMetaKey BUKKIT_CUSTOM_TAG = new ItemMetaKey("PublicBukkitValues");
@ -59,7 +59,7 @@ index eaf4cd11c..be2e736eb 100644
private IChatBaseComponent displayName;
private IChatBaseComponent locName;
@@ -266,6 +276,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -267,6 +277,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
private int hideFlag;
private boolean unbreakable;
private int damage;
@ -70,7 +70,7 @@ index eaf4cd11c..be2e736eb 100644
private static final Set<String> HANDLED_TAGS = Sets.newHashSet();
private static final CraftCustomTagTypeRegistry TAG_TYPE_REGISTRY = new CraftCustomTagTypeRegistry();
@@ -298,6 +312,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -299,6 +313,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
this.hideFlag = meta.hideFlag;
this.unbreakable = meta.unbreakable;
this.damage = meta.damage;
@ -86,7 +86,7 @@ index eaf4cd11c..be2e736eb 100644
this.unhandledTags.putAll(meta.unhandledTags);
this.publicItemTagContainer.putAll(meta.publicItemTagContainer.getRaw());
@@ -361,6 +384,31 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -362,6 +385,31 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
publicItemTagContainer.put(key, compound.get(key));
}
}
@ -118,7 +118,7 @@ index eaf4cd11c..be2e736eb 100644
Set<String> keys = tag.getKeys();
for (String key : keys) {
@@ -488,6 +536,34 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -489,6 +537,34 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
setDamage(damage);
}
@ -153,7 +153,7 @@ index eaf4cd11c..be2e736eb 100644
String internal = SerializableMeta.getString(map, "internal", true);
if (internal != null) {
ByteArrayInputStream buf = new ByteArrayInputStream(Base64.decodeBase64(internal));
@@ -608,6 +684,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -609,6 +685,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
if (hasDamage()) {
itemTag.setInt(DAMAGE.NBT, damage);
}
@ -177,7 +177,7 @@ index eaf4cd11c..be2e736eb 100644
for (Map.Entry<String, NBTBase> e : unhandledTags.entrySet()) {
itemTag.set(e.getKey(), e.getValue());
@@ -706,7 +799,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -707,7 +800,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@Overridden
boolean isEmpty() {
@ -187,7 +187,7 @@ index eaf4cd11c..be2e736eb 100644
}
public String getDisplayName() {
@@ -1048,7 +1142,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1049,7 +1143,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
&& (this.publicItemTagContainer.equals(that.publicItemTagContainer))
&& (this.hideFlag == that.hideFlag)
&& (this.isUnbreakable() == that.isUnbreakable())
@ -200,7 +200,7 @@ index eaf4cd11c..be2e736eb 100644
}
/**
@@ -1080,6 +1178,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1081,6 +1179,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
hash = 61 * hash + (isUnbreakable() ? 1231 : 1237);
hash = 61 * hash + (hasDamage() ? this.damage : 0);
hash = 61 * hash + (hasAttributeModifiers() ? this.attributeModifiers.hashCode() : 0);
@ -211,7 +211,7 @@ index eaf4cd11c..be2e736eb 100644
return hash;
}
@@ -1100,6 +1202,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1101,6 +1203,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
clone.hideFlag = this.hideFlag;
clone.unbreakable = this.unbreakable;
clone.damage = this.damage;
@ -227,7 +227,7 @@ index eaf4cd11c..be2e736eb 100644
return clone;
} catch (CloneNotSupportedException e) {
throw new Error(e);
@@ -1149,6 +1260,24 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1150,6 +1261,24 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
builder.put(DAMAGE.BUKKIT, damage);
}
@ -252,7 +252,7 @@ index eaf4cd11c..be2e736eb 100644
final Map<String, NBTBase> internalTags = new HashMap<String, NBTBase>(unhandledTags);
serializeInternal(internalTags);
if (!internalTags.isEmpty()) {
@@ -1298,7 +1427,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1299,7 +1428,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
CraftMetaArmorStand.NO_BASE_PLATE.NBT,
CraftMetaArmorStand.SHOW_ARMS.NBT,
CraftMetaArmorStand.SMALL.NBT,
@ -263,7 +263,7 @@ index eaf4cd11c..be2e736eb 100644
// Paper end
));
}
@@ -1345,4 +1476,147 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1346,4 +1477,147 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
return spigot;
}
// Spigot end

@ -1 +1 @@
Subproject commit 4c8327f72112dba222c982259480b1e70893e095
Subproject commit 0bf75bbde2df2a715d0e637e2c8972e904597b99

@ -1 +1 @@
Subproject commit 5629554b031cb43df270e834939ef13cf5e75a4d
Subproject commit f09662d0ea3632c3294c6db86bdcd92f68aac8c2