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 a7f1e7efd5
commit 398f6983bd
33 changed files with 506 additions and 64 deletions

View File

@ -1,11 +1,11 @@
From a6da83fdbd71c75c3fc298b878e723aaaab9ee18 Mon Sep 17 00:00:00 2001 From 2cc00cabffae84bcc74ee1c03a646dc92d012fbb 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:57:09 +1000 Date: Sun, 2 Jun 2013 15:57:09 +1000
Subject: [PATCH] Add Particle API Subject: [PATCH] Add Particle API
diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java
index 2474a2d..9964203 100644 index 2474a2d..37f29e2 100644
--- a/src/main/java/org/bukkit/Effect.java --- a/src/main/java/org/bukkit/Effect.java
+++ b/src/main/java/org/bukkit/Effect.java +++ b/src/main/java/org/bukkit/Effect.java
@@ -5,6 +5,7 @@ import java.util.Map; @@ -5,6 +5,7 @@ import java.util.Map;
@ -16,7 +16,7 @@ index 2474a2d..9964203 100644
import org.bukkit.potion.Potion; import org.bukkit.potion.Potion;
/** /**
@@ -79,27 +80,183 @@ public enum Effect { @@ -79,27 +80,188 @@ public enum Effect {
/** /**
* The flames seen on a mobspawner; a visual effect. * The flames seen on a mobspawner; a visual effect.
*/ */
@ -147,6 +147,11 @@ index 2474a2d..9964203 100644
+ */ + */
+ HAPPY_VILLAGER("happyVillager", Type.PARTICLE), + 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. + * The particles generated when a tool breaks.
+ * This particle requires a Material so that the client can select the correct texture. + * This particle requires a Material so that the client can select the correct texture.
+ */ + */
@ -204,7 +209,7 @@ index 2474a2d..9964203 100644
* @deprecated Magic value * @deprecated Magic value
*/ */
@Deprecated @Deprecated
@@ -108,6 +265,15 @@ public enum Effect { @@ -108,6 +270,15 @@ public enum Effect {
} }
/** /**
@ -220,7 +225,7 @@ index 2474a2d..9964203 100644
* @return The type of the effect. * @return The type of the effect.
*/ */
public Type getType() { public Type getType() {
@@ -115,8 +281,7 @@ public enum Effect { @@ -115,8 +286,7 @@ public enum Effect {
} }
/** /**
@ -230,7 +235,7 @@ index 2474a2d..9964203 100644
*/ */
public Class<?> getData() { public Class<?> getData() {
return this.data; return this.data;
@@ -136,12 +301,32 @@ public enum Effect { @@ -136,12 +306,32 @@ public enum Effect {
static { static {
for (Effect effect : values()) { for (Effect effect : values()) {

View File

@ -1,4 +1,4 @@
From 99d279c5236b39c7b1b15807adb06c350d2b2dc3 Mon Sep 17 00:00:00 2001 From b4437c2fd60590de97f4c03a74dc2651e45a5b66 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net> From: md_5 <git@md-5.net>
Date: Wed, 16 Jul 2014 17:24:21 +1000 Date: Wed, 16 Jul 2014 17:24:21 +1000
Subject: [PATCH] Ease ClassLoader Deadlocks Where Possible Subject: [PATCH] Ease ClassLoader Deadlocks Where Possible
@ -19,7 +19,7 @@ index 6611342..a845e81 100644
public static final CustomTimingsHandler pluginParentTimer = new CustomTimingsHandler("** Plugins"); // Spigot public static final CustomTimingsHandler pluginParentTimer = new CustomTimingsHandler("** Plugins"); // Spigot
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
index 13f8633..6890106 100644 index 13f8633..4cffa13 100644
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
@@ -17,7 +17,7 @@ import org.bukkit.plugin.PluginDescriptionFile; @@ -17,7 +17,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
@ -31,7 +31,7 @@ index 13f8633..6890106 100644
private final PluginDescriptionFile description; private final PluginDescriptionFile description;
private final File dataFolder; private final File dataFolder;
private final File file; private final File file;
@@ -25,6 +25,27 @@ final class PluginClassLoader extends URLClassLoader { @@ -25,6 +25,30 @@ final class PluginClassLoader extends URLClassLoader {
private JavaPlugin pluginInit; private JavaPlugin pluginInit;
private IllegalStateException pluginState; private IllegalStateException pluginState;
@ -49,6 +49,9 @@ index 13f8633..6890106 100644
+ method.setAccessible( oldAccessible ); + method.setAccessible( oldAccessible );
+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.INFO, "Set PluginClassLoader as parallel capable" ); + org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.INFO, "Set PluginClassLoader as parallel capable" );
+ } + }
+ } catch ( NoSuchMethodException ex )
+ {
+ // Ignore
+ } catch ( Exception ex ) + } catch ( Exception ex )
+ { + {
+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, "Error setting PluginClassLoader as parallel capable", ex ); + org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, "Error setting PluginClassLoader as parallel capable", ex );

View File

@ -0,0 +1,25 @@
From bfd8aa6acd79658dacc8ee531b048ab2f4b92ac9 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 37c8a58..b2ad5b7 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -333,10 +333,8 @@ 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();
/**
--
1.9.1

View File

@ -1,10 +1,28 @@
From 3396c90bea2a2d2bf1cd932b1355d4545c22ecaa Mon Sep 17 00:00:00 2001 From 7d7028eccdbe9281dbfcc7d294d4ba650acc0ae1 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, 1 Dec 2013 15:10:48 +1100 Date: Sun, 1 Dec 2013 15:10:48 +1100
Subject: [PATCH] mc-dev imports 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. 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 6aeffa8..3c0cdff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,6 +108,13 @@
<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 diff --git a/src/main/java/net/minecraft/server/BanEntrySerializer.java b/src/main/java/net/minecraft/server/BanEntrySerializer.java
new file mode 100644 new file mode 100644
index 0000000..3b4b596 index 0000000..3b4b596
@ -1604,6 +1622,144 @@ index 0000000..af13af5
+ return this.toString(); + 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 0000000..20fe0f1
--- /dev/null
+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
@@ -0,0 +1,132 @@
+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 diff --git a/src/main/java/net/minecraft/server/NBTTagByteArray.java b/src/main/java/net/minecraft/server/NBTTagByteArray.java
new file mode 100644 new file mode 100644
index 0000000..3eeed3e index 0000000..3eeed3e
@ -3706,6 +3862,18 @@ index 0000000..7ca18a1
+ return new WorldGenVillageStart(this.c, this.b, i, j, this.f); + 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..635518693adaeee6f771d2a4c9f92672048a4c4d
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
-- --
1.9.1 1.9.1

View File

@ -1,4 +1,4 @@
From 2d68f826e2ef628afb3b6a375cec19d50c8be8d7 Mon Sep 17 00:00:00 2001 From d86f6761992a8b01d66ef6ab05cf8f860e95281b 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, 7 Jul 2013 09:32:53 +1000 Date: Sun, 7 Jul 2013 09:32:53 +1000
Subject: [PATCH] Spigot Configuration Subject: [PATCH] Spigot Configuration
@ -96,10 +96,10 @@ index eb0b342..d997b48 100644
int pollCount = 0; int pollCount = 0;
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
new file mode 100644 new file mode 100644
index 0000000..a4de4e9 index 0000000..f662b81
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -0,0 +1,132 @@ @@ -0,0 +1,138 @@
+package org.spigotmc; +package org.spigotmc;
+ +
+import com.google.common.base.Throwables; +import com.google.common.base.Throwables;
@ -231,6 +231,12 @@ index 0000000..a4de4e9
+ config.addDefault( path, def ); + config.addDefault( path, def );
+ return config.getString( path, config.getString( path ) ); + 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 diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
new file mode 100644 new file mode 100644

View File

@ -1,11 +1,11 @@
From a7fee6f33394acc942799bac537e7e578fbf1791 Mon Sep 17 00:00:00 2001 From 816009797a85563fe27578d16d24ede5d33f0a6d Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Mon, 4 Mar 2013 18:45:52 +1100 Date: Mon, 4 Mar 2013 18:45:52 +1100
Subject: [PATCH] PlayerItemDamageEvent Subject: [PATCH] PlayerItemDamageEvent
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index c9d74d3..05d7c4e 100644 index c9d74d3..a2ab06a 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java --- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -279,7 +279,13 @@ public final class ItemStack { @@ -279,7 +279,13 @@ public final class ItemStack {
@ -40,6 +40,15 @@ index c9d74d3..05d7c4e 100644
return false; return false;
} }
} }
@@ -307,7 +322,7 @@ 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) {
-- --
1.9.1 1.9.1

View File

@ -1,6 +1,6 @@
From 1c1d6e10d736b880eb6507ed711eda59efb05456 Mon Sep 17 00:00:00 2001 From b60ff81c08ad243e95bb23cf22bf03e73e630068 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: Zach Brown <Zbob750@live.com>
Date: Fri, 21 Jun 2013 18:01:29 +1000 Date: Sun, 27 Jul 2014 14:12:17 -0500
Subject: [PATCH] Allow Disabling of Command Logging Subject: [PATCH] Allow Disabling of Command Logging
@ -18,19 +18,24 @@ index 9596da2..3a24fcd 100644
CraftPlayer player = this.getPlayer(); CraftPlayer player = this.getPlayer();
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index dc4d4b3..a83ee05 100644 index 6dfa8b0..6ea100e 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -142,4 +142,10 @@ public class SpigotConfig @@ -145,7 +145,13 @@ 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; + public static boolean logCommands;
+ private static void logCommands() + private static void logCommands()
+ { + {
+ logCommands = getBoolean( "commands.log", true ); + logCommands = getBoolean( "commands.log", true );
+ } }
} }
-- --
1.9.1 1.9.1

View File

@ -1,11 +1,85 @@
From d23be5d57d15f481f15fe9e3fab86eae8e72836a Mon Sep 17 00:00:00 2001 From 6eaf9a0a9503de652b7a3dfad975c891c09d74ca Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com> From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Sun, 20 Apr 2014 13:18:55 +0100 Date: Sun, 20 Apr 2014 13:18:55 +0100
Subject: [PATCH] Convert player skulls async 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 2723ccb..26f9fae 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -216,9 +216,61 @@ 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();
}
@@ -457,6 +509,7 @@ 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 diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
index 2a50db9..2b59690 100644 index 2a50db9..c95e4c8 100644
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java --- a/src/main/java/net/minecraft/server/TileEntitySkull.java
+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java +++ b/src/main/java/net/minecraft/server/TileEntitySkull.java
@@ -6,11 +6,61 @@ import net.minecraft.util.com.google.common.collect.Iterables; @@ -6,11 +6,61 @@ import net.minecraft.util.com.google.common.collect.Iterables;
@ -30,12 +104,12 @@ index 2a50db9..2b59690 100644
private int i; private int i;
private GameProfile j = null; private GameProfile j = null;
+ // Spigot start + // Spigot start
+ private static final Executor executor = Executors.newFixedThreadPool(3, + public static final Executor executor = Executors.newFixedThreadPool(3,
+ new ThreadFactoryBuilder() + new ThreadFactoryBuilder()
+ .setNameFormat("Head Conversion Thread - %1$d") + .setNameFormat("Head Conversion Thread - %1$d")
+ .build() + .build()
+ ); + );
+ private static final Cache<String, GameProfile> skinCache = CacheBuilder.newBuilder() + public static final Cache<String, GameProfile> skinCache = CacheBuilder.newBuilder()
+ .maximumSize( 5000 ) + .maximumSize( 5000 )
+ .expireAfterAccess( 60, TimeUnit.MINUTES ) + .expireAfterAccess( 60, TimeUnit.MINUTES )
+ .build( new CacheLoader<String, GameProfile>() + .build( new CacheLoader<String, GameProfile>()
@ -120,6 +194,51 @@ index 2a50db9..2b59690 100644
} }
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
index d648d05..e32bcb1 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -46,13 +46,39 @@ 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
}
}
-- --
1.9.1 1.9.1

View File

@ -1,11 +1,11 @@
From 15597ddb21ca4af28df3fef88ed70672dc71cbd2 Mon Sep 17 00:00:00 2001 From 71ccfcaea97281da32267e9e77f7c170912da742 Mon Sep 17 00:00:00 2001
From: Jonas Konrad <me@yawk.at> From: Jonas Konrad <me@yawk.at>
Date: Fri, 4 Jul 2014 23:03:13 +0200 Date: Fri, 4 Jul 2014 23:03:13 +0200
Subject: [PATCH] Make "moved wrongly" limit configurable Subject: [PATCH] Make "moved wrongly" limit configurable
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 9a7b256..f064f6e 100644 index 20c49e3..cd4f0c9 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -399,7 +399,8 @@ public class PlayerConnection implements PacketPlayInListener { @@ -399,7 +399,8 @@ public class PlayerConnection implements PacketPlayInListener {
@ -19,20 +19,14 @@ index 9a7b256..f064f6e 100644
c.warn(this.player.getName() + " moved wrongly!"); c.warn(this.player.getName() + " moved wrongly!");
} }
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 7998aac..2e6e172 100644 index 429ad36..6a230f9 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -327,4 +327,16 @@ public class SpigotConfig @@ -333,4 +333,10 @@ public class SpigotConfig
{ {
intCacheLimit = getInt( "settings.int-cache-limit", 1024 ); 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; + public static double movedWronglyThreshold;
+ private static void movedWronglyThreshold() + private static void movedWronglyThreshold()
+ { + {
@ -41,4 +35,3 @@ index 7998aac..2e6e172 100644
} }
-- --
1.9.1 1.9.1

View File

@ -0,0 +1,37 @@
From 7ff8738025484544f9c23f3ceeda084b78e1dbc2 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 f064f6e..d8f334a 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -371,7 +371,8 @@ 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 2e6e172..6189566 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -339,4 +339,10 @@ 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 );
+ }
}
--
1.9.1

View File

@ -0,0 +1,29 @@
From 46bc58b1fa5b417fdf572b6d9fb3391896a5d36d 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 e2209b8..adc0181 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -14,13 +14,13 @@
</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>
--
1.9.1

View File

@ -0,0 +1,66 @@
From 2058c5a4ca7b63a86f429fbf8fecd75ade24464a 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 20fe0f1..6defdf5 100644
--- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
@@ -46,7 +46,7 @@ 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 0000000..dcc0548
--- /dev/null
+++ b/src/main/java/org/spigotmc/LimitStream.java
@@ -0,0 +1,39 @@
+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 );
+ }
+}
--
1.9.1

BIN
SneakyThrow.jar Normal file

Binary file not shown.

View File

@ -1,23 +0,0 @@
From b8f93f43ea39ca1be0f96207995bee00ead425eb Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.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 2723ccb..569b2e3 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -328,7 +328,7 @@ 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) {
--
1.9.1