diff --git a/Bukkit-Patches/0002-Spigot-Timings.patch b/Bukkit-Patches/0002-Spigot-Timings.patch index bd8c79105b..432f7203f5 100644 --- a/Bukkit-Patches/0002-Spigot-Timings.patch +++ b/Bukkit-Patches/0002-Spigot-Timings.patch @@ -19,6 +19,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } /** +@@ -0,0 +0,0 @@ public final class Bukkit { + public static UnsafeValues getUnsafe() { + return server.getUnsafe(); + } ++ ++ public static Server.Spigot spigot() ++ { ++ return server.spigot(); ++ } + } +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { + */ + @Deprecated + UnsafeValues getUnsafe(); ++ ++ public class Spigot ++ { ++ ++ public org.bukkit.configuration.file.YamlConfiguration getConfig() ++ { ++ throw new UnsupportedOperationException( "Not supported yet." ); ++ } ++ } ++ ++ Spigot spigot(); + } diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/command/Command.java @@ -142,6 +172,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + CustomTimingsHandler.printTimings(fileTimings); + fileTimings.println( "Sample time " + sampleTime + " (" + sampleTime / 1E9 + "s)" ); + ++ fileTimings.println( "" ); ++ fileTimings.println( Bukkit.spigot().getConfig().saveToString() ); ++ fileTimings.println( "" ); ++ + if ( paste ) + { + new PasteThread( sender, bout ).start(); diff --git a/Bukkit-Patches/0030-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch b/Bukkit-Patches/0030-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch new file mode 100644 index 0000000000..6c912dd5fc --- /dev/null +++ b/Bukkit-Patches/0030-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Fri, 22 Aug 2014 05:31:04 -0400 +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 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable { + */ + boolean hasConflictingEnchant(Enchantment ench); + ++ // Spigot start ++ public class Spigot ++ { ++ ++ /** ++ * Sets the unbreakable tag ++ * ++ * @param unbreakable true if set unbreakable ++ */ ++ public void setUnbreakable(boolean unbreakable) ++ { ++ throw new UnsupportedOperationException( "Not supported yet." ); ++ } ++ ++ /** ++ * Return if the unbreakable tag is true ++ * ++ * @return true if the unbreakable tag is true ++ */ ++ public boolean isUnbreakable() ++ { ++ throw new UnsupportedOperationException( "Not supported yet." ); ++ } ++ } ++ ++ Spigot spigot(); ++ // Spigot end ++ + @SuppressWarnings("javadoc") + ItemMeta clone(); + } +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch b/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch index 56bb57478e..332d8405d7 100644 --- a/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch +++ b/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch @@ -5,6 +5,25 @@ Subject: [PATCH] Skeleton API Implementations This contains the basic, empty implementations for some Spigot-API extensions. They are included early in the patching progress so that compilation will still succeed midway despite the APIs only being provided by subsequent patches. +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -0,0 +0,0 @@ public final class CraftServer implements Server { + public UnsafeValues getUnsafe() { + return CraftMagicNumbers.INSTANCE; + } ++ ++ private final Spigot spigot = new Spigot() ++ { ++ ++ }; ++ ++ public Spigot spigot() ++ { ++ return spigot; ++ } + } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -82,6 +101,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + return spigot; + } ++ // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { + public final String toString() { + return SerializableMeta.classMap.get(getClass()) + "_META:" + serialize(); // TODO: cry + } ++ ++ // Spigot start ++ private final Spigot spigot = new Spigot() ++ { ++ }; ++ ++ @Override ++ public Spigot spigot() ++ { ++ return spigot; ++ } + // Spigot end } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0005-Spigot-Configuration.patch b/CraftBukkit-Patches/0005-Spigot-Configuration.patch index c279b4503b..9961d50ca2 100644 --- a/CraftBukkit-Patches/0005-Spigot-Configuration.patch +++ b/CraftBukkit-Patches/0005-Spigot-Configuration.patch @@ -134,7 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + "IRC: #spigot @ irc.spi.gt ( http://www.spigotmc.org/pages/irc/ )\n" + + "Forums: http://www.spigotmc.org/\n"; + /*========================================================================*/ -+ static YamlConfiguration config; ++ public static YamlConfiguration config; + static int version; + static Map commands; + /*========================================================================*/ @@ -158,8 +158,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + commands = new HashMap(); + -+ version = getInt( "config-version", 6 ); -+ set( "config-version", 6 ); ++ version = getInt( "config-version", 7 ); ++ set( "config-version", 7 ); + readConfig( SpigotConfig.class, null ); + } + diff --git a/CraftBukkit-Patches/0013-Spigot-Timings.patch b/CraftBukkit-Patches/0013-Spigot-Timings.patch index 1b5ce7f43f..04f593699c 100644 --- a/CraftBukkit-Patches/0013-Spigot-Timings.patch +++ b/CraftBukkit-Patches/0013-Spigot-Timings.patch @@ -574,6 +574,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) { +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -0,0 +0,0 @@ public final class CraftServer implements Server { + private final Spigot spigot = new Spigot() + { + ++ @Override ++ public YamlConfiguration getConfig() ++ { ++ return org.spigotmc.SpigotConfig.config; ++ } + }; + + public Spigot spigot() diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/CraftBukkit-Patches/0146-Better-item-validation.patch b/CraftBukkit-Patches/0146-Better-item-validation.patch index b0a8510502..a8245a3621 100644 --- a/CraftBukkit-Patches/0146-Better-item-validation.patch +++ b/CraftBukkit-Patches/0146-Better-item-validation.patch @@ -4,6 +4,50 @@ Date: Wed, 2 Jul 2014 23:35:51 +0100 Subject: [PATCH] Better item validation +diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/DataWatcher.java ++++ b/src/main/java/net/minecraft/server/DataWatcher.java +@@ -0,0 +0,0 @@ public class DataWatcher { + arraylist = new ArrayList(); + } + ++ // Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions ++ if ( watchableobject.b() instanceof ItemStack ) ++ { ++ watchableobject = new WatchableObject( ++ watchableobject.c(), ++ watchableobject.a(), ++ ( (ItemStack) watchableobject.b() ).cloneItemStack() ++ ); ++ } ++ // Spigot end ++ + arraylist.add(watchableobject); + } + } +@@ -0,0 +0,0 @@ public class DataWatcher { + this.f.readLock().lock(); + + arraylist.addAll(this.dataValues.valueCollection()); // Spigot ++ // Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions ++ for ( int i = 0; i < arraylist.size(); i++ ) ++ { ++ WatchableObject watchableobject = (WatchableObject) arraylist.get( i ); ++ if ( watchableobject.b() instanceof ItemStack ) ++ { ++ watchableobject = new WatchableObject( ++ watchableobject.c(), ++ watchableobject.a(), ++ ( (ItemStack) watchableobject.b() ).cloneItemStack() ++ ); ++ arraylist.set( i, watchableobject ); ++ } ++ } ++ // Spigot end + + this.f.readLock().unlock(); + return arraylist; diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java diff --git a/CraftBukkit-Patches/0176-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch b/CraftBukkit-Patches/0176-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch new file mode 100644 index 0000000000..b3f763cd49 --- /dev/null +++ b/CraftBukkit-Patches/0176-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch @@ -0,0 +1,128 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: libraryaddict +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +@@ -0,0 +0,0 @@ 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 UNBREAKABLE = new ItemMetaKey("Unbreakable"); // Spigot + + private String displayName; + private List lore; +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { + + this.repairCost = meta.repairCost; + this.attributes = meta.attributes; ++ spigot.setUnbreakable( meta.spigot.isUnbreakable() ); // Spigot + } + + CraftMetaItem(NBTTagCompound tag) { +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { + } else { + attributes = null; + } ++ // Spigot start ++ if ( tag.hasKey( UNBREAKABLE.NBT ) ) ++ { ++ spigot.setUnbreakable( tag.getBoolean( UNBREAKABLE.NBT ) ); ++ } ++ // Spigot end + } + + static Map buildEnchantments(NBTTagCompound tag, ItemMetaKey key) { +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { + } + + attributes = null; ++ // Spigot start ++ Boolean unbreakable = SerializableMeta.getObject( Boolean.class, map, UNBREAKABLE.BUKKIT, true ); ++ if ( unbreakable != null ) ++ { ++ spigot.setUnbreakable( unbreakable ); ++ } ++ // Spigot end + } + + static Map buildEnchantments(Map map, ItemMetaKey key) { +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { + + applyEnchantments(enchantments, itemTag, ENCHANTMENTS); + ++ // Spigot start ++ if ( spigot.isUnbreakable() ) ++ { ++ itemTag.setBoolean( UNBREAKABLE.NBT, true ); ++ } ++ // Spigot end ++ + if (hasRepairCost()) { + itemTag.setInt(REPAIR.NBT, repairCost); + } +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { + + @Overridden + boolean isEmpty() { +- return !(hasDisplayName() || hasEnchants() || hasLore() || hasAttributes() || hasRepairCost()); ++ return !(hasDisplayName() || hasEnchants() || hasLore() || hasAttributes() || hasRepairCost() || spigot.isUnbreakable()); // Spigot + } + + public String getDisplayName() { +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { + && (this.hasEnchants() ? that.hasEnchants() && this.enchantments.equals(that.enchantments) : !that.hasEnchants()) + && (this.hasLore() ? that.hasLore() && this.lore.equals(that.lore) : !that.hasLore()) + && (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.spigot.isUnbreakable() == that.spigot.isUnbreakable(); // Spigot + } + + /** +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { + hash = 61 * hash + (hasEnchants() ? this.enchantments.hashCode() : 0); + hash = 61 * hash + (hasAttributes() ? this.attributes.hashCode() : 0); + hash = 61 * hash + (hasRepairCost() ? this.repairCost : 0); ++ hash = 61 * hash + (spigot.isUnbreakable() ? 1231 : 1237); // Spigot + return hash; + } + +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { + builder.put(REPAIR.BUKKIT, repairCost); + } + ++ // Spigot start ++ if ( spigot.isUnbreakable() ) ++ { ++ builder.put( UNBREAKABLE.BUKKIT, true ); ++ } ++ // Spigot end ++ + return builder; + } + +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { + // Spigot start + private final Spigot spigot = new Spigot() + { ++ private boolean unbreakable; ++ ++ @Override ++ public void setUnbreakable(boolean setUnbreakable) ++ { ++ unbreakable = setUnbreakable; ++ } ++ ++ @Override ++ public boolean isUnbreakable() ++ { ++ return unbreakable; ++ } + }; + + @Override +-- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-hanging-tick.patch b/CraftBukkit-Patches/0177-Configurable-Hanging-Tick.patch similarity index 54% rename from Spigot-Server-Patches/Configurable-hanging-tick.patch rename to CraftBukkit-Patches/0177-Configurable-Hanging-Tick.patch index 9bfaa4ec5e..00a8d4bc01 100644 --- a/Spigot-Server-Patches/Configurable-hanging-tick.patch +++ b/CraftBukkit-Patches/0177-Configurable-Hanging-Tick.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: drXor -Date: Sat, 9 Aug 2014 17:24:20 -0500 -Subject: [PATCH] Configurable hanging tick +Date: Sat, 9 Aug 2014 13:56:51 -0400 +Subject: [PATCH] Configurable Hanging Tick diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java @@ -13,24 +13,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.lastY = this.locY; this.lastZ = this.locZ; - if (this.e++ == 100 && !this.world.isStatic) { -+ if (this.e++ == this.world.paperSpigotConfig.hangingTickFrequency && !this.world.isStatic) { // PaperSpigot - 100 -> this.world.paperSpigotConfig.hangingTickFrequency ++ if (this.e++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isStatic) { // Spigot - 100 -> this.world.spigotConfig.hangingTickFrequency this.e = 0; if (!this.dead && !this.survives()) { // CraftBukkit start - fire break events -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 ); - log( "Water over lava flow speed: " + waterOverLavaFlowSpeed); +--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java ++++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java +@@ -0,0 +0,0 @@ public class SpigotWorldConfig + maxTntTicksPerTick = getInt( "max-tnt-per-tick", 100 ); + log( "Max TNT Explosions: " + maxTntTicksPerTick ); } + + public int hangingTickFrequency; -+ private void hangingTickSpeed() ++ private void hangingTickFrequency() + { -+ hangingTickFrequency = getInt( "hanging-tick-frequency", 100); -+ log( "Hanging entities tick frequency: " + hangingTickFrequency); ++ hangingTickFrequency = getInt( "hanging-tick-frequency", 100 ); + } } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch b/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch index a745f77534..1f9aedb00c 100644 --- a/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch +++ b/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch @@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java @@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - hangingTickFrequency = getInt( "hanging-tick-frequency", 100); - log( "Hanging entities tick frequency: " + hangingTickFrequency); + waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 ); + log( "Water over lava flow speed: " + waterOverLavaFlowSpeed); } + + public boolean removeInvalidMobSpawnerTEs;