Fix merge conflicts.

This commit is contained in:
md_5 2015-02-15 12:52:33 +11:00 committed by Zach Brown
parent e1a6979f1a
commit 6008bb8fab
7 changed files with 55 additions and 55 deletions

View File

@ -1,17 +1,18 @@
From 2331761cccd87e36c9ca4d2de09ff3e465d8607b Mon Sep 17 00:00:00 2001 From e3bf81b4df9908dc2b0b1e3b4d5e1619a3faa835 Mon Sep 17 00:00:00 2001
From: libraryaddict <redwarfare@live.com> From: libraryaddict <redwarfare@live.com>
Date: Fri, 22 Aug 2014 05:31:04 -0400 Date: Fri, 22 Aug 2014 05:31:04 -0400
Subject: [PATCH] Added isUnbreakable and setUnbreakable to ItemMeta Subject: [PATCH] Added isUnbreakable and setUnbreakable to ItemMeta
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
index 00f71ce..d560bb2 100644 index 459e09c..d8cc821 100644
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
@@ -124,6 +124,34 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable { @@ -157,4 +157,32 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
*/
boolean hasConflictingEnchant(Enchantment ench);
@SuppressWarnings("javadoc")
ItemMeta clone();
+
+ // Spigot start + // Spigot start
+ public class Spigot + public class Spigot
+ { + {
@ -39,9 +40,6 @@ index 00f71ce..d560bb2 100644
+ +
+ Spigot spigot(); + Spigot spigot();
+ // Spigot end + // Spigot end
+
@SuppressWarnings("javadoc")
ItemMeta clone();
} }
-- --
2.1.0 2.1.0

View File

@ -1,4 +1,4 @@
From 3f2bae5366aa36f78b4070aebecd75e9ae8ffb4c Mon Sep 17 00:00:00 2001 From e999c1532150871324ff0b5b1a609a5434249328 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sun, 2 Jun 2013 15:10:56 +1000 Date: Sun, 2 Jun 2013 15:10:56 +1000
Subject: [PATCH] Skeleton API Implementations Subject: [PATCH] Skeleton API Implementations
@ -124,10 +124,10 @@ index 6361b44..fed7b4d 100644
+ // Spigot end + // Spigot end
} }
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 4681262..5d5cb92 100644 index 28871ab..3c98575 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
@@ -715,4 +715,16 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -788,4 +788,16 @@ class CraftMetaItem implements ItemMeta, Repairable {
return HANDLED_TAGS; return HANDLED_TAGS;
} }
} }

View File

@ -1,4 +1,4 @@
From 6ef89fe465bccc2ebe67a7e41d4428c856520a1c Mon Sep 17 00:00:00 2001 From 565d70b386a453ba6fbac0a4e6824f22bf212058 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org> From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Wed, 2 Jul 2014 23:35:51 +0100 Date: Wed, 2 Jul 2014 23:35:51 +0100
Subject: [PATCH] Better item validation Subject: [PATCH] Better item validation
@ -102,11 +102,11 @@ index 42ecde7..47bbcce 100644
} }
} }
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 e80fce2..a4b09fa 100644 index 3c98575..a25de80 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
@@ -39,6 +39,10 @@ import com.google.common.collect.Sets; @@ -42,6 +42,10 @@ import java.util.EnumSet;
import java.util.Arrays; import java.util.HashSet;
import java.util.Set; import java.util.Set;
+// Spigot start +// Spigot start
@ -116,7 +116,7 @@ index e80fce2..a4b09fa 100644
/** /**
* Children must include the following: * Children must include the following:
* *
@@ -238,7 +242,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -245,7 +249,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
NBTTagCompound display = tag.getCompound(DISPLAY.NBT); NBTTagCompound display = tag.getCompound(DISPLAY.NBT);
if (display.hasKey(NAME.NBT)) { if (display.hasKey(NAME.NBT)) {
@ -125,7 +125,7 @@ index e80fce2..a4b09fa 100644
} }
if (display.hasKey(LORE.NBT)) { if (display.hasKey(LORE.NBT)) {
@@ -246,7 +250,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -253,7 +257,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
lore = new ArrayList<String>(list.size()); lore = new ArrayList<String>(list.size());
for (int index = 0; index < list.size(); index++) { for (int index = 0; index < list.size(); index++) {

View File

@ -1,4 +1,4 @@
From 37fb7bb5623fa984c30102af7dd732e698e4e543 Mon Sep 17 00:00:00 2001 From 3fd0d835bdeb86aecfdcdf8cea1cd2abfd873023 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org> From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Thu, 31 Jul 2014 17:48:20 +0100 Date: Thu, 31 Jul 2014 17:48:20 +0100
Subject: [PATCH] Filter attribute modifiers which cause the attribute to go Subject: [PATCH] Filter attribute modifiers which cause the attribute to go
@ -6,10 +6,10 @@ Subject: [PATCH] Filter attribute modifiers which cause the attribute to go
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 cea57d4..02f727a 100644 index a25de80..db59b76 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
@@ -41,6 +41,8 @@ import java.util.Set; @@ -44,6 +44,8 @@ import java.util.Set;
// Spigot start // Spigot start
import static org.spigotmc.ValidateUtils.*; import static org.spigotmc.ValidateUtils.*;
@ -18,7 +18,7 @@ index cea57d4..02f727a 100644
// Spigot end // Spigot end
/** /**
@@ -267,6 +269,123 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -277,6 +279,123 @@ class CraftMetaItem implements ItemMeta, Repairable {
NBTTagList save = null; NBTTagList save = null;
NBTTagList nbttaglist = tag.getList(ATTRIBUTES.NBT, 10); NBTTagList nbttaglist = tag.getList(ATTRIBUTES.NBT, 10);

View File

@ -1,14 +1,14 @@
From 4dd56e8358ed665e09bf8b459e06a77b5bd60999 Mon Sep 17 00:00:00 2001 From 49a7c198c1e8e7c386ea2ebf9150f60542e66708 Mon Sep 17 00:00:00 2001
From: drXor <mcyoung@mit.edu> From: drXor <mcyoung@mit.edu>
Date: Fri, 15 Aug 2014 18:11:09 -0400 Date: Fri, 15 Aug 2014 18:11:09 -0400
Subject: [PATCH] Remove uneeded validation Subject: [PATCH] Remove uneeded validation
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 02f727a..99d3226 100644 index db59b76..4a5b20c 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
@@ -230,7 +230,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -236,7 +236,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
this.lore = new ArrayList<String>(meta.lore); this.lore = new ArrayList<String>(meta.lore);
} }
@ -17,7 +17,7 @@ index 02f727a..99d3226 100644
this.enchantments = new HashMap<Enchantment, Integer>(meta.enchantments); this.enchantments = new HashMap<Enchantment, Integer>(meta.enchantments);
} }
@@ -531,7 +531,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -558,7 +558,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
} }
static void applyEnchantments(Map<Enchantment, Integer> enchantments, NBTTagCompound tag, ItemMetaKey key) { static void applyEnchantments(Map<Enchantment, Integer> enchantments, NBTTagCompound tag, ItemMetaKey key) {
@ -26,7 +26,7 @@ index 02f727a..99d3226 100644
return; return;
} }
@@ -622,7 +622,14 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -649,7 +649,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
} }
public boolean removeEnchant(Enchantment ench) { public boolean removeEnchant(Enchantment ench) {

View File

@ -1,4 +1,4 @@
From a67c0c9c88796b03060c0721a923de982c9cdf0d Mon Sep 17 00:00:00 2001 From d93be2b26b1ef5138a9dc173091c9b0cc934fe14 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org> From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Tue, 19 Aug 2014 11:04:21 +0100 Date: Tue, 19 Aug 2014 11:04:21 +0100
Subject: [PATCH] Skip invalid enchants in CraftMetaItem Subject: [PATCH] Skip invalid enchants in CraftMetaItem
@ -8,10 +8,10 @@ CraftMetaItem would add a null enchantment into the enchantment map which causes
NullPointers later NullPointers later
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 99d3226..e28f077 100644 index 4a5b20c..e6f2df3 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
@@ -450,7 +450,11 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -460,7 +460,11 @@ class CraftMetaItem implements ItemMeta, Repairable {
int id = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_ID.NBT); int id = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_ID.NBT);
int level = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_LVL.NBT); int level = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_LVL.NBT);

View File

@ -1,30 +1,31 @@
From ad306896f643462f28b7e095234c17bf7310bf27 Mon Sep 17 00:00:00 2001 From f397477f238c75e3cd0f7c914af7f69b71e2ff87 Mon Sep 17 00:00:00 2001
From: libraryaddict <redwarfare@live.com> From: libraryaddict <redwarfare@live.com>
Date: Fri, 22 Aug 2014 05:35:16 -0400 Date: Fri, 22 Aug 2014 05:35:16 -0400
Subject: [PATCH] Added isUnbreakable and setUnbreakable to ItemMeta Subject: [PATCH] Added isUnbreakable and setUnbreakable to ItemMeta
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 e28f077..f3f505d 100644 index e6f2df3..e12f636 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
@@ -207,6 +207,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -212,6 +212,8 @@ class CraftMetaItem implements ItemMeta, Repairable {
static final ItemMetaKey ATTRIBUTES_UUID_HIGH = new ItemMetaKey("UUIDMost");
@Specific(Specific.To.NBT)
static final ItemMetaKey ATTRIBUTES_UUID_LOW = new ItemMetaKey("UUIDLeast"); static final ItemMetaKey ATTRIBUTES_UUID_LOW = new ItemMetaKey("UUIDLeast");
@Specific(Specific.To.NBT)
static final ItemMetaKey HIDEFLAGS = new ItemMetaKey("ItemFlags", "hideFlags");
+ @Specific(Specific.To.NBT)
+ static final ItemMetaKey UNBREAKABLE = new ItemMetaKey("Unbreakable"); // Spigot + static final ItemMetaKey UNBREAKABLE = new ItemMetaKey("Unbreakable"); // Spigot
private String displayName; private String displayName;
private List<String> lore; private List<String> lore;
@@ -237,6 +238,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -244,6 +246,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
this.repairCost = meta.repairCost;
this.attributes = meta.attributes; this.attributes = meta.attributes;
this.hideFlag = meta.hideFlag;
this.unhandledTags.putAll(meta.unhandledTags); this.unhandledTags.putAll(meta.unhandledTags);
+ spigot.setUnbreakable( meta.spigot.isUnbreakable() ); // Spigot + spigot.setUnbreakable( meta.spigot.isUnbreakable() ); // Spigot
} }
CraftMetaItem(NBTTagCompound tag) { CraftMetaItem(NBTTagCompound tag) {
@@ -436,6 +438,12 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -446,6 +449,12 @@ class CraftMetaItem implements ItemMeta, Repairable {
unhandledTags.put(key, tag.get(key)); unhandledTags.put(key, tag.get(key));
} }
} }
@ -37,10 +38,11 @@ index e28f077..f3f505d 100644
} }
static Map<Enchantment, Integer> buildEnchantments(NBTTagCompound tag, ItemMetaKey key) { static Map<Enchantment, Integer> buildEnchantments(NBTTagCompound tag, ItemMetaKey key) {
@@ -476,6 +484,13 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -499,6 +508,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
}
}
} }
+
attributes = null;
+ // Spigot start + // Spigot start
+ Boolean unbreakable = SerializableMeta.getObject( Boolean.class, map, UNBREAKABLE.BUKKIT, true ); + Boolean unbreakable = SerializableMeta.getObject( Boolean.class, map, UNBREAKABLE.BUKKIT, true );
+ if ( unbreakable != null ) + if ( unbreakable != null )
@ -51,7 +53,7 @@ index e28f077..f3f505d 100644
} }
static Map<Enchantment, Integer> buildEnchantments(Map<String, Object> map, ItemMetaKey key) { static Map<Enchantment, Integer> buildEnchantments(Map<String, Object> map, ItemMetaKey key) {
@@ -507,6 +522,14 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -534,6 +551,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
} }
applyEnchantments(enchantments, itemTag, ENCHANTMENTS); applyEnchantments(enchantments, itemTag, ENCHANTMENTS);
@ -66,34 +68,34 @@ index e28f077..f3f505d 100644
if (hasRepairCost()) { if (hasRepairCost()) {
itemTag.setInt(REPAIR.NBT, repairCost); itemTag.setInt(REPAIR.NBT, repairCost);
@@ -570,7 +593,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -597,7 +622,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
@Overridden @Overridden
boolean isEmpty() { boolean isEmpty() {
- return !(hasDisplayName() || hasEnchants() || hasLore() || hasAttributes() || hasRepairCost() || !unhandledTags.isEmpty()); - return !(hasDisplayName() || hasEnchants() || hasLore() || hasAttributes() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0);
+ return !(hasDisplayName() || hasEnchants() || hasLore() || hasAttributes() || hasRepairCost() || !unhandledTags.isEmpty() || spigot.isUnbreakable()); // Spigot + return !(hasDisplayName() || hasEnchants() || hasLore() || hasAttributes() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0 || spigot.isUnbreakable()); // Spigot
} }
public String getDisplayName() { public String getDisplayName() {
@@ -695,7 +718,8 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -759,7 +784,8 @@ class CraftMetaItem implements ItemMeta, Repairable {
&& (this.hasLore() ? that.hasLore() && this.lore.equals(that.lore) : !that.hasLore()) && (this.hasLore() ? that.hasLore() && this.lore.equals(that.lore) : !that.hasLore())
&& (this.hasAttributes() ? that.hasAttributes() && this.attributes.equals(that.attributes) : !that.hasAttributes()) && (this.hasAttributes() ? that.hasAttributes() && this.attributes.equals(that.attributes) : !that.hasAttributes())
&& (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost()) && (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost())
- && (this.unhandledTags.equals(that.unhandledTags)); - && (this.hideFlag == that.hideFlag);
+ && (this.unhandledTags.equals(that.unhandledTags)) + && (this.hideFlag == that.hideFlag)
+ && this.spigot.isUnbreakable() == that.spigot.isUnbreakable(); // Spigot + && (this.spigot.isUnbreakable() == that.spigot.isUnbreakable()); // Spigot
} }
/** /**
@@ -722,6 +746,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -786,6 +812,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
hash = 61 * hash + (hasAttributes() ? this.attributes.hashCode() : 0); hash = 61 * hash + (hasAttributes() ? this.attributes.hashCode() : 0);
hash = 61 * hash + (hasRepairCost() ? this.repairCost : 0); hash = 61 * hash + (hasRepairCost() ? this.repairCost : 0);
hash = 61 * hash + unhandledTags.hashCode(); hash = 61 * hash + hideFlag;
+ hash = 61 * hash + (spigot.isUnbreakable() ? 1231 : 1237); // Spigot + hash = 61 * hash + (spigot.isUnbreakable() ? 1231 : 1237); // Spigot
return hash; return hash;
} }
@@ -764,6 +789,14 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -829,6 +856,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
if (hasRepairCost()) { if (hasRepairCost()) {
builder.put(REPAIR.BUKKIT, repairCost); builder.put(REPAIR.BUKKIT, repairCost);
} }
@ -106,9 +108,9 @@ index e28f077..f3f505d 100644
+ // Spigot end + // Spigot end
+ +
return builder; Set<String> hideFlags = new HashSet<String>();
} for (ItemFlag hideFlagEnum : getItemFlags()) {
@@ -828,6 +861,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -901,6 +936,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
synchronized (HANDLED_TAGS) { synchronized (HANDLED_TAGS) {
if (HANDLED_TAGS.isEmpty()) { if (HANDLED_TAGS.isEmpty()) {
HANDLED_TAGS.addAll(Arrays.asList( HANDLED_TAGS.addAll(Arrays.asList(
@ -116,7 +118,7 @@ index e28f077..f3f505d 100644
DISPLAY.NBT, DISPLAY.NBT,
REPAIR.NBT, REPAIR.NBT,
ATTRIBUTES.NBT, ATTRIBUTES.NBT,
@@ -853,6 +887,19 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -926,6 +962,19 @@ class CraftMetaItem implements ItemMeta, Repairable {
// Spigot start // Spigot start
private final Spigot spigot = new Spigot() private final Spigot spigot = new Spigot()
{ {