Upstream merge

This commit is contained in:
Thinkofdeath 2015-04-16 11:19:45 +01:00
parent b5f5886e5b
commit 7230cfe24d
3 changed files with 17 additions and 17 deletions

View File

@ -76,9 +76,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+// Spigot end
+
@DelegateDeserialization(SerializableMeta.class)
class CraftMetaBook extends CraftMetaItem implements BookMeta {
public class CraftMetaBook extends CraftMetaItem implements BookMeta {
static final ItemMetaKey BOOK_TITLE = new ItemMetaKey("title");
@@ -0,0 +0,0 @@ class CraftMetaBook extends CraftMetaItem implements BookMeta {
@@ -0,0 +0,0 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
super(tag);
if (tag.hasKey(BOOK_TITLE.NBT)) {
@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
boolean resolved = false;
@@ -0,0 +0,0 @@ class CraftMetaBook extends CraftMetaItem implements BookMeta {
@@ -0,0 +0,0 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
// Ignore and treat as an old book
}
}
@ -105,9 +105,9 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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.util.HashSet;
import java.util.Set;
import org.bukkit.block.BlockState;
@@ -0,0 +0,0 @@ import java.util.logging.Logger;
import net.minecraft.server.NBTCompressedStreamTools;
import org.apache.commons.codec.binary.Base64;
+// Spigot start
+import static org.spigotmc.ValidateUtils.*;

View File

@ -9,7 +9,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 org.bukkit.block.BlockState;
@@ -0,0 +0,0 @@ import org.apache.commons.codec.binary.Base64;
// Spigot start
import static org.spigotmc.ValidateUtils.*;

View File

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private String displayName;
private List<String> lore;
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
this.attributes = meta.attributes;
this.repairCost = meta.repairCost;
this.hideFlag = meta.hideFlag;
this.unhandledTags.putAll(meta.unhandledTags);
+ spigot.setUnbreakable( meta.spigot.isUnbreakable() ); // Spigot
@ -39,10 +39,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
static Map<Enchantment, Integer> buildEnchantments(NBTTagCompound tag, ItemMetaKey key) {
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
}
}
}
+
+ // Spigot start
+ Boolean unbreakable = SerializableMeta.getObject( Boolean.class, map, UNBREAKABLE.BUKKIT, true );
+ if ( unbreakable != null )
@ -50,9 +49,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ spigot.setUnbreakable( unbreakable );
+ }
+ // Spigot end
}
static Map<Enchantment, Integer> buildEnchantments(Map<String, Object> map, ItemMetaKey key) {
+
String internal = SerializableMeta.getString(map, "internal", true);
if (internal != null) {
ByteArrayInputStream buf = new ByteArrayInputStream(Base64.decodeBase64(internal));
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
}
@ -72,13 +72,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Overridden
boolean isEmpty() {
- return !(hasDisplayName() || hasEnchants() || hasLore() || hasAttributes() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0);
+ return !(hasDisplayName() || hasEnchants() || hasLore() || hasAttributes() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0 || spigot.isUnbreakable()); // Spigot
- return !(hasDisplayName() || hasEnchants() || hasLore() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0);
+ return !(hasDisplayName() || hasEnchants() || hasLore() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0 || spigot.isUnbreakable()); // Spigot
}
public String getDisplayName() {
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
&& (this.hasAttributes() ? that.hasAttributes() && this.attributes.equals(that.attributes) : !that.hasAttributes())
&& (this.hasLore() ? that.hasLore() && this.lore.equals(that.lore) : !that.hasLore())
&& (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost())
&& (this.unhandledTags.equals(that.unhandledTags))
- && (this.hideFlag == that.hideFlag);
@ -117,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ UNBREAKABLE.NBT, // Spigot
DISPLAY.NBT,
REPAIR.NBT,
ATTRIBUTES.NBT,
ENCHANTMENTS.NBT,
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable {
// Spigot start
private final Spigot spigot = new Spigot()