Upstream merge

This commit is contained in:
Thinkofdeath 2015-03-24 20:45:15 +00:00 committed by Zach Brown
parent 5a49816bef
commit 0b9296ab07
7 changed files with 37 additions and 37 deletions

View File

@ -1,4 +1,4 @@
From 93c1cbc882a2a4e4f98139641e6ac3426eca9234 Mon Sep 17 00:00:00 2001
From 9fcbcf0747c1cadbf81ef239b7d80c46b2ef767d Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 2 Jun 2013 15:10:56 +1000
Subject: [PATCH] Skeleton API Implementations
@ -124,10 +124,10 @@ index 16a35b8..c1879f4 100644
+ // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 9e426ba..661bc0c 100644
index 40d7fca..23cf3b9 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -790,4 +790,16 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -791,4 +791,16 @@ class CraftMetaItem implements ItemMeta, Repairable {
return HANDLED_TAGS;
}
}

View File

@ -1,4 +1,4 @@
From 3a5a748f61e6319b40762319333d5fdde3d9ef1c Mon Sep 17 00:00:00 2001
From 7e85c2452f6b6084557e040e2c4a666da5a9df35 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Mon, 18 Mar 2013 20:01:44 +1100
Subject: [PATCH] Prevent NPE in CraftSign
@ -6,10 +6,10 @@ Subject: [PATCH] Prevent NPE in CraftSign
This commit prevents the constructor of CraftSign throwing an NPE when it cannot get the sign tile entity. Instead it will fallback to a 4 empty lined sign, and not try to do anything to those lines on .update().
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
index 724dbd1..1b603b2 100644
index 42a6f9a..43adfcc 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
@@ -17,6 +17,12 @@ public class CraftSign extends CraftBlockState implements Sign {
@@ -18,6 +18,12 @@ public class CraftSign extends CraftBlockState implements Sign {
CraftWorld world = (CraftWorld) block.getWorld();
sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ());

View File

@ -1,4 +1,4 @@
From 42df9e8c236f49c9ce63b62876e8f5dbb471d4e3 Mon Sep 17 00:00:00 2001
From 933a13f41ae26ebb6b7141b132ba634cf67c2d2a Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Wed, 2 Jul 2014 23:35:51 +0100
Subject: [PATCH] Better item validation
@ -102,12 +102,12 @@ index f23decd..13dbcd4 100644
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 661bc0c..84e6a74 100644
index 23cf3b9..c081ec7 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -42,6 +42,10 @@ import java.util.EnumSet;
import java.util.HashSet;
@@ -43,6 +43,10 @@ import java.util.HashSet;
import java.util.Set;
import org.bukkit.block.BlockState;
+// Spigot start
+import static org.spigotmc.ValidateUtils.*;
@ -116,7 +116,7 @@ index 661bc0c..84e6a74 100644
/**
* Children must include the following:
*
@@ -245,7 +249,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -246,7 +250,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
NBTTagCompound display = tag.getCompound(DISPLAY.NBT);
if (display.hasKey(NAME.NBT)) {
@ -125,7 +125,7 @@ index 661bc0c..84e6a74 100644
}
if (display.hasKey(LORE.NBT)) {
@@ -253,7 +257,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -254,7 +258,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
lore = new ArrayList<String>(list.size());
for (int index = 0; index < list.size(); index++) {

View File

@ -1,4 +1,4 @@
From f5aa4d723af8a14a41081a3b916fc0798507e0c2 Mon Sep 17 00:00:00 2001
From 056a4ee2e6c526f70658fffb78ac14d9e833946b Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Thu, 31 Jul 2014 17:48:20 +0100
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
index 84e6a74..de6056a 100644
index c081ec7..bf5edf8 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -44,6 +44,8 @@ import java.util.Set;
@@ -45,6 +45,8 @@ import org.bukkit.block.BlockState;
// Spigot start
import static org.spigotmc.ValidateUtils.*;
@ -18,7 +18,7 @@ index 84e6a74..de6056a 100644
// Spigot end
/**
@@ -277,6 +279,123 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -278,6 +280,123 @@ class CraftMetaItem implements ItemMeta, Repairable {
NBTTagList save = null;
NBTTagList nbttaglist = tag.getList(ATTRIBUTES.NBT, 10);

View File

@ -1,14 +1,14 @@
From 69c09ff76054402fcfe17ef93f386f7785eaf567 Mon Sep 17 00:00:00 2001
From 25ab3aa7a6ac9c755ba06fee0a7aecd403e5c905 Mon Sep 17 00:00:00 2001
From: drXor <mcyoung@mit.edu>
Date: Fri, 15 Aug 2014 18:11:09 -0400
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
index de6056a..67b7d57 100644
index bf5edf8..60c4bad 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -236,7 +236,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -237,7 +237,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
this.lore = new ArrayList<String>(meta.lore);
}
@ -17,7 +17,7 @@ index de6056a..67b7d57 100644
this.enchantments = new HashMap<Enchantment, Integer>(meta.enchantments);
}
@@ -558,7 +558,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -559,7 +559,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
}
static void applyEnchantments(Map<Enchantment, Integer> enchantments, NBTTagCompound tag, ItemMetaKey key) {
@ -26,7 +26,7 @@ index de6056a..67b7d57 100644
return;
}
@@ -649,7 +649,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -650,7 +650,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
}
public boolean removeEnchant(Enchantment ench) {

View File

@ -1,4 +1,4 @@
From ebae45585337bbf10983356371c04728b8045d48 Mon Sep 17 00:00:00 2001
From 498273bc2b4749b3e7bd54b0c9d9e0310a7035d5 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Tue, 19 Aug 2014 11:04:21 +0100
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
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 67b7d57..fbe1c59 100644
index 60c4bad..9b1ab44 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -460,7 +460,11 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -461,7 +461,11 @@ class CraftMetaItem implements ItemMeta, Repairable {
int id = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_ID.NBT);
int level = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_LVL.NBT);

View File

@ -1,14 +1,14 @@
From 007b98ca7f76e4ee3ae50ccf440b7d6f948eeb8d Mon Sep 17 00:00:00 2001
From f37a3c60fdd30108adc80b683a275a6e5d78cc88 Mon Sep 17 00:00:00 2001
From: libraryaddict <redwarfare@live.com>
Date: Fri, 22 Aug 2014 05:35:16 -0400
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
index fbe1c59..e2d9a7a 100644
index 9b1ab44..bef5ff2 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -212,6 +212,8 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -213,6 +213,8 @@ class CraftMetaItem implements ItemMeta, Repairable {
static final ItemMetaKey ATTRIBUTES_UUID_LOW = new ItemMetaKey("UUIDLeast");
@Specific(Specific.To.NBT)
static final ItemMetaKey HIDEFLAGS = new ItemMetaKey("HideFlags", "ItemFlags");
@ -17,7 +17,7 @@ index fbe1c59..e2d9a7a 100644
private String displayName;
private List<String> lore;
@@ -244,6 +246,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -245,6 +247,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
this.attributes = meta.attributes;
this.hideFlag = meta.hideFlag;
this.unhandledTags.putAll(meta.unhandledTags);
@ -25,7 +25,7 @@ index fbe1c59..e2d9a7a 100644
}
CraftMetaItem(NBTTagCompound tag) {
@@ -446,6 +449,12 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -447,6 +450,12 @@ class CraftMetaItem implements ItemMeta, Repairable {
unhandledTags.put(key, tag.get(key));
}
}
@ -38,7 +38,7 @@ index fbe1c59..e2d9a7a 100644
}
static Map<Enchantment, Integer> buildEnchantments(NBTTagCompound tag, ItemMetaKey key) {
@@ -499,6 +508,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -500,6 +509,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
}
}
}
@ -53,7 +53,7 @@ index fbe1c59..e2d9a7a 100644
}
static Map<Enchantment, Integer> buildEnchantments(Map<String, Object> map, ItemMetaKey key) {
@@ -534,6 +551,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -535,6 +552,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
}
applyEnchantments(enchantments, itemTag, ENCHANTMENTS);
@ -68,7 +68,7 @@ index fbe1c59..e2d9a7a 100644
if (hasRepairCost()) {
itemTag.setInt(REPAIR.NBT, repairCost);
@@ -597,7 +622,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -598,7 +623,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
@Overridden
boolean isEmpty() {
@ -77,7 +77,7 @@ index fbe1c59..e2d9a7a 100644
}
public String getDisplayName() {
@@ -760,7 +785,8 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -761,7 +786,8 @@ class CraftMetaItem implements ItemMeta, Repairable {
&& (this.hasAttributes() ? that.hasAttributes() && this.attributes.equals(that.attributes) : !that.hasAttributes())
&& (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost())
&& (this.unhandledTags.equals(that.unhandledTags))
@ -87,7 +87,7 @@ index fbe1c59..e2d9a7a 100644
}
/**
@@ -788,6 +814,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -789,6 +815,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
hash = 61 * hash + (hasRepairCost() ? this.repairCost : 0);
hash = 61 * hash + unhandledTags.hashCode();
hash = 61 * hash + hideFlag;
@ -95,7 +95,7 @@ index fbe1c59..e2d9a7a 100644
return hash;
}
@@ -831,6 +858,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -832,6 +859,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
if (hasRepairCost()) {
builder.put(REPAIR.BUKKIT, repairCost);
}
@ -110,7 +110,7 @@ index fbe1c59..e2d9a7a 100644
Set<String> hideFlags = new HashSet<String>();
for (ItemFlag hideFlagEnum : getItemFlags()) {
@@ -903,6 +938,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -904,6 +939,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
synchronized (HANDLED_TAGS) {
if (HANDLED_TAGS.isEmpty()) {
HANDLED_TAGS.addAll(Arrays.asList(
@ -118,7 +118,7 @@ index fbe1c59..e2d9a7a 100644
DISPLAY.NBT,
REPAIR.NBT,
ATTRIBUTES.NBT,
@@ -928,6 +964,19 @@ class CraftMetaItem implements ItemMeta, Repairable {
@@ -929,6 +965,19 @@ class CraftMetaItem implements ItemMeta, Repairable {
// Spigot start
private final Spigot spigot = new Spigot()
{