Update from upstream SpigotMC

Make "moved too quickly" limit configurable SpigotMC/Spigot@99a0a640e8
Undeprecate Player#updateInventory()V SpigotMC/Spigot@5c32e1cb48
Fetch complete profile for skull items, similarly to TileEntitySkull. SpigotMC/Spigot@33d758773e
Move getDouble into the Spigot Configuration patch SpigotMC/Spigot@b5dd202af1
Add missing particle to particle API SpigotMC/Spigot@273c64bbad
Log debug levels to the log file. SpigotMC/Spigot@348eae75f4
Fix PlayerItemDamageEvent (we already had this #badupstreamrelations) SpigotMC/Spigot@e207ea23cd
Move hopper patch to top for PR180 SpigotMC/Spigot@abb775108d
Don't be so spammy on Java 6 SpigotMC/Spigot@5abb82b1ca
Apply NBTReadLimiter to more things SpigotMC/Spigot@408944e9f5
This commit is contained in:
Zach Brown 2014-07-27 14:14:24 -05:00
parent 0b4479373d
commit b6b4545b44
33 changed files with 476 additions and 35 deletions

View file

@ -147,6 +147,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ HAPPY_VILLAGER("happyVillager", Type.PARTICLE),
+ /**
+ * The smoke particles that appears on blazes, minecarts
+ * with furnaces and fire
+ */
+ LARGE_SMOKE("largesmoke", Type.PARTICLE),
+ /**
+ * The particles generated when a tool breaks.
+ * This particle requires a Material so that the client can select the correct texture.
+ */

View file

@ -49,6 +49,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ method.setAccessible( oldAccessible );
+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.INFO, "Set PluginClassLoader as parallel capable" );
+ }
+ } catch ( NoSuchMethodException ex )
+ {
+ // Ignore
+ } catch ( Exception ex )
+ {
+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, "Error setting PluginClassLoader as parallel capable", ex );

View file

@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: drXor <mcyoung@mit.edu>
Date: Wed, 23 Jul 2014 15:50:36 -0400
Subject: [PATCH] Undeprecate Player#updateInventory()V
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
/**
* Forces an update of the player's entire inventory.
*
- * @deprecated This method should not be relied upon as it is a temporary
- * work-around for a larger, more complicated issue.
*/
- @Deprecated
+ //@Deprecated // Spigot - undeprecate
public void updateInventory();
/**
--

View file

@ -5,6 +5,24 @@ Subject: [PATCH] mc-dev imports
Imported files which are only modified by Spigot, not upstream. Files here should be completely unmodified aside from trivial changes such as adding throws statements to ensure proper compilation. You may need to add unrelated files in order to ensure a compilable result in the face of synthetic methods.
diff --git a/pom.xml b/pom.xml
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/pom.xml
+++ b/pom.xml
@@ -0,0 +0,0 @@
<version>1.3</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.spigotmc</groupId>
+ <artifactId>sneaky-throw</artifactId>
+ <version>1.0</version>
+ <scope>system</scope>
+ <systemPath>${project.basedir}/../SneakyThrow.jar</systemPath>
+ </dependency>
</dependencies>
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
diff --git a/src/main/java/net/minecraft/server/BanEntrySerializer.java b/src/main/java/net/minecraft/server/BanEntrySerializer.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@ -1604,6 +1622,144 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return this.toString();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
@@ -0,0 +0,0 @@
+package net.minecraft.server;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+
+public class NBTCompressedStreamTools {
+
+ public static NBTTagCompound a(InputStream inputstream) {
+ try {
+ DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(inputstream)));
+
+ NBTTagCompound nbttagcompound;
+
+ try {
+ nbttagcompound = a((DataInput) datainputstream, NBTReadLimiter.a);
+ } finally {
+ datainputstream.close();
+ }
+
+ return nbttagcompound;
+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } return null;
+ }
+
+ public static void a(NBTTagCompound nbttagcompound, OutputStream outputstream) {
+ try {
+ DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(outputstream)));
+
+ try {
+ a(nbttagcompound, (DataOutput) dataoutputstream);
+ } finally {
+ dataoutputstream.close();
+ }
+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); }
+ }
+
+ public static NBTTagCompound a(byte[] abyte, NBTReadLimiter nbtreadlimiter) {
+ try {
+ DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(abyte))));
+
+ NBTTagCompound nbttagcompound;
+
+ try {
+ nbttagcompound = a((DataInput) datainputstream, nbtreadlimiter);
+ } finally {
+ datainputstream.close();
+ }
+
+ return nbttagcompound;
+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } return null;
+ }
+
+ public static byte[] a(NBTTagCompound nbttagcompound) {
+ try {
+ ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
+ DataOutputStream dataoutputstream = new DataOutputStream(new GZIPOutputStream(bytearrayoutputstream));
+
+ try {
+ a(nbttagcompound, (DataOutput) dataoutputstream);
+ } finally {
+ dataoutputstream.close();
+ }
+
+ return bytearrayoutputstream.toByteArray();
+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } return null;
+ }
+
+ public static NBTTagCompound a(DataInputStream datainputstream) {
+ return a((DataInput) datainputstream, NBTReadLimiter.a);
+ }
+
+ public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) {
+ try {
+ NBTBase nbtbase = a(datainput, 0, nbtreadlimiter);
+
+ if (nbtbase instanceof NBTTagCompound) {
+ return (NBTTagCompound) nbtbase;
+ } else {
+ throw new IOException("Root tag must be a named compound tag");
+ }
+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } return null;
+ }
+
+ public static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) {
+ a((NBTBase) nbttagcompound, dataoutput);
+ }
+
+ private static void a(NBTBase nbtbase, DataOutput dataoutput) {
+ try {
+ dataoutput.writeByte(nbtbase.getTypeId());
+ if (nbtbase.getTypeId() != 0) {
+ dataoutput.writeUTF("");
+ nbtbase.write(dataoutput);
+ }
+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); }
+ }
+
+ private static NBTBase a(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) {
+ try {
+ byte b0 = datainput.readByte();
+
+ if (b0 == 0) {
+ return new NBTTagEnd();
+ } else {
+ datainput.readUTF();
+ NBTBase nbtbase = NBTBase.createTag(b0);
+
+ try {
+ nbtbase.load(datainput, i, nbtreadlimiter);
+ return nbtbase;
+ } catch (IOException ioexception) {
+ CrashReport crashreport = CrashReport.a(ioexception, "Loading NBT data");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("NBT Tag");
+
+ crashreportsystemdetails.a("Tag name", "[UNNAMED TAG]");
+ crashreportsystemdetails.a("Tag type", Byte.valueOf(b0));
+ throw new ReportedException(crashreport);
+ }
+ }
+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } return null;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NBTTagByteArray.java b/src/main/java/net/minecraft/server/NBTTagByteArray.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@ -3706,4 +3862,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return new WorldGenVillageStart(this.c, this.b, i, j, this.f);
+ }
+}
diff --git a/src/main/resources/org/spigotmc/SneakyThrow.class b/src/main/resources/org/spigotmc/SneakyThrow.class
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 184
zcmX^0Z`VEsW(HjbE=C64;Jnnt?8=agqWp5bEOrKVMh1bb#Ii*FoW#6zegCAa)Z`LI
z2Cm@z(xT*4x6GVWMg|t={1hN1q2Ys22-csNl#^<$83vTfFG|-hF33#JFUd{TN3wyD
ufvp&9A3M-~MFu7YP6iNQ1kxM~Y(Sb7$m0Xjj6j-6Yd=U5$YufY7#IQ5^(s;T
literal 0
HcmV?d00001
--

View file

@ -231,6 +231,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ config.addDefault( path, def );
+ return config.getString( path, config.getString( path ) );
+ }
+
+ private static double getDouble(String path, double def)
+ {
+ config.addDefault( path, def );
+ return config.getDouble( path, config.getDouble( path ) );
+ }
+}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
new file mode 100644

View file

@ -40,4 +40,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return false;
}
}
@@ -0,0 +0,0 @@ public final class ItemStack {
public void damage(int i, EntityLiving entityliving) {
if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) {
if (this.g()) {
- if (this.isDamaged(i, entityliving.aI())) {
+ if (this.isDamaged(i, entityliving.aI(), entityliving)) { // Spigot
entityliving.a(this);
--this.count;
if (entityliving instanceof EntityHuman) {
--

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 18:01:29 +1000
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sun, 27 Jul 2014 14:12:17 -0500
Subject: [PATCH] Allow Disabling of Command Logging
@ -22,14 +22,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -0,0 +0,0 @@ public class SpigotConfig
config.addDefault( path, def );
return config.getString( path, config.getString( path ) );
}
private static double getDouble(String path, double def)
{
- config.addDefault( path, def );
- return config.getDouble( path, config.getDouble( path ) );
+ config.addDefault(path, def);
+ return config.getDouble(path, config.getDouble(path));
+ }
+
+ public static boolean logCommands;
+ private static void logCommands()
+ {
+ logCommands = getBoolean( "commands.log", true );
+ }
}
}
--

View file

@ -4,6 +4,80 @@ Date: Sun, 20 Apr 2014 13:18:55 +0100
Subject: [PATCH] Convert player skulls async
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -0,0 +0,0 @@ public final class ItemStack {
if (nbttagcompound.hasKeyOfType("tag", 10)) {
// CraftBukkit - make defensive copy as this data may be coming from the save thread
this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone();
+ validateSkullSkin(); // Spigot
}
}
+ // Spigot start - make sure the tag is given the full gameprofile if it's a skull (async lookup)
+ public void validateSkullSkin()
+ {
+ if ( this.item == Items.SKULL && this.getData() == 3 )
+ {
+ String owner;
+ if ( this.tag.hasKeyOfType( "SkullOwner", 8 ) )
+ {
+ owner = this.tag.getString( "SkullOwner" );
+ } else if ( this.tag.hasKeyOfType( "SkullOwner", 10 ) )
+ {
+ net.minecraft.util.com.mojang.authlib.GameProfile profile = GameProfileSerializer.deserialize( this.tag.getCompound( "SkullOwner" ) );
+ if ( profile == null || !profile.getProperties().isEmpty() )
+ {
+ return;
+ } else
+ {
+ owner = profile.getName();
+ }
+ } else
+ {
+ return;
+ }
+
+ final String finalOwner = owner;
+ TileEntitySkull.executor.execute( new Runnable()
+ {
+ @Override
+ public void run()
+ {
+
+ final net.minecraft.util.com.mojang.authlib.GameProfile profile = TileEntitySkull.skinCache.getUnchecked( finalOwner.toLowerCase() );
+ if ( profile != null )
+ {
+ MinecraftServer.getServer().processQueue.add( new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ NBTTagCompound nbtProfile = new NBTTagCompound();
+ GameProfileSerializer.serialize( nbtProfile, profile );
+ ItemStack.this.tag.set( "SkullOwner", nbtProfile );
+ }
+ } );
+ }
+ }
+ } );
+ }
+ }
+ // Spigot end
+
public int getMaxStackSize() {
return this.getItem().getMaxStackSize();
}
@@ -0,0 +0,0 @@ public final class ItemStack {
public void setTag(NBTTagCompound nbttagcompound) {
this.tag = nbttagcompound;
+ validateSkullSkin(); // Spigot
}
public String getName() {
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
@ -30,12 +104,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private int i;
private GameProfile j = null;
+ // Spigot start
+ private static final Executor executor = Executors.newFixedThreadPool(3,
+ public static final Executor executor = Executors.newFixedThreadPool(3,
+ new ThreadFactoryBuilder()
+ .setNameFormat("Head Conversion Thread - %1$d")
+ .build()
+ );
+ private static final Cache<String, GameProfile> skinCache = CacheBuilder.newBuilder()
+ public static final Cache<String, GameProfile> skinCache = CacheBuilder.newBuilder()
+ .maximumSize( 5000 )
+ .expireAfterAccess( 60, TimeUnit.MINUTES )
+ .build( new CacheLoader<String, GameProfile>()
@ -120,4 +194,50 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -0,0 +0,0 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
}
@Override
- void applyToItem(NBTTagCompound tag) {
+ void applyToItem(final NBTTagCompound tag) { // Spigot - make final
super.applyToItem(tag);
if (hasOwner()) {
NBTTagCompound owner = new NBTTagCompound();
GameProfileSerializer.serialize(owner, profile);
- tag.set(SKULL_OWNER.NBT, owner);
+ tag.set( SKULL_OWNER.NBT, owner );
+ // Spigot start - do an async lookup of the profile.
+ // Unfortunately there is not way to refresh the holding
+ // inventory, so that responsibility is left to the user.
+ net.minecraft.server.TileEntitySkull.executor.execute( new Runnable()
+ {
+ @Override
+ public void run()
+ {
+
+ final GameProfile profile = net.minecraft.server.TileEntitySkull.skinCache.getUnchecked( CraftMetaSkull.this.profile.getName().toLowerCase() );
+ if ( profile != null )
+ {
+ MinecraftServer.getServer().processQueue.add( new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ NBTTagCompound owner = new NBTTagCompound();
+ GameProfileSerializer.serialize( owner, profile );
+ tag.set( SKULL_OWNER.NBT, owner );
+ }
+ } );
+ }
+ }
+ } );
+ // Spigot end
}
}
--

View file

@ -27,12 +27,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
intCacheLimit = getInt( "settings.int-cache-limit", 1024 );
}
+
+ private static double getDouble(String path, double def)
+ {
+ config.addDefault( path, def );
+ return config.getDouble( path, config.getDouble( path ) );
+ }
+
+ public static double movedWronglyThreshold;
+ private static void movedWronglyThreshold()
+ {

View file

@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jonas Konrad <me@yawk.at>
Date: Tue, 22 Jul 2014 15:59:01 +0200
Subject: [PATCH] Make "moved too quickly" limit configurable
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener {
// CraftBukkit end
double d10 = d7 * d7 + d8 * d8 + d9 * d9;
- if (d10 > 100.0D && this.checkMovement && (!this.minecraftServer.N() || !this.minecraftServer.M().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports
+ // Spigot: make "moved too quickly" limit configurable
+ if (d10 > org.spigotmc.SpigotConfig.movedTooQuicklyThreshold && this.checkMovement && (!this.minecraftServer.N() || !this.minecraftServer.M().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports
c.warn(this.player.getName() + " moved too quickly! " + d4 + "," + d5 + "," + d6 + " (" + d7 + ", " + d8 + ", " + d9 + ")");
this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
return;
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -0,0 +0,0 @@ public class SpigotConfig
{
movedWronglyThreshold = getDouble( "settings.moved-wrongly-threshold", 0.0625D );
}
+
+ public static double movedTooQuicklyThreshold;
+ private static void movedTooQuicklyThreshold()
+ {
+ movedTooQuicklyThreshold = getDouble( "settings.moved-too-quickly-threshold", 100.0D );
+ }
}
--

View file

@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Minecrell <dev@minecrell.net>
Date: Thu, 24 Jul 2014 13:18:36 +0200
Subject: [PATCH] Log debug levels to the log file.
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -0,0 +0,0 @@
</RollingRandomAccessFile>
</Appenders>
<Loggers>
- <Root level="info">
+ <Root level="all">
<filters>
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
</filters>
- <AppenderRef ref="WINDOWS_COMPAT"/>
+ <AppenderRef ref="WINDOWS_COMPAT" level="info"/>
<AppenderRef ref="File"/>
- <AppenderRef ref="TerminalConsole"/>
+ <AppenderRef ref="TerminalConsole" level="info"/>
</Root>
</Loggers>
</Configuration>
--

View file

@ -0,0 +1,65 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 27 Jul 2014 20:46:04 +1000
Subject: [PATCH] Apply NBTReadLimiter to more things.
diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
@@ -0,0 +0,0 @@ public class NBTCompressedStreamTools {
public static NBTTagCompound a(byte[] abyte, NBTReadLimiter nbtreadlimiter) {
try {
- DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(abyte))));
+ DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new org.spigotmc.LimitStream(new GZIPInputStream(new ByteArrayInputStream(abyte)), nbtreadlimiter))); // Spigot
NBTTagCompound nbttagcompound;
diff --git a/src/main/java/org/spigotmc/LimitStream.java b/src/main/java/org/spigotmc/LimitStream.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/spigotmc/LimitStream.java
@@ -0,0 +0,0 @@
+package org.spigotmc;
+
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import net.minecraft.server.NBTReadLimiter;
+
+public class LimitStream extends FilterInputStream
+{
+
+ private final NBTReadLimiter limit;
+
+ public LimitStream(InputStream is, NBTReadLimiter limit)
+ {
+ super( is );
+ this.limit = limit;
+ }
+
+ @Override
+ public int read() throws IOException
+ {
+ limit.a( 1 );
+ return super.read();
+ }
+
+ @Override
+ public int read(byte[] b) throws IOException
+ {
+ limit.a( b.length );
+ return super.read( b );
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException
+ {
+ limit.a( len );
+ return super.read( b, off, len );
+ }
+}
--

BIN
SneakyThrow.jar Normal file

Binary file not shown.

View file

@ -1,21 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Thu, 24 Jul 2014 22:23:38 -0500
Subject: [PATCH] Fix PlayerItemDamageEvent
Taken from SpigotMC/Spigot PR#202
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -0,0 +0,0 @@ public final class ItemStack {
public void damage(int i, EntityLiving entityliving) {
if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) {
if (this.g()) {
- if (this.isDamaged(i, entityliving.aI())) {
+ if (this.isDamaged(i, entityliving.aI(), entityliving)) {
entityliving.a(this);
--this.count;
if (entityliving instanceof EntityHuman) {
--