diff --git a/CraftBukkit-Patches/0002-mc-dev-imports.patch b/CraftBukkit-Patches/0002-mc-dev-imports.patch index 4240794..29197a6 100644 --- a/CraftBukkit-Patches/0002-mc-dev-imports.patch +++ b/CraftBukkit-Patches/0002-mc-dev-imports.patch @@ -1,4 +1,4 @@ -From 118059e072f257722348916e04bfcad42abf20b2 Mon Sep 17 00:00:00 2001 +From 20f805a73e32f1fb0ce46928b921685fbf92661a Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 1 Dec 2013 15:10:48 +1100 Subject: [PATCH] mc-dev imports @@ -2724,213 +2724,6 @@ index 0000000..63c3bf9 + return this.data; + } +} -diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -new file mode 100644 -index 0000000..e34c774 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/NBTTagList.java -@@ -0,0 +1,201 @@ -+package net.minecraft.server; -+ -+import com.google.common.collect.Lists; -+import java.io.DataInput; -+import java.io.DataOutput; -+import java.io.IOException; -+import java.util.Iterator; -+import java.util.List; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+ -+public class NBTTagList extends NBTBase { -+ -+ private static final Logger b = LogManager.getLogger(); -+ private List list = Lists.newArrayList(); -+ private byte type = 0; -+ -+ public NBTTagList() {} -+ -+ void write(DataOutput dataoutput) throws IOException { -+ if (!this.list.isEmpty()) { -+ this.type = ((NBTBase) this.list.get(0)).getTypeId(); -+ } else { -+ this.type = 0; -+ } -+ -+ dataoutput.writeByte(this.type); -+ dataoutput.writeInt(this.list.size()); -+ -+ for (int i = 0; i < this.list.size(); ++i) { -+ ((NBTBase) this.list.get(i)).write(dataoutput); -+ } -+ -+ } -+ -+ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { -+ if (i > 512) { -+ throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512"); -+ } else { -+ nbtreadlimiter.a(8L); -+ this.type = datainput.readByte(); -+ int j = datainput.readInt(); -+ -+ this.list = Lists.newArrayList(); -+ -+ for (int k = 0; k < j; ++k) { -+ NBTBase nbtbase = NBTBase.createTag(this.type); -+ -+ nbtbase.load(datainput, i + 1, nbtreadlimiter); -+ this.list.add(nbtbase); -+ } -+ -+ } -+ } -+ -+ public byte getTypeId() { -+ return (byte) 9; -+ } -+ -+ public String toString() { -+ StringBuilder stringbuilder = new StringBuilder("["); -+ -+ for (int i = 0; i < this.list.size(); ++i) { -+ if (i != 0) { -+ stringbuilder.append(','); -+ } -+ -+ stringbuilder.append(i).append(':').append(this.list.get(i)); -+ } -+ -+ return stringbuilder.append(']').toString(); -+ } -+ -+ public void add(NBTBase nbtbase) { -+ if (this.type == 0) { -+ this.type = nbtbase.getTypeId(); -+ } else if (this.type != nbtbase.getTypeId()) { -+ NBTTagList.b.warn("Adding mismatching tag types to tag list"); -+ return; -+ } -+ -+ this.list.add(nbtbase); -+ } -+ -+ public void a(int i, NBTBase nbtbase) { -+ if (i >= 0 && i < this.list.size()) { -+ if (this.type == 0) { -+ this.type = nbtbase.getTypeId(); -+ } else if (this.type != nbtbase.getTypeId()) { -+ NBTTagList.b.warn("Adding mismatching tag types to tag list"); -+ return; -+ } -+ -+ this.list.set(i, nbtbase); -+ } else { -+ NBTTagList.b.warn("index out of bounds to set tag in tag list"); -+ } -+ } -+ -+ public NBTBase a(int i) { -+ return (NBTBase) this.list.remove(i); -+ } -+ -+ public boolean isEmpty() { -+ return this.list.isEmpty(); -+ } -+ -+ public NBTTagCompound get(int i) { -+ if (i >= 0 && i < this.list.size()) { -+ NBTBase nbtbase = (NBTBase) this.list.get(i); -+ -+ return nbtbase.getTypeId() == 10 ? (NBTTagCompound) nbtbase : new NBTTagCompound(); -+ } else { -+ return new NBTTagCompound(); -+ } -+ } -+ -+ public int[] c(int i) { -+ if (i >= 0 && i < this.list.size()) { -+ NBTBase nbtbase = (NBTBase) this.list.get(i); -+ -+ return nbtbase.getTypeId() == 11 ? ((NBTTagIntArray) nbtbase).c() : new int[0]; -+ } else { -+ return new int[0]; -+ } -+ } -+ -+ public double d(int i) { -+ if (i >= 0 && i < this.list.size()) { -+ NBTBase nbtbase = (NBTBase) this.list.get(i); -+ -+ return nbtbase.getTypeId() == 6 ? ((NBTTagDouble) nbtbase).g() : 0.0D; -+ } else { -+ return 0.0D; -+ } -+ } -+ -+ public float e(int i) { -+ if (i >= 0 && i < this.list.size()) { -+ NBTBase nbtbase = (NBTBase) this.list.get(i); -+ -+ return nbtbase.getTypeId() == 5 ? ((NBTTagFloat) nbtbase).h() : 0.0F; -+ } else { -+ return 0.0F; -+ } -+ } -+ -+ public String getString(int i) { -+ if (i >= 0 && i < this.list.size()) { -+ NBTBase nbtbase = (NBTBase) this.list.get(i); -+ -+ return nbtbase.getTypeId() == 8 ? nbtbase.a_() : nbtbase.toString(); -+ } else { -+ return ""; -+ } -+ } -+ -+ public NBTBase g(int i) { -+ return (NBTBase) (i >= 0 && i < this.list.size() ? (NBTBase) this.list.get(i) : new NBTTagEnd()); -+ } -+ -+ public int size() { -+ return this.list.size(); -+ } -+ -+ public NBTBase clone() { -+ NBTTagList nbttaglist = new NBTTagList(); -+ -+ nbttaglist.type = this.type; -+ Iterator iterator = this.list.iterator(); -+ -+ while (iterator.hasNext()) { -+ NBTBase nbtbase = (NBTBase) iterator.next(); -+ NBTBase nbtbase1 = nbtbase.clone(); -+ -+ nbttaglist.list.add(nbtbase1); -+ } -+ -+ return nbttaglist; -+ } -+ -+ public boolean equals(Object object) { -+ if (super.equals(object)) { -+ NBTTagList nbttaglist = (NBTTagList) object; -+ -+ if (this.type == nbttaglist.type) { -+ return this.list.equals(nbttaglist.list); -+ } -+ } -+ -+ return false; -+ } -+ -+ public int hashCode() { -+ return super.hashCode() ^ this.list.hashCode(); -+ } -+ -+ public int f() { -+ return this.type; -+ } -+} diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java new file mode 100644 index 0000000..648d255 diff --git a/CraftBukkit-Patches/0139-Apply-NBTReadLimiter-to-more-things.patch b/CraftBukkit-Patches/0139-Apply-NBTReadLimiter-to-more-things.patch index c3e8cb7..303064d 100644 --- a/CraftBukkit-Patches/0139-Apply-NBTReadLimiter-to-more-things.patch +++ b/CraftBukkit-Patches/0139-Apply-NBTReadLimiter-to-more-things.patch @@ -1,4 +1,4 @@ -From 0a7fd3a0aff060a3332b562618f35b7b2fbec834 Mon Sep 17 00:00:00 2001 +From e7d565763edc3d546afb355c57042ebc188ce341 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 27 Jul 2014 20:46:04 +1000 Subject: [PATCH] Apply NBTReadLimiter to more things. @@ -21,18 +21,6 @@ index 2a04b86..b2d5254 100644 NBTBase nbtbase = a(datainput, 0, nbtreadlimiter); if (nbtbase instanceof NBTTagCompound) { -diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index e34c774..6d91deb 100644 ---- a/src/main/java/net/minecraft/server/NBTTagList.java -+++ b/src/main/java/net/minecraft/server/NBTTagList.java -@@ -45,6 +45,7 @@ public class NBTTagList extends NBTBase { - - for (int k = 0; k < j; ++k) { - NBTBase nbtbase = NBTBase.createTag(this.type); -+ nbtreadlimiter.a(8); // Spigot - - nbtbase.load(datainput, i + 1, nbtreadlimiter); - this.list.add(nbtbase); diff --git a/src/main/java/org/spigotmc/LimitStream.java b/src/main/java/org/spigotmc/LimitStream.java new file mode 100644 index 0000000..8c32e8b