diff --git a/.gitmodules b/.gitmodules index 42c147acb1..394d7b7af0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "Paperclip"] path = Paperclip url = https://github.com/PaperSpigot/Paperclip.git +[submodule "Spigot"] + path = Spigot + url = https://Techcable@hub.spigotmc.org/stash/scm/spigot/spigot.git diff --git a/Bukkit-Patches/0001-POM-Changes.patch b/Bukkit-Patches/0001-POM-Changes.patch deleted file mode 100644 index 4affa52a56..0000000000 --- a/Bukkit-Patches/0001-POM-Changes.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 194ff8ab46d416cfbd1e1c09ae4ea53f84949ab9 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 2 Jun 2013 10:36:24 +1000 -Subject: [PATCH] POM Changes - - -diff --git a/pom.xml b/pom.xml -index 204d681..6377570 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -9,14 +9,14 @@ - 9 - - -- org.bukkit -- bukkit -+ org.spigotmc -+ spigot-api - 1.9-R0.1-SNAPSHOT - jar - -- Bukkit -- http://www.bukkit.org/ -- A plugin API for Minecraft servers. -+ Spigot-API -+ http://www.spigotmc.org/ -+ An enhanced plugin API for Minecraft servers. - - - 1.6 --- -2.5.0 - diff --git a/Bukkit-Patches/0002-Spigot-Timings.patch b/Bukkit-Patches/0002-Spigot-Timings.patch deleted file mode 100644 index 2f587acef5..0000000000 --- a/Bukkit-Patches/0002-Spigot-Timings.patch +++ /dev/null @@ -1,500 +0,0 @@ -From 8d138fbb2a8a9b588e673ee5855e662db585a34d Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 2 Jun 2013 10:42:57 +1000 -Subject: [PATCH] Spigot Timings - -Adds performance tracking timings all around the Minecraft Server, and improves the usability of the /timings command - -Plugins can track their own timings with CustomTimingsHandler - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 2ace8c1..e61e50b 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -546,6 +546,7 @@ public final class Bukkit { - */ - public static void reload() { - server.reload(); -+ org.spigotmc.CustomTimingsHandler.reload(); // Spigot - } - - /** -@@ -1156,4 +1157,9 @@ 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 60bcec8..5ca4321 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -948,4 +948,15 @@ 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 a02c28d..0ba9b1c 100644 ---- a/src/main/java/org/bukkit/command/Command.java -+++ b/src/main/java/org/bukkit/command/Command.java -@@ -31,6 +31,7 @@ public abstract class Command { - protected String usageMessage; - private String permission; - private String permissionMessage; -+ public org.spigotmc.CustomTimingsHandler timings; // Spigot - - protected Command(String name) { - this(name, "", "/" + name, new ArrayList()); -@@ -44,6 +45,7 @@ public abstract class Command { - this.usageMessage = usageMessage; - this.aliases = aliases; - this.activeAliases = new ArrayList(aliases); -+ this.timings = new org.spigotmc.CustomTimingsHandler("** Command: " + name); // Spigot - } - - /** -@@ -227,6 +229,7 @@ public abstract class Command { - public boolean setLabel(String name) { - this.nextLabel = name; - if (!isRegistered()) { -+ this.timings = new org.spigotmc.CustomTimingsHandler("** Command: " + name); // Spigot - this.label = name; - return true; - } -diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index a229d08..a08a49d 100644 ---- a/src/main/java/org/bukkit/command/SimpleCommandMap.java -+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java -@@ -136,11 +136,15 @@ public class SimpleCommandMap implements CommandMap { - } - - try { -+ target.timings.startTiming(); // Spigot - // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false) - target.execute(sender, sentCommandLabel, Arrays_copyOfRange(args, 1, args.length)); -+ target.timings.stopTiming(); // Spigot - } catch (CommandException ex) { -+ target.timings.stopTiming(); // Spigot - throw ex; - } catch (Throwable ex) { -+ target.timings.stopTiming(); // Spigot - throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex); - } - -diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -index a39ea5d..fc59aa3 100644 ---- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -@@ -19,23 +19,101 @@ import org.bukkit.util.StringUtil; - - import com.google.common.collect.ImmutableList; - -+// Spigot start -+import java.io.ByteArrayOutputStream; -+import java.io.OutputStream; -+import java.net.HttpURLConnection; -+import java.net.URL; -+import java.net.URLEncoder; -+import java.util.logging.Level; -+ -+import org.bukkit.command.RemoteConsoleCommandSender; -+import org.bukkit.plugin.SimplePluginManager; -+import org.spigotmc.CustomTimingsHandler; -+// Spigot end -+ - public class TimingsCommand extends BukkitCommand { -- private static final List TIMINGS_SUBCOMMANDS = ImmutableList.of("merged", "reset", "separate"); -+ private static final List TIMINGS_SUBCOMMANDS = ImmutableList.of("report", "reset", "on", "off", "paste"); // Spigot -+ public static long timingStart = 0; // Spigot - - public TimingsCommand(String name) { - super(name); -- this.description = "Records timings for all plugin events"; -- this.usageMessage = "/timings "; -+ this.description = "Manages Spigot Timings data to see performance of the server."; // Spigot -+ this.usageMessage = "/timings "; // Spigot - this.setPermission("bukkit.command.timings"); - } - -+ // Spigot start - redesigned Timings Command -+ public void executeSpigotTimings(CommandSender sender, String[] args) { -+ if ( "on".equals( args[0] ) ) -+ { -+ ( (SimplePluginManager) Bukkit.getPluginManager() ).useTimings( true ); -+ CustomTimingsHandler.reload(); -+ sender.sendMessage( "Enabled Timings & Reset" ); -+ return; -+ } else if ( "off".equals( args[0] ) ) -+ { -+ ( (SimplePluginManager) Bukkit.getPluginManager() ).useTimings( false ); -+ sender.sendMessage( "Disabled Timings" ); -+ return; -+ } -+ -+ if ( !Bukkit.getPluginManager().useTimings() ) -+ { -+ sender.sendMessage( "Please enable timings by typing /timings on" ); -+ return; -+ } -+ -+ boolean paste = "paste".equals( args[0] ); -+ if ("reset".equals(args[0])) { -+ CustomTimingsHandler.reload(); -+ sender.sendMessage("Timings reset"); -+ } else if ("merged".equals(args[0]) || "report".equals(args[0]) || paste) { -+ long sampleTime = System.nanoTime() - timingStart; -+ int index = 0; -+ File timingFolder = new File("timings"); -+ timingFolder.mkdirs(); -+ File timings = new File(timingFolder, "timings.txt"); -+ ByteArrayOutputStream bout = ( paste ) ? new ByteArrayOutputStream() : null; -+ while (timings.exists()) timings = new File(timingFolder, "timings" + (++index) + ".txt"); -+ PrintStream fileTimings = null; -+ try { -+ fileTimings = ( paste ) ? new PrintStream( bout ) : new PrintStream( timings ); -+ -+ 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(); -+ return; -+ } -+ -+ sender.sendMessage("Timings written to " + timings.getPath()); -+ sender.sendMessage( "Paste contents of file into form at http://www.spigotmc.org/go/timings to read results." ); -+ -+ } catch (IOException e) { -+ } finally { -+ if (fileTimings != null) { -+ fileTimings.close(); -+ } -+ } -+ } -+ } -+ // Spigot end -+ - @Override - public boolean execute(CommandSender sender, String currentAlias, String[] args) { - if (!testPermission(sender)) return true; -- if (args.length != 1) { -+ if (args.length < 1) { // Spigot - sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); - return false; - } -+ if (true) { executeSpigotTimings(sender, args); return true; } // Spigot - if (!sender.getServer().getPluginManager().useTimings()) { - sender.sendMessage("Please enable timings by setting \"settings.plugin-profiling\" to true in bukkit.yml"); - return true; -@@ -121,4 +199,55 @@ public class TimingsCommand extends BukkitCommand { - } - return ImmutableList.of(); - } -+ -+ // Spigot start -+ private static class PasteThread extends Thread -+ { -+ -+ private final CommandSender sender; -+ private final ByteArrayOutputStream bout; -+ -+ public PasteThread(CommandSender sender, ByteArrayOutputStream bout) -+ { -+ super( "Timings paste thread" ); -+ this.sender = sender; -+ this.bout = bout; -+ } -+ -+ @Override -+ public synchronized void start() { -+ if (sender instanceof RemoteConsoleCommandSender) { -+ run(); -+ } else { -+ super.start(); -+ } -+ } -+ -+ @Override -+ public void run() -+ { -+ try -+ { -+ HttpURLConnection con = (HttpURLConnection) new URL( "http://paste.ubuntu.com/" ).openConnection(); -+ con.setDoOutput( true ); -+ con.setRequestMethod( "POST" ); -+ con.setInstanceFollowRedirects( false ); -+ -+ OutputStream out = con.getOutputStream(); -+ out.write( "poster=Spigot&syntax=text&content=".getBytes( "UTF-8" ) ); -+ out.write( URLEncoder.encode( bout.toString( "UTF-8" ), "UTF-8" ).getBytes( "UTF-8" ) ); -+ out.close(); -+ con.getInputStream().close(); -+ -+ String location = con.getHeaderField( "Location" ); -+ String pasteID = location.substring( "http://paste.ubuntu.com/".length(), location.length() - 1 ); -+ sender.sendMessage( ChatColor.GREEN + "Timings results can be viewed at http://www.spigotmc.org/go/timings?url=" + pasteID ); -+ } catch ( IOException ex ) -+ { -+ sender.sendMessage( ChatColor.RED + "Error pasting timings, check your console for more information" ); -+ Bukkit.getServer().getLogger().log( Level.WARNING, "Could not paste timings", ex ); -+ } -+ } -+ } -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 5a9e50d..c9d23d6 100644 ---- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java -+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -295,6 +295,7 @@ public final class SimplePluginManager implements PluginManager { - } - } - -+ org.bukkit.command.defaults.TimingsCommand.timingStart = System.nanoTime(); // Spigot - return result.toArray(new Plugin[result.size()]); - } - -diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 2118771..cd843f4 100644 ---- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -39,6 +39,7 @@ import org.bukkit.plugin.PluginLoader; - import org.bukkit.plugin.RegisteredListener; - import org.bukkit.plugin.TimedRegisteredListener; - import org.bukkit.plugin.UnknownDependencyException; -+import org.spigotmc.CustomTimingsHandler; // Spigot - import org.yaml.snakeyaml.error.YAMLException; - - /** -@@ -49,6 +50,7 @@ public final class JavaPluginLoader implements PluginLoader { - private final Pattern[] fileFilters = new Pattern[] { Pattern.compile("\\.jar$"), }; - private final Map> classes = new HashMap>(); - private final Map loaders = new LinkedHashMap(); -+ public static final CustomTimingsHandler pluginParentTimer = new CustomTimingsHandler("** Plugins"); // Spigot - - /** - * This class was not meant to be constructed explicitly -@@ -291,13 +293,19 @@ public final class JavaPluginLoader implements PluginLoader { - } - } - -+ final CustomTimingsHandler timings = new CustomTimingsHandler("Plugin: " + plugin.getDescription().getFullName() + " Event: " + listener.getClass().getName() + "::" + method.getName()+"("+eventClass.getSimpleName()+")", pluginParentTimer); // Spigot - EventExecutor executor = new EventExecutor() { - public void execute(Listener listener, Event event) throws EventException { - try { - if (!eventClass.isAssignableFrom(event.getClass())) { - return; - } -+ // Spigot start -+ boolean isAsync = event.isAsynchronous(); -+ if (!isAsync) timings.startTiming(); - method.invoke(listener, event); -+ if (!isAsync) timings.stopTiming(); -+ // Spigot end - } catch (InvocationTargetException ex) { - throw new EventException(ex.getCause()); - } catch (Throwable t) { -@@ -305,7 +313,7 @@ public final class JavaPluginLoader implements PluginLoader { - } - } - }; -- if (useTimings) { -+ if (false) { // Spigot - RL handles useTimings check now - eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); - } else { - eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); -diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java -new file mode 100644 -index 0000000..8d98297 ---- /dev/null -+++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java -@@ -0,0 +1,165 @@ -+package org.spigotmc; -+ -+import org.bukkit.command.defaults.TimingsCommand; -+import org.bukkit.event.HandlerList; -+import org.bukkit.plugin.Plugin; -+import org.bukkit.plugin.RegisteredListener; -+import org.bukkit.plugin.TimedRegisteredListener; -+import java.io.PrintStream; -+import java.util.Collection; -+import java.util.HashSet; -+import java.util.List; -+import java.util.Queue; -+import java.util.concurrent.ConcurrentLinkedQueue; -+ -+import org.bukkit.Bukkit; -+import org.bukkit.World; -+ -+/** -+ * Provides custom timing sections for /timings merged. -+ */ -+public class CustomTimingsHandler -+{ -+ -+ private static Queue HANDLERS = new ConcurrentLinkedQueue(); -+ /*========================================================================*/ -+ private final String name; -+ private final CustomTimingsHandler parent; -+ private long count = 0; -+ private long start = 0; -+ private long timingDepth = 0; -+ private long totalTime = 0; -+ private long curTickTotal = 0; -+ private long violations = 0; -+ -+ public CustomTimingsHandler(String name) -+ { -+ this( name, null ); -+ } -+ -+ public CustomTimingsHandler(String name, CustomTimingsHandler parent) -+ { -+ this.name = name; -+ this.parent = parent; -+ HANDLERS.add( this ); -+ } -+ -+ /** -+ * Prints the timings and extra data to the given stream. -+ * -+ * @param printStream -+ */ -+ public static void printTimings(PrintStream printStream) -+ { -+ printStream.println( "Minecraft" ); -+ for ( CustomTimingsHandler timings : HANDLERS ) -+ { -+ long time = timings.totalTime; -+ long count = timings.count; -+ if ( count == 0 ) -+ { -+ continue; -+ } -+ long avg = time / count; -+ -+ printStream.println( " " + timings.name + " Time: " + time + " Count: " + count + " Avg: " + avg + " Violations: " + timings.violations ); -+ } -+ printStream.println( "# Version " + Bukkit.getVersion() ); -+ int entities = 0; -+ int livingEntities = 0; -+ for ( World world : Bukkit.getWorlds() ) -+ { -+ entities += world.getEntities().size(); -+ livingEntities += world.getLivingEntities().size(); -+ } -+ printStream.println( "# Entities " + entities ); -+ printStream.println( "# LivingEntities " + livingEntities ); -+ } -+ -+ /** -+ * Resets all timings. -+ */ -+ public static void reload() -+ { -+ if ( Bukkit.getPluginManager().useTimings() ) -+ { -+ for ( CustomTimingsHandler timings : HANDLERS ) -+ { -+ timings.reset(); -+ } -+ } -+ TimingsCommand.timingStart = System.nanoTime(); -+ } -+ -+ /** -+ * Ticked every tick by CraftBukkit to count the number of times a timer -+ * caused TPS loss. -+ */ -+ public static void tick() -+ { -+ if ( Bukkit.getPluginManager().useTimings() ) -+ { -+ for ( CustomTimingsHandler timings : HANDLERS ) -+ { -+ if ( timings.curTickTotal > 50000000 ) -+ { -+ timings.violations += Math.ceil( timings.curTickTotal / 50000000 ); -+ } -+ timings.curTickTotal = 0; -+ timings.timingDepth = 0; // incase reset messes this up -+ } -+ } -+ } -+ -+ /** -+ * Starts timing to track a section of code. -+ */ -+ public void startTiming() -+ { -+ // If second condtion fails we are already timing -+ if ( Bukkit.getPluginManager().useTimings() && ++timingDepth == 1 ) -+ { -+ start = System.nanoTime(); -+ if ( parent != null && ++parent.timingDepth == 1 ) -+ { -+ parent.start = start; -+ } -+ } -+ } -+ -+ /** -+ * Stops timing a section of code. -+ */ -+ public void stopTiming() -+ { -+ if ( Bukkit.getPluginManager().useTimings() ) -+ { -+ if ( --timingDepth != 0 || start == 0 ) -+ { -+ return; -+ } -+ long diff = System.nanoTime() - start; -+ totalTime += diff; -+ curTickTotal += diff; -+ count++; -+ start = 0; -+ if ( parent != null ) -+ { -+ parent.stopTiming(); -+ } -+ } -+ } -+ -+ /** -+ * Reset this timer, setting all values to zero. -+ */ -+ public void reset() -+ { -+ count = 0; -+ violations = 0; -+ curTickTotal = 0; -+ totalTime = 0; -+ start = 0; -+ timingDepth = 0; -+ } -+} --- -2.5.0 - diff --git a/Bukkit-Patches/0003-Add-PlayerItemDamageEvent.patch b/Bukkit-Patches/0003-Add-PlayerItemDamageEvent.patch deleted file mode 100644 index 7ab6ed5970..0000000000 --- a/Bukkit-Patches/0003-Add-PlayerItemDamageEvent.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 4523472589759a21480748098592974ad2792e03 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 4 Mar 2013 18:31:20 +1100 -Subject: [PATCH] Add PlayerItemDamageEvent - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java -new file mode 100644 -index 0000000..38a72ab ---- /dev/null -+++ b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java -@@ -0,0 +1,54 @@ -+package org.bukkit.event.player; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.inventory.ItemStack; -+ -+public class PlayerItemDamageEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList handlers = new HandlerList(); -+ private final ItemStack item; -+ private int damage; -+ private boolean cancelled = false; -+ -+ public PlayerItemDamageEvent(Player player, ItemStack what, int damage) { -+ super(player); -+ this.item = what; -+ this.damage = damage; -+ } -+ -+ public ItemStack getItem() { -+ return item; -+ } -+ -+ /** -+ * Gets the amount of durability damage this item will be taking. -+ * -+ * @return durability change -+ */ -+ public int getDamage() { -+ return damage; -+ } -+ -+ public void setDamage(int damage) { -+ this.damage = damage; -+ } -+ -+ public boolean isCancelled() { -+ return cancelled; -+ } -+ -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return handlers; -+ } -+} --- -2.5.0 - diff --git a/Bukkit-Patches/0004-BungeeCord-Support.patch b/Bukkit-Patches/0004-BungeeCord-Support.patch deleted file mode 100644 index 2d53a82990..0000000000 --- a/Bukkit-Patches/0004-BungeeCord-Support.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 0b286d348e11792e7da9b19a7fd02e623ed52aca Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 2 Jun 2013 15:20:49 +1000 -Subject: [PATCH] BungeeCord Support - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 723464b..6444fdf 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1272,4 +1272,22 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - */ - public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data); - -+ // Spigot start -+ public class Spigot extends Entity.Spigot -+ { -+ -+ /** -+ * Gets the connection address of this player, regardless of whether it -+ * has been spoofed or not. -+ * -+ * @return the player's connection address -+ */ -+ public InetSocketAddress getRawAddress() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ } -+ -+ Spigot spigot(); -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java -index 68834dd..4bc024f 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java -@@ -14,6 +14,7 @@ public class PlayerLoginEvent extends PlayerEvent { - private final String hostname; - private Result result = Result.ALLOWED; - private String message = ""; -+ private final InetAddress realAddress; // Spigot - - /** - * @deprecated Address should be provided in other constructor -@@ -43,10 +44,17 @@ public class PlayerLoginEvent extends PlayerEvent { - * @param address The address the player used to connect, provided for - * timing issues - */ -- public PlayerLoginEvent(final Player player, final String hostname, final InetAddress address) { -+ public PlayerLoginEvent(final Player player, final String hostname, final InetAddress address, final InetAddress realAddress) { // Spigot - super(player); - this.hostname = hostname; - this.address = address; -+ // Spigot start -+ this.realAddress = realAddress; -+ } -+ -+ public PlayerLoginEvent(final Player player, final String hostname, final InetAddress address) { -+ this(player, hostname, address, address); -+ // Spigot end - } - - /** -@@ -58,7 +66,7 @@ public class PlayerLoginEvent extends PlayerEvent { - */ - @Deprecated - public PlayerLoginEvent(final Player player, final Result result, final String message) { -- this(player, "", null, result, message); -+ this(player, "", null, result, message, null); // Spigot - } - - /** -@@ -71,12 +79,23 @@ public class PlayerLoginEvent extends PlayerEvent { - * @param result The result status for this event - * @param message The message to be displayed if result denies login - */ -- public PlayerLoginEvent(final Player player, String hostname, final InetAddress address, final Result result, final String message) { -- this(player, hostname, address); -+ public PlayerLoginEvent(final Player player, String hostname, final InetAddress address, final Result result, final String message, final InetAddress realAddress) { // Spigot -+ this(player, hostname, address, realAddress); // Spigot - this.result = result; - this.message = message; - } - -+ // Spigot start -+ /** -+ * Gets the connection address of this player, regardless of whether it has been spoofed or not. -+ * -+ * @return the player's connection address -+ */ -+ public InetAddress getRealAddress() { -+ return realAddress; -+ } -+ // Spigot end -+ - /** - * Gets the current result of the login, as an enum - * --- -2.5.0 - diff --git a/Bukkit-Patches/0005-Add-Arrow-API.patch b/Bukkit-Patches/0005-Add-Arrow-API.patch deleted file mode 100644 index ab61ab981b..0000000000 --- a/Bukkit-Patches/0005-Add-Arrow-API.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 161c7845321df654c9e26e47f251fa6c3997f82c Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 2 Jun 2013 15:08:24 +1000 -Subject: [PATCH] Add Arrow API - - -diff --git a/src/main/java/org/bukkit/entity/Arrow.java b/src/main/java/org/bukkit/entity/Arrow.java -index e49eef0..e7a32f7 100644 ---- a/src/main/java/org/bukkit/entity/Arrow.java -+++ b/src/main/java/org/bukkit/entity/Arrow.java -@@ -39,4 +39,20 @@ public interface Arrow extends Projectile { - * @param critical whether or not it should be critical - */ - public void setCritical(boolean critical); -+ -+ public class Spigot extends Entity.Spigot -+ { -+ -+ public double getDamage() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ public void setDamage(double damage) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ } -+ -+ Spigot spigot(); - } --- -2.5.0 - diff --git a/Bukkit-Patches/0006-Add-Particle-API.patch b/Bukkit-Patches/0006-Add-Particle-API.patch deleted file mode 100644 index 8ff6fc98d4..0000000000 --- a/Bukkit-Patches/0006-Add-Particle-API.patch +++ /dev/null @@ -1,369 +0,0 @@ -From 6a7d6bd4e8e3175db58638c137135ed21d50fefa Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 2 Jun 2013 15:57:09 +1000 -Subject: [PATCH] Add Particle API - - -diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java -index fe29e1c..f28fecd 100644 ---- a/src/main/java/org/bukkit/Effect.java -+++ b/src/main/java/org/bukkit/Effect.java -@@ -5,6 +5,7 @@ import java.util.Map; - import com.google.common.collect.Maps; - - import org.bukkit.block.BlockFace; -+import org.bukkit.material.MaterialData; - import org.bukkit.potion.Potion; - - /** -@@ -79,27 +80,188 @@ public enum Effect { - /** - * The flames seen on a mobspawner; a visual effect. - */ -- MOBSPAWNER_FLAMES(2004, Type.VISUAL); -+ MOBSPAWNER_FLAMES(2004, Type.VISUAL), -+ /** -+ * The spark that comes off a fireworks -+ */ -+ FIREWORKS_SPARK("fireworksSpark", Type.PARTICLE), -+ /** -+ * Critical hit particles -+ */ -+ CRIT("crit", Type.PARTICLE), -+ /** -+ * Blue critical hit particles -+ */ -+ MAGIC_CRIT("magicCrit", Type.PARTICLE), -+ /** -+ * Multicolored potion effect particles -+ */ -+ POTION_SWIRL("mobSpell", Type.PARTICLE), -+ /** -+ * Multicolored potion effect particles that are slightly transparent -+ */ -+ POTION_SWIRL_TRANSPARENT("mobSpellAmbient", Type.PARTICLE), -+ /** -+ * A puff of white potion swirls -+ */ -+ SPELL("spell", Type.PARTICLE), -+ /** -+ * A puff of white stars -+ */ -+ INSTANT_SPELL("instantSpell", Type.PARTICLE), -+ /** -+ * A puff of purple particles -+ */ -+ WITCH_MAGIC("witchMagic", Type.PARTICLE), -+ /** -+ * The note that appears above note blocks -+ */ -+ NOTE("note", Type.PARTICLE), -+ /** -+ * The particles shown at nether portals -+ */ -+ PORTAL("portal", Type.PARTICLE), -+ /** -+ * The symbols that fly towards the enchantment table -+ */ -+ FLYING_GLYPH("enchantmenttable", Type.PARTICLE), -+ /** -+ * Fire particles -+ */ -+ FLAME("flame", Type.PARTICLE), -+ /** -+ * The particles that pop out of lava -+ */ -+ LAVA_POP("lava", Type.PARTICLE), -+ /** -+ * A small gray square -+ */ -+ FOOTSTEP("footstep", Type.PARTICLE), -+ /** -+ * Water particles -+ */ -+ SPLASH("splash", Type.PARTICLE), -+ /** -+ * Smoke particles -+ */ -+ PARTICLE_SMOKE("smoke", Type.PARTICLE), -+ /** -+ * The biggest explosion particle effect -+ */ -+ EXPLOSION_HUGE("hugeexplosion", Type.PARTICLE), -+ /** -+ * A larger version of the explode particle -+ */ -+ EXPLOSION_LARGE("largeexplode", Type.PARTICLE), -+ /** -+ * Explosion particles -+ */ -+ EXPLOSION("explode", Type.PARTICLE), -+ /** -+ * Small gray particles -+ */ -+ VOID_FOG("depthsuspend", Type.PARTICLE), -+ /** -+ * Small gray particles -+ */ -+ SMALL_SMOKE("townaura", Type.PARTICLE), -+ /** -+ * A puff of white smoke -+ */ -+ CLOUD("cloud", Type.PARTICLE), -+ /** -+ * Multicolored dust particles -+ */ -+ COLOURED_DUST("reddust", Type.PARTICLE), -+ /** -+ * Snowball breaking -+ */ -+ SNOWBALL_BREAK("snowballpoof", Type.PARTICLE), -+ /** -+ * The water drip particle that appears on blocks under water -+ */ -+ WATERDRIP("dripWater", Type.PARTICLE), -+ /** -+ * The lava drip particle that appears on blocks under lava -+ */ -+ LAVADRIP("dripLava", Type.PARTICLE), -+ /** -+ * White particles -+ */ -+ SNOW_SHOVEL("snowshovel", Type.PARTICLE), -+ /** -+ * The particle shown when a slime jumps -+ */ -+ SLIME("slime", Type.PARTICLE), -+ /** -+ * The particle that appears when breading animals -+ */ -+ HEART("heart", Type.PARTICLE), -+ /** -+ * The particle that appears when hitting a villager -+ */ -+ VILLAGER_THUNDERCLOUD("angryVillager", Type.PARTICLE), -+ /** -+ * The particle that appears when trading with a villager -+ */ -+ 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. -+ */ -+ ITEM_BREAK("iconcrack", Type.PARTICLE, Material.class), -+ /** -+ * The particles generated while breaking a block. -+ * This particle requires a Material and data value so that the client can select the correct texture. -+ */ -+ TILE_BREAK("blockcrack", Type.PARTICLE, MaterialData.class), -+ /** -+ * The particles generated while sprinting a block -+ * This particle requires a Material and data value so that the client can select the correct texture. -+ */ -+ TILE_DUST("blockdust", Type.PARTICLE, MaterialData.class); - - private final int id; - private final Type type; - private final Class data; - private static final Map BY_ID = Maps.newHashMap(); -+ private static final Map BY_NAME = Maps.newHashMap(); -+ private final String particleName; - -- Effect(int id, Type type) { -+ private Effect(int id, Type type) { - this(id,type,null); - } - -- Effect(int id, Type type, Class data) { -+ private Effect(int id, Type type, Class data) { - this.id = id; - this.type = type; - this.data = data; -+ particleName = null; -+ } -+ -+ private Effect(String particleName, Type type, Class data) { -+ this.particleName = particleName; -+ this.type = type; -+ id = 0; -+ this.data = data; -+ } -+ -+ private Effect(String particleName, Type type) { -+ this.particleName = particleName; -+ this.type = type; -+ id = 0; -+ this.data = null; - } - - /** - * Gets the ID for this effect. - * -- * @return ID of this effect -+ * @return if this Effect isn't of type PARTICLE it returns ID of this effect - * @deprecated Magic value - */ - @Deprecated -@@ -108,6 +270,15 @@ public enum Effect { - } - - /** -+ * Returns the effect's name. This returns null if the effect is not a particle -+ * -+ * @return The effect's name -+ */ -+ public String getName() { -+ return particleName; -+ } -+ -+ /** - * @return The type of the effect. - */ - public Type getType() { -@@ -115,8 +286,7 @@ public enum Effect { - } - - /** -- * @return The class which represents data for this effect, or null if -- * none -+ * @return if this Effect isn't of type PARTICLE it returns the class which represents data for this effect, or null if none - */ - public Class getData() { - return this.data; -@@ -136,12 +306,32 @@ public enum Effect { - - static { - for (Effect effect : values()) { -- BY_ID.put(effect.id, effect); -+ if (effect.type != Type.PARTICLE) { -+ BY_ID.put(effect.id, effect); -+ } -+ } -+ } -+ -+ /** -+ * Gets the Effect associated with the given name. -+ * -+ * @param name name of the Effect to return -+ * @return Effect with the given name -+ */ -+ public static Effect getByName(String name) { -+ return BY_NAME.get(name); -+ } -+ -+ static { -+ for (Effect effect : values()) { -+ if (effect.type == Type.PARTICLE) { -+ BY_NAME.put(effect.particleName, effect); -+ } - } - } - - /** - * Represents the type of an effect. - */ -- public enum Type {SOUND, VISUAL} -+ public enum Type {SOUND, VISUAL, PARTICLE} - } -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 9d71de4..f59bdd3 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -1189,6 +1189,56 @@ public interface World extends PluginMessageRecipient, Metadatable { - */ - public boolean isGameRule(String rule); - -+ // Spigot start -+ public class Spigot -+ { -+ -+ /** -+ * Plays an effect to all players within a default radius around a given -+ * location. -+ * -+ * @param location the {@link Location} around which players must be to -+ * see the effect -+ * @param effect the {@link Effect} -+ * @throws IllegalArgumentException if the location or effect is null. -+ * It also throws when the effect requires a material or a material data -+ */ -+ public void playEffect(Location location, Effect effect) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ /** -+ * Plays an effect to all players within a default radius around a given -+ * location. The effect will use the provided material (and material -+ * data if required). The particle's position on the client will be the -+ * given location, adjusted on each axis by a normal distribution with -+ * mean 0 and standard deviation given in the offset parameters, each -+ * particle has independently calculated offsets. The effect will have -+ * the given speed and particle count if the effect is a particle. Some -+ * effect will create multiple particles. -+ * -+ * @param location the {@link Location} around which players must be to -+ * see the effect -+ * @param effect effect the {@link Effect} -+ * @param id the item/block/data id for the effect -+ * @param data the data value of the block/item for the effect -+ * @param offsetX the amount to be randomly offset by in the X axis -+ * @param offsetY the amount to be randomly offset by in the Y axis -+ * @param offsetZ the amount to be randomly offset by in the Z axis -+ * @param speed the speed of the particles -+ * @param particleCount the number of particles -+ * @param radius the radius around the location -+ */ -+ public void playEffect(Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ } -+ -+ Spigot spigot(); -+ // Spigot end -+ - /** - * Gets the world border for this world. - * -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 6444fdf..77ddf68 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1286,6 +1286,11 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ public void playEffect(Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); -diff --git a/src/test/java/org/bukkit/EffectTest.java b/src/test/java/org/bukkit/EffectTest.java -index 08aa71d..5217aec 100644 ---- a/src/test/java/org/bukkit/EffectTest.java -+++ b/src/test/java/org/bukkit/EffectTest.java -@@ -9,7 +9,11 @@ public class EffectTest { - @Test - public void getById() { - for (Effect effect : Effect.values()) { -- assertThat(Effect.getById(effect.getId()), is(effect)); -+ if (effect.getType() != Effect.Type.PARTICLE) { -+ assertThat(Effect.getById(effect.getId()), is(effect)); -+ } else { -+ assertThat(Effect.getByName(effect.getName()), is(effect)); -+ } - } - } - } --- -2.5.0 - diff --git a/Bukkit-Patches/0007-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch b/Bukkit-Patches/0007-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch deleted file mode 100644 index 2259b90c42..0000000000 --- a/Bukkit-Patches/0007-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch +++ /dev/null @@ -1,220 +0,0 @@ -From 9d7dd9d5f9276fce1fd98a79a90d7a4b3523001e Mon Sep 17 00:00:00 2001 -From: Andy Shulman -Date: Mon, 15 Apr 2013 20:06:01 -0500 -Subject: [PATCH] Define EntitySpawnEvent and SpawnerSpawnEvent - -Defines EntitySpawnEvent and SpawnerSpawnEvent. Adds BUKKIT-267 and BUKKIT-1559 - -diff --git a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java -index c035b37..9dd8ef1 100644 ---- a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java -+++ b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java -@@ -3,17 +3,13 @@ package org.bukkit.event.entity; - import org.bukkit.Location; - import org.bukkit.entity.Entity; - import org.bukkit.entity.LivingEntity; --import org.bukkit.event.Cancellable; --import org.bukkit.event.HandlerList; - - /** - * Called when a creature is spawned into a world. - *

- * If a Creature Spawn event is cancelled, the creature will not spawn. - */ --public class CreatureSpawnEvent extends EntityEvent implements Cancellable { -- private static final HandlerList handlers = new HandlerList(); -- private boolean canceled; -+public class CreatureSpawnEvent extends EntitySpawnEvent { - private final SpawnReason spawnReason; - - public CreatureSpawnEvent(final LivingEntity spawnee, final SpawnReason spawnReason) { -@@ -21,29 +17,12 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable { - this.spawnReason = spawnReason; - } - -- public boolean isCancelled() { -- return canceled; -- } -- -- public void setCancelled(boolean cancel) { -- canceled = cancel; -- } -- - @Override - public LivingEntity getEntity() { - return (LivingEntity) entity; - } - - /** -- * Gets the location at which the creature is spawning. -- * -- * @return The location at which the creature is spawning -- */ -- public Location getLocation() { -- return getEntity().getLocation(); -- } -- -- /** - * Gets the reason for why the creature is being spawned. - * - * @return A SpawnReason value detailing the reason for the creature being -@@ -53,15 +32,6 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable { - return spawnReason; - } - -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- public static HandlerList getHandlerList() { -- return handlers; -- } -- - /** - * An enum to specify the type of spawning - */ -diff --git a/src/main/java/org/bukkit/event/entity/EntitySpawnEvent.java b/src/main/java/org/bukkit/event/entity/EntitySpawnEvent.java -new file mode 100644 -index 0000000..5dcf98f ---- /dev/null -+++ b/src/main/java/org/bukkit/event/entity/EntitySpawnEvent.java -@@ -0,0 +1,45 @@ -+package org.bukkit.event.entity; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.HandlerList; -+ -+/** -+ * Called when an entity is spawned into a world. -+ *

-+ * If an Entity Spawn event is cancelled, the entity will not spawn. -+ */ -+public class EntitySpawnEvent extends EntityEvent implements org.bukkit.event.Cancellable { -+ private static final HandlerList handlers = new HandlerList(); -+ private boolean canceled; -+ -+ public EntitySpawnEvent(final Entity spawnee) { -+ super(spawnee); -+ } -+ -+ public boolean isCancelled() { -+ return canceled; -+ } -+ -+ public void setCancelled(boolean cancel) { -+ canceled = cancel; -+ } -+ -+ /** -+ * Gets the location at which the entity is spawning. -+ * -+ * @return The location at which the entity is spawning -+ */ -+ public Location getLocation() { -+ return getEntity().getLocation(); -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return handlers; -+ } -+} -diff --git a/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java b/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java -index bafd934..776f8e7 100644 ---- a/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java -+++ b/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java -@@ -1,51 +1,23 @@ - package org.bukkit.event.entity; - --import org.bukkit.entity.Item; - import org.bukkit.Location; --import org.bukkit.event.Cancellable; --import org.bukkit.event.HandlerList; -+import org.bukkit.entity.Item; - - /** - * Called when an item is spawned into a world - */ --public class ItemSpawnEvent extends EntityEvent implements Cancellable { -- private static final HandlerList handlers = new HandlerList(); -- private final Location location; -- private boolean canceled; -- -- public ItemSpawnEvent(final Item spawnee, final Location loc) { -+public class ItemSpawnEvent extends EntitySpawnEvent { -+ public ItemSpawnEvent(final Item spawnee) { - super(spawnee); -- this.location = loc; - } - -- public boolean isCancelled() { -- return canceled; -- } -- -- public void setCancelled(boolean cancel) { -- canceled = cancel; -+ @Deprecated -+ public ItemSpawnEvent(final Item spawnee, final Location loc) { -+ this(spawnee); - } - - @Override - public Item getEntity() { - return (Item) entity; - } -- -- /** -- * Gets the location at which the item is spawning. -- * -- * @return The location at which the item is spawning -- */ -- public Location getLocation() { -- return location; -- } -- -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- public static HandlerList getHandlerList() { -- return handlers; -- } - } -diff --git a/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java b/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java -new file mode 100644 -index 0000000..1acb3c4 ---- /dev/null -+++ b/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java -@@ -0,0 +1,22 @@ -+package org.bukkit.event.entity; -+ -+import org.bukkit.block.CreatureSpawner; -+import org.bukkit.entity.Entity; -+ -+/** -+ * Called when an entity is spawned into a world by a spawner. -+ *

-+ * If a Spawner Spawn event is cancelled, the entity will not spawn. -+ */ -+public class SpawnerSpawnEvent extends EntitySpawnEvent { -+ private final CreatureSpawner spawner; -+ -+ public SpawnerSpawnEvent(final Entity spawnee, final CreatureSpawner spawner) { -+ super(spawnee); -+ this.spawner = spawner; -+ } -+ -+ public CreatureSpawner getSpawner() { -+ return spawner; -+ } -+} --- -2.5.0 - diff --git a/Bukkit-Patches/0008-Entity-Mount-and-Dismount-Events.patch b/Bukkit-Patches/0008-Entity-Mount-and-Dismount-Events.patch deleted file mode 100644 index 347f9cd8a2..0000000000 --- a/Bukkit-Patches/0008-Entity-Mount-and-Dismount-Events.patch +++ /dev/null @@ -1,112 +0,0 @@ -From f4a34eb093b24d141daa07889a425b6c5d5b7c76 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 2 Jul 2013 20:32:53 +1000 -Subject: [PATCH] Entity Mount and Dismount Events - - -diff --git a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java -new file mode 100644 -index 0000000..24d4942 ---- /dev/null -+++ b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java -@@ -0,0 +1,39 @@ -+package org.spigotmc.event.entity; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+ -+/** -+ * Called when an entity stops riding another entity. -+ * -+ */ -+public class EntityDismountEvent extends EntityEvent -+{ -+ -+ private static final HandlerList handlers = new HandlerList(); -+ private boolean cancelled; -+ private final Entity dismounted; -+ -+ public EntityDismountEvent(Entity what, Entity dismounted) -+ { -+ super( what ); -+ this.dismounted = dismounted; -+ } -+ -+ public Entity getDismounted() -+ { -+ return dismounted; -+ } -+ -+ @Override -+ public HandlerList getHandlers() -+ { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() -+ { -+ return handlers; -+ } -+} -diff --git a/src/main/java/org/spigotmc/event/entity/EntityMountEvent.java b/src/main/java/org/spigotmc/event/entity/EntityMountEvent.java -new file mode 100644 -index 0000000..16aa2a7 ---- /dev/null -+++ b/src/main/java/org/spigotmc/event/entity/EntityMountEvent.java -@@ -0,0 +1,52 @@ -+package org.spigotmc.event.entity; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+ -+/** -+ * Called when an entity attempts to ride another entity. -+ * -+ */ -+public class EntityMountEvent extends EntityEvent implements Cancellable -+{ -+ -+ private static final HandlerList handlers = new HandlerList(); -+ private boolean cancelled; -+ private final Entity mount; -+ -+ public EntityMountEvent(Entity what, Entity mount) -+ { -+ super( what ); -+ this.mount = mount; -+ } -+ -+ public Entity getMount() -+ { -+ return mount; -+ } -+ -+ @Override -+ public boolean isCancelled() -+ { -+ return cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) -+ { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() -+ { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() -+ { -+ return handlers; -+ } -+} --- -2.5.0 - diff --git a/Bukkit-Patches/0009-InventoryClickEvent-getClickedInventory.patch b/Bukkit-Patches/0009-InventoryClickEvent-getClickedInventory.patch deleted file mode 100644 index 4e785ea956..0000000000 --- a/Bukkit-Patches/0009-InventoryClickEvent-getClickedInventory.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 36c03b52a29710a08ab8c8a4aecdf00877847315 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 7 Jul 2013 10:32:05 -0400 -Subject: [PATCH] InventoryClickEvent getClickedInventory - -Add InventoryClickEvent.getClickedInventory. Adds BUKKIT-4495 -Plugins currently have to do the logic themselves on the raw slot ID -in order to determine the inventory clicked. This provides the logic for plugins to -readily identify which inventory was clicked. - -diff --git a/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java -index 28198b8..3313d91 100644 ---- a/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java -@@ -47,6 +47,7 @@ public class InventoryClickEvent extends InventoryInteractEvent { - private static final HandlerList handlers = new HandlerList(); - private final ClickType click; - private final InventoryAction action; -+ private final Inventory clickedInventory; - private SlotType slot_type; - private int whichSlot; - private int rawSlot; -@@ -62,6 +63,13 @@ public class InventoryClickEvent extends InventoryInteractEvent { - super(view); - this.slot_type = type; - this.rawSlot = slot; -+ if (slot < 0) { -+ this.clickedInventory = null; -+ } else if (view.getTopInventory() != null && slot < view.getTopInventory().getSize()) { -+ this.clickedInventory = view.getTopInventory(); -+ } else { -+ this.clickedInventory = view.getBottomInventory(); -+ } - this.whichSlot = view.convertSlot(slot); - this.click = click; - this.action = action; -@@ -73,6 +81,14 @@ public class InventoryClickEvent extends InventoryInteractEvent { - } - - /** -+ * Gets the inventory that was clicked, or null if outside of window -+ * @return The clicked inventory -+ */ -+ public Inventory getClickedInventory() { -+ return clickedInventory; -+ } -+ -+ /** - * Gets the type of slot that was clicked. - * - * @return the slot type --- -2.5.0 - diff --git a/Bukkit-Patches/0010-Added-getAllSessionData-to-the-Conversation-API.patch b/Bukkit-Patches/0010-Added-getAllSessionData-to-the-Conversation-API.patch deleted file mode 100644 index 9731e0aead..0000000000 --- a/Bukkit-Patches/0010-Added-getAllSessionData-to-the-Conversation-API.patch +++ /dev/null @@ -1,28 +0,0 @@ -From d42215ef49162229b53cdae06df8143f7d3b8692 Mon Sep 17 00:00:00 2001 -From: Alex Bennett -Date: Thu, 11 Jul 2013 15:31:32 -0500 -Subject: [PATCH] Added getAllSessionData() to the Conversation API. - - -diff --git a/src/main/java/org/bukkit/conversations/ConversationContext.java b/src/main/java/org/bukkit/conversations/ConversationContext.java -index 4f33ff4..7390a77 100644 ---- a/src/main/java/org/bukkit/conversations/ConversationContext.java -+++ b/src/main/java/org/bukkit/conversations/ConversationContext.java -@@ -46,6 +46,14 @@ public class ConversationContext { - } - - /** -+ * Gets the entire sessionData map. -+ * @return The full sessionData map. -+ */ -+ public Map getAllSessionData() { -+ return sessionData; -+ } -+ -+ /** - * Gets session data shared between all {@link Prompt} invocations. Use - * this as a way to pass data through each Prompt as the conversation - * develops. --- -2.5.0 - diff --git a/Bukkit-Patches/0011-Catch-Conversation-API-Errors.patch b/Bukkit-Patches/0011-Catch-Conversation-API-Errors.patch deleted file mode 100644 index fe25806fe2..0000000000 --- a/Bukkit-Patches/0011-Catch-Conversation-API-Errors.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 6b81cd9d8cfc6fbc6046bd89aab7ca0b7ff83426 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 22 Jul 2013 19:09:43 +1000 -Subject: [PATCH] Catch Conversation API Errors - - -diff --git a/src/main/java/org/bukkit/conversations/Conversation.java b/src/main/java/org/bukkit/conversations/Conversation.java -index d4c1f6d..46912c8 100644 ---- a/src/main/java/org/bukkit/conversations/Conversation.java -+++ b/src/main/java/org/bukkit/conversations/Conversation.java -@@ -209,6 +209,7 @@ public class Conversation { - * @param input The user's chat text. - */ - public void acceptInput(String input) { -+ try { // Spigot - if (currentPrompt != null) { - - // Echo the user's input -@@ -228,6 +229,12 @@ public class Conversation { - currentPrompt = currentPrompt.acceptInput(context, input); - outputNextPrompt(); - } -+ // Spigot Start -+ } catch ( Throwable t ) -+ { -+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.SEVERE, "Error handling conversation prompt", t ); -+ } -+ // Spigot End - } - - /** --- -2.5.0 - diff --git a/Bukkit-Patches/0012-Player-Collision-API.patch b/Bukkit-Patches/0012-Player-Collision-API.patch deleted file mode 100644 index 6f9d800cb8..0000000000 --- a/Bukkit-Patches/0012-Player-Collision-API.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 8747c4a54e1c16d7e96a02212f2583f40d9d5523 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 3 Aug 2013 19:20:50 +1000 -Subject: [PATCH] Player Collision API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 77ddf68..146fbd4 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1291,6 +1291,27 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Gets whether the player collides with entities -+ * -+ * @return the player's collision toggle state -+ */ -+ public boolean getCollidesWithEntities() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ /** -+ * Sets whether the player collides with entities -+ * -+ * @param collides whether the player should collide with entities or -+ * not. -+ */ -+ public void setCollidesWithEntities(boolean collides) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); --- -2.5.0 - diff --git a/Bukkit-Patches/0013-Expand-Boolean-Prompt-Values.patch b/Bukkit-Patches/0013-Expand-Boolean-Prompt-Values.patch deleted file mode 100644 index bc516e734c..0000000000 --- a/Bukkit-Patches/0013-Expand-Boolean-Prompt-Values.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 7aef7e6c46ff1f2c9b6b348b817b7af04f4eb327 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 3 Aug 2013 19:42:16 +1000 -Subject: [PATCH] Expand Boolean Prompt Values - - -diff --git a/src/main/java/org/bukkit/conversations/BooleanPrompt.java b/src/main/java/org/bukkit/conversations/BooleanPrompt.java -index 3f2c97f..81ef78c 100644 ---- a/src/main/java/org/bukkit/conversations/BooleanPrompt.java -+++ b/src/main/java/org/bukkit/conversations/BooleanPrompt.java -@@ -15,12 +15,13 @@ public abstract class BooleanPrompt extends ValidatingPrompt{ - - @Override - protected boolean isInputValid(ConversationContext context, String input) { -- String[] accepted = {"true", "false", "on", "off", "yes", "no"}; -+ String[] accepted = {"true", "false", "on", "off", "yes", "no" /* Spigot: */, "y", "n", "1", "0", "right", "wrong", "correct", "incorrect", "valid", "invalid"}; // Spigot - return ArrayUtils.contains(accepted, input.toLowerCase()); - } - - @Override - protected Prompt acceptValidatedInput(ConversationContext context, String input) { -+ if (input.equalsIgnoreCase("y") || input.equals("1") || input.equalsIgnoreCase("right") || input.equalsIgnoreCase("correct") || input.equalsIgnoreCase("valid")) input = "true"; // Spigot - return acceptValidatedInput(context, BooleanUtils.toBoolean(input)); - } - --- -2.5.0 - diff --git a/Bukkit-Patches/0014-Add-Getter-for-Entity-Invulnerability.patch b/Bukkit-Patches/0014-Add-Getter-for-Entity-Invulnerability.patch deleted file mode 100644 index cb08665632..0000000000 --- a/Bukkit-Patches/0014-Add-Getter-for-Entity-Invulnerability.patch +++ /dev/null @@ -1,36 +0,0 @@ -From d60f114d2e756c1757df92f70c3bf32a631f5a6d Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 3 Aug 2013 19:49:36 +1000 -Subject: [PATCH] Add Getter for Entity Invulnerability - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 6dc7076..9f4d48b 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -356,4 +356,22 @@ public interface Entity extends Metadatable, CommandSender { - * @return whether the entity is glowing - */ - boolean isGlowing(); -+ -+ // Spigot Start -+ public class Spigot -+ { -+ -+ /** -+ * Returns whether this entity is invulnerable. -+ * -+ * @return True if the entity is invulnerable. -+ */ -+ public boolean isInvulnerable() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ } -+ -+ Spigot spigot(); -+ // Spigot End - } --- -2.5.0 - diff --git a/Bukkit-Patches/0015-Add-respawn-API.patch b/Bukkit-Patches/0015-Add-respawn-API.patch deleted file mode 100644 index 0294e5c880..0000000000 --- a/Bukkit-Patches/0015-Add-respawn-API.patch +++ /dev/null @@ -1,28 +0,0 @@ -From e5707119e3a0e1279df92b73c9d618eb7956c7c8 Mon Sep 17 00:00:00 2001 -From: ninja- -Date: Tue, 8 Oct 2013 14:35:58 +0200 -Subject: [PATCH] Add respawn API. - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 146fbd4..a9bdfde 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1312,6 +1312,14 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Respawns the player if dead. -+ */ -+ public void respawn() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); --- -2.5.0 - diff --git a/Bukkit-Patches/0016-Fix-Plugin-Message-API-Disconnects.patch b/Bukkit-Patches/0016-Fix-Plugin-Message-API-Disconnects.patch deleted file mode 100644 index 3dbc191576..0000000000 --- a/Bukkit-Patches/0016-Fix-Plugin-Message-API-Disconnects.patch +++ /dev/null @@ -1,30 +0,0 @@ -From ae75234b451d6cf85e70ed248e758aa8d0510e72 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 19 Oct 2013 12:59:42 +1100 -Subject: [PATCH] Fix Plugin Message API Disconnects - - -diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java -index a906f8d..4c171e8 100644 ---- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java -+++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java -@@ -421,7 +421,15 @@ public class StandardMessenger implements Messenger { - Set registrations = getIncomingChannelRegistrations(channel); - - for (PluginMessageListenerRegistration registration : registrations) { -- registration.getListener().onPluginMessageReceived(channel, source, message); -+ // Spigot Start -+ try -+ { -+ registration.getListener().onPluginMessageReceived( channel, source, message ); -+ } catch ( Throwable t ) -+ { -+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, "Could not pass incoming plugin message to " + registration.getPlugin(), t ); -+ } -+ // Spigot End - } - } - --- -2.5.0 - diff --git a/Bukkit-Patches/0017-Fix-Tab-Completion-for-Some-Commands.patch b/Bukkit-Patches/0017-Fix-Tab-Completion-for-Some-Commands.patch deleted file mode 100644 index 95e573ef46..0000000000 --- a/Bukkit-Patches/0017-Fix-Tab-Completion-for-Some-Commands.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 4e7e25927d68916ab42503766e264c3db44155be Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 24 Dec 2013 10:14:25 +1100 -Subject: [PATCH] Fix Tab Completion for Some Commands - - -diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java -index b888da1..e21d167 100644 ---- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java -@@ -40,4 +40,12 @@ public class PluginsCommand extends BukkitCommand { - - return "(" + plugins.length + "): " + pluginList.toString(); - } -+ -+ // Spigot Start -+ @Override -+ public java.util.List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException -+ { -+ return java.util.Collections.emptyList(); -+ } -+ // Spigot End - } -diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java -index eb018f1..c70d512 100644 ---- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java -@@ -27,4 +27,12 @@ public class ReloadCommand extends BukkitCommand { - - return true; - } -+ -+ // Spigot Start -+ @Override -+ public java.util.List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException -+ { -+ return java.util.Collections.emptyList(); -+ } -+ // Spigot End - } -diff --git a/src/main/java/org/bukkit/command/defaults/TellCommand.java b/src/main/java/org/bukkit/command/defaults/TellCommand.java -index 7b0a41c..2e5d811 100644 ---- a/src/main/java/org/bukkit/command/defaults/TellCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/TellCommand.java -@@ -46,4 +46,16 @@ public class TellCommand extends VanillaCommand { - - return true; - } -+ -+ // Spigot Start -+ @Override -+ public java.util.List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException -+ { -+ if ( args.length == 0 ) -+ { -+ return super.tabComplete( sender, alias, args ); -+ } -+ return java.util.Collections.emptyList(); -+ } -+ // Spigot End - } -diff --git a/src/main/java/org/bukkit/command/defaults/TestForCommand.java b/src/main/java/org/bukkit/command/defaults/TestForCommand.java -index 7e5494d..e168b49 100644 ---- a/src/main/java/org/bukkit/command/defaults/TestForCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/TestForCommand.java -@@ -24,4 +24,16 @@ public class TestForCommand extends VanillaCommand { - sender.sendMessage(ChatColor.RED + "/testfor is only usable by commandblocks with analog output."); - return true; - } -+ -+ // Spigot Start -+ @Override -+ public java.util.List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException -+ { -+ if ( args.length == 0 ) -+ { -+ return super.tabComplete( sender, alias, args ); -+ } -+ return java.util.Collections.emptyList(); -+ } -+ // Spigot End - } --- -2.5.0 - diff --git a/Bukkit-Patches/0018-Implement-Locale-Getter-for-Players.patch b/Bukkit-Patches/0018-Implement-Locale-Getter-for-Players.patch deleted file mode 100644 index aec26191ef..0000000000 --- a/Bukkit-Patches/0018-Implement-Locale-Getter-for-Players.patch +++ /dev/null @@ -1,30 +0,0 @@ -From e3615f3fa41f42a38dbc675946b23311055a8938 Mon Sep 17 00:00:00 2001 -From: Smove -Date: Sat, 1 Feb 2014 18:10:49 +1100 -Subject: [PATCH] Implement Locale Getter for Players - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index a9bdfde..43ef5b1 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1320,6 +1320,16 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Gets player locale language. -+ * -+ * @return the player's client language settings -+ */ -+ public String getLocale() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); --- -2.5.0 - diff --git a/Bukkit-Patches/0019-Add-support-for-fetching-hidden-players.patch b/Bukkit-Patches/0019-Add-support-for-fetching-hidden-players.patch deleted file mode 100644 index 8859e85a9b..0000000000 --- a/Bukkit-Patches/0019-Add-support-for-fetching-hidden-players.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 200eacd0d6f315d1b0c918ba29c49111f7b5a8a5 Mon Sep 17 00:00:00 2001 -From: Tux -Date: Sun, 9 Feb 2014 14:02:11 -0500 -Subject: [PATCH] Add support for fetching hidden players - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 43ef5b1..97995db 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1330,6 +1330,16 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Gets all players hidden with {@link #hidePlayer(org.bukkit.entity.Player)}. -+ * -+ * @return a Set with all hidden players -+ */ -+ public java.util.Set getHiddenPlayers() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); --- -2.5.0 - diff --git a/Bukkit-Patches/0020-Silenceable-Lightning-API.patch b/Bukkit-Patches/0020-Silenceable-Lightning-API.patch deleted file mode 100644 index 8c82fd017f..0000000000 --- a/Bukkit-Patches/0020-Silenceable-Lightning-API.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 839fc96a5f387bb4d5e17f916df25b60e42f20a5 Mon Sep 17 00:00:00 2001 -From: drXor -Date: Sun, 23 Feb 2014 16:16:29 -0400 -Subject: [PATCH] Silenceable Lightning API - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index f59bdd3..d088c3c 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -1234,6 +1234,30 @@ public interface World extends PluginMessageRecipient, Metadatable { - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Strikes lightning at the given {@link Location} and possibly without sound -+ * -+ * @param loc The location to strike lightning -+ * @param isSilent Whether this strike makes no sound -+ * @return The lightning entity. -+ */ -+ public LightningStrike strikeLightning(Location loc, boolean isSilent) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ /** -+ * Strikes lightning at the given {@link Location} without doing damage and possibly without sound -+ * -+ * @param loc The location to strike lightning -+ * @param isSilent Whether this strike makes no sound -+ * @return The lightning entity. -+ */ -+ public LightningStrike strikeLightningEffect(Location loc, boolean isSilent) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); -diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java -index c8b5154..1ed4ac9 100644 ---- a/src/main/java/org/bukkit/entity/LightningStrike.java -+++ b/src/main/java/org/bukkit/entity/LightningStrike.java -@@ -12,4 +12,21 @@ public interface LightningStrike extends Weather { - */ - public boolean isEffect(); - -+ -+ public class Spigot extends Entity.Spigot -+ { -+ -+ /* -+ * Returns whether the strike is silent. -+ * -+ * @return whether the strike is silent. -+ */ -+ public boolean isSilent() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ } -+ -+ Spigot spigot(); - } --- -2.5.0 - diff --git a/Bukkit-Patches/0021-Remove-deprecation-on-some-player-lookup-methods.patch b/Bukkit-Patches/0021-Remove-deprecation-on-some-player-lookup-methods.patch deleted file mode 100644 index 86a6f27c5c..0000000000 --- a/Bukkit-Patches/0021-Remove-deprecation-on-some-player-lookup-methods.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 695554e3a650ccdb4d3d1d1ae56fb6bfacda48ea Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 30 Mar 2014 15:58:22 +1100 -Subject: [PATCH] Remove deprecation on some player lookup methods - -Most of these methods still have plenty of use given that only one player with each name can exist at a time. Deprecating these methods renders even basic functionality such as /msg impossible without causing compiler warnings. We will maintain this API and it should be considered safe and appropriate for most use cases. - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index e61e50b..dc2c9d1 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -377,12 +377,9 @@ public final class Bukkit { - *

- * This method may not return objects for offline players. - * -- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer -- * guaranteed to be unique - * @param name the name to look up - * @return a player if one was found, null otherwise - */ -- @Deprecated - public static Player getPlayer(String name) { - return server.getPlayer(name); - } -@@ -390,12 +387,9 @@ public final class Bukkit { - /** - * Gets the player with the exact given name, case insensitive. - * -- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer -- * guaranteed to be unique - * @param name Exact name of the player to retrieve - * @return a player object if one was found, null otherwise - */ -- @Deprecated - public static Player getPlayerExact(String name) { - return server.getPlayerExact(name); - } -@@ -407,12 +401,9 @@ public final class Bukkit { - * This list is not sorted in any particular order. If an exact match is - * found, the returned list will only contain a single result. - * -- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer -- * guaranteed to be unique - * @param name the (partial) name to match - * @return list of all possible players - */ -- @Deprecated - public static List matchPlayer(String name) { - return server.matchPlayer(name); - } -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 5ca4321..cdccaf3 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -313,23 +313,17 @@ public interface Server extends PluginMessageRecipient { - *

- * This method may not return objects for offline players. - * -- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer -- * guaranteed to be unique - * @param name the name to look up - * @return a player if one was found, null otherwise - */ -- @Deprecated - public Player getPlayer(String name); - - /** - * Gets the player with the exact given name, case insensitive. - * -- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer -- * guaranteed to be unique - * @param name Exact name of the player to retrieve - * @return a player object if one was found, null otherwise - */ -- @Deprecated - public Player getPlayerExact(String name); - - /** -@@ -339,12 +333,9 @@ public interface Server extends PluginMessageRecipient { - * This list is not sorted in any particular order. If an exact match is - * found, the returned list will only contain a single result. - * -- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer -- * guaranteed to be unique - * @param name the (partial) name to match - * @return list of all possible players - */ -- @Deprecated - public List matchPlayer(String name); - - /** --- -2.5.0 - diff --git a/Bukkit-Patches/0022-Add-Score.isScoreSet-Z-API.patch b/Bukkit-Patches/0022-Add-Score.isScoreSet-Z-API.patch deleted file mode 100644 index 1009fbb3b9..0000000000 --- a/Bukkit-Patches/0022-Add-Score.isScoreSet-Z-API.patch +++ /dev/null @@ -1,31 +0,0 @@ -From c273b600a1dc967bfb9584ffb910e5ac05a3feb5 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 17 Apr 2014 19:35:13 +1000 -Subject: [PATCH] Add Score.isScoreSet()Z API. - - -diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java -index 4c10346..2410cbd 100644 ---- a/src/main/java/org/bukkit/scoreboard/Score.java -+++ b/src/main/java/org/bukkit/scoreboard/Score.java -@@ -51,6 +51,17 @@ public interface Score { - */ - void setScore(int score) throws IllegalStateException; - -+ // Spigot start -+ /** -+ * Shows if this score has been set at any point in time. -+ * -+ * @return if this score has been set before -+ * @throws IllegalStateException if the associated objective has been -+ * unregistered -+ */ -+ boolean isScoreSet() throws IllegalStateException; -+ // Spigot end -+ - /** - * Gets the scoreboard for the associated objective. - * --- -2.5.0 - diff --git a/Bukkit-Patches/0023-Add-PlayerSpawnLocationEvent.patch b/Bukkit-Patches/0023-Add-PlayerSpawnLocationEvent.patch deleted file mode 100644 index 1f5edf3aca..0000000000 --- a/Bukkit-Patches/0023-Add-PlayerSpawnLocationEvent.patch +++ /dev/null @@ -1,65 +0,0 @@ -From b4f68c78aa8154ab3f3fee79fa35967382eb3aff Mon Sep 17 00:00:00 2001 -From: ninja -Date: Tue, 8 Apr 2014 14:01:32 +0200 -Subject: [PATCH] Add PlayerSpawnLocationEvent. - - -diff --git a/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java b/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java -new file mode 100644 -index 0000000..dd3f58c ---- /dev/null -+++ b/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java -@@ -0,0 +1,50 @@ -+package org.spigotmc.event.player; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+ -+/** -+ * Called when player is about to spawn in a world after joining the server. -+ */ -+public class PlayerSpawnLocationEvent extends PlayerEvent { -+ private static final HandlerList handlers = new HandlerList(); -+ private Location spawnLocation; -+ -+ public PlayerSpawnLocationEvent(final Player who, Location spawnLocation) { -+ super(who); -+ this.spawnLocation = spawnLocation; -+ } -+ -+ -+ /** -+ * Gets player's spawn location. -+ * If the player {@link Player#hasPlayedBefore()}, it's going to default to the location inside player.dat file. -+ * For new players, the default spawn location is spawn of the main Bukkit world. -+ * -+ * @return the spawn location -+ */ -+ public Location getSpawnLocation() { -+ return spawnLocation; -+ } -+ -+ /** -+ * Sets player's spawn location. -+ * -+ * @param location the spawn location -+ */ -+ public void setSpawnLocation(Location location) { -+ this.spawnLocation = location; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return handlers; -+ } -+} --- -2.5.0 - diff --git a/Bukkit-Patches/0024-Ease-ClassLoader-Deadlocks-Where-Possible.patch b/Bukkit-Patches/0024-Ease-ClassLoader-Deadlocks-Where-Possible.patch deleted file mode 100644 index 5095363041..0000000000 --- a/Bukkit-Patches/0024-Ease-ClassLoader-Deadlocks-Where-Possible.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 3023d912fbd278e9cce35e715477f5a1969e1441 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 16 Jul 2014 17:24:21 +1000 -Subject: [PATCH] Ease ClassLoader Deadlocks Where Possible - -When on Java 7 we can register the classloader as parallel capable to prevent deadlocks caused by certain scenarios. Due to the nature of PluginClassLoader this isn't completely safe, but we can make it safer by switching to concurrency focused collections. Either way this is far better than crashing the server. - -diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index cd843f4..7bf2fa6 100644 ---- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -48,7 +48,7 @@ import org.yaml.snakeyaml.error.YAMLException; - public final class JavaPluginLoader implements PluginLoader { - final Server server; - private final Pattern[] fileFilters = new Pattern[] { Pattern.compile("\\.jar$"), }; -- private final Map> classes = new HashMap>(); -+ private final Map> classes = new java.util.concurrent.ConcurrentHashMap>(); // Spigot - private final Map loaders = new LinkedHashMap(); - 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 -index 13f8633..4cffa13 100644 ---- a/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; - */ - final class PluginClassLoader extends URLClassLoader { - private final JavaPluginLoader loader; -- private final Map> classes = new HashMap>(); -+ private final Map> classes = new java.util.concurrent.ConcurrentHashMap>(); // Spigot - private final PluginDescriptionFile description; - private final File dataFolder; - private final File file; -@@ -25,6 +25,30 @@ final class PluginClassLoader extends URLClassLoader { - private JavaPlugin pluginInit; - private IllegalStateException pluginState; - -+ // Spigot Start -+ static -+ { -+ try -+ { -+ java.lang.reflect.Method method = ClassLoader.class.getDeclaredMethod( "registerAsParallelCapable" ); -+ if ( method != null ) -+ { -+ boolean oldAccessible = method.isAccessible(); -+ method.setAccessible( true ); -+ method.invoke( null ); -+ 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 ); -+ } -+ } -+ // Spigot End -+ - PluginClassLoader(final JavaPluginLoader loader, final ClassLoader parent, final PluginDescriptionFile description, final File dataFolder, final File file) throws InvalidPluginException, MalformedURLException { - super(new URL[] {file.toURI().toURL()}, parent); - Validate.notNull(loader, "Loader cannot be null"); --- -2.5.0 - diff --git a/Bukkit-Patches/0025-Fix-slow-tab-complete-for-some-commands.patch b/Bukkit-Patches/0025-Fix-slow-tab-complete-for-some-commands.patch deleted file mode 100644 index 9bfaf5c3c3..0000000000 --- a/Bukkit-Patches/0025-Fix-slow-tab-complete-for-some-commands.patch +++ /dev/null @@ -1,23 +0,0 @@ -From a7b3e4ecddc7a8203270b844a902a2d0a892cf25 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 22 Jul 2014 21:01:32 +1000 -Subject: [PATCH] Fix slow tab complete for some commands. - -Use online players instead of offline players, which is very slow. - -diff --git a/src/main/java/org/bukkit/command/defaults/WhitelistCommand.java b/src/main/java/org/bukkit/command/defaults/WhitelistCommand.java -index 92de43c..855f560 100644 ---- a/src/main/java/org/bukkit/command/defaults/WhitelistCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/WhitelistCommand.java -@@ -105,7 +105,7 @@ public class WhitelistCommand extends VanillaCommand { - } else if (args.length == 2) { - if (args[0].equalsIgnoreCase("add")) { - List completions = new ArrayList(); -- for (OfflinePlayer player : Bukkit.getOfflinePlayers()) { -+ for (OfflinePlayer player : Bukkit.getOnlinePlayers()) { // Spigot - well maybe sometimes you haven't turned the whitelist on just yet. - String name = player.getName(); - if (StringUtil.startsWithIgnoreCase(name, args[1]) && !player.isWhitelisted()) { - completions.add(name); --- -2.5.0 - diff --git a/Bukkit-Patches/0026-Undeprecate-Player-updateInventory-V.patch b/Bukkit-Patches/0026-Undeprecate-Player-updateInventory-V.patch deleted file mode 100644 index fb5aa843cc..0000000000 --- a/Bukkit-Patches/0026-Undeprecate-Player-updateInventory-V.patch +++ /dev/null @@ -1,25 +0,0 @@ -From cd9f774fd319b7bc548a18585c2ac16cbc61076a Mon Sep 17 00:00:00 2001 -From: drXor -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 eb5084b..a89df18 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -334,10 +334,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(); - - /** --- -2.5.0 - diff --git a/Bukkit-Patches/0027-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch b/Bukkit-Patches/0027-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch deleted file mode 100644 index d02bb2d031..0000000000 --- a/Bukkit-Patches/0027-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch +++ /dev/null @@ -1,46 +0,0 @@ -From cead8b988efa720dedbe6a3b314552416780234d 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 459e09c..d8cc821 100644 ---- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -@@ -157,4 +157,32 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable { - - @SuppressWarnings("javadoc") - ItemMeta clone(); -+ -+ // 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 - } --- -2.5.0 - diff --git a/Bukkit-Patches/0028-BungeeCord-Chat-API.patch b/Bukkit-Patches/0028-BungeeCord-Chat-API.patch deleted file mode 100644 index 8656a09581..0000000000 --- a/Bukkit-Patches/0028-BungeeCord-Chat-API.patch +++ /dev/null @@ -1,330 +0,0 @@ -From 23a21243fa55f95f91c067bccfd843f32cba170b Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 13 Dec 2014 12:59:14 +1100 -Subject: [PATCH] BungeeCord Chat API - - -diff --git a/pom.xml b/pom.xml -index 6377570..8fb67ea 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -83,6 +83,14 @@ - 1.15 - compile - -+ -+ net.md-5 -+ bungeecord-chat -+ 1.9-SNAPSHOT -+ jar -+ compile -+ -+ - - - junit -diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java -index b8872b4..adbae51 100644 ---- a/src/main/java/org/bukkit/ChatColor.java -+++ b/src/main/java/org/bukkit/ChatColor.java -@@ -10,95 +10,205 @@ import com.google.common.collect.Maps; - /** - * All supported color values for chat - */ --public enum ChatColor { -+public enum ChatColor{ - /** - * Represents black - */ -- BLACK('0', 0x00), -+ BLACK('0', 0x00) { -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.BLACK; -+ } -+ }, - /** - * Represents dark blue - */ -- DARK_BLUE('1', 0x1), -+ DARK_BLUE('1', 0x1){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.DARK_BLUE; -+ } -+ }, - /** - * Represents dark green - */ -- DARK_GREEN('2', 0x2), -+ DARK_GREEN('2', 0x2){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.DARK_GREEN; -+ } -+ }, - /** - * Represents dark blue (aqua) - */ -- DARK_AQUA('3', 0x3), -+ DARK_AQUA('3', 0x3){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.DARK_AQUA; -+ } -+ }, - /** - * Represents dark red - */ -- DARK_RED('4', 0x4), -+ DARK_RED('4', 0x4){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.DARK_RED; -+ } -+ }, - /** - * Represents dark purple - */ -- DARK_PURPLE('5', 0x5), -+ DARK_PURPLE('5', 0x5){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.DARK_PURPLE; -+ } -+ }, - /** - * Represents gold - */ -- GOLD('6', 0x6), -+ GOLD('6', 0x6){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.GOLD; -+ } -+ }, - /** - * Represents gray - */ -- GRAY('7', 0x7), -+ GRAY('7', 0x7){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.GRAY; -+ } -+ }, - /** - * Represents dark gray - */ -- DARK_GRAY('8', 0x8), -+ DARK_GRAY('8', 0x8){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.DARK_GRAY; -+ } -+ }, - /** - * Represents blue - */ -- BLUE('9', 0x9), -+ BLUE('9', 0x9){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.BLUE; -+ } -+ }, - /** - * Represents green - */ -- GREEN('a', 0xA), -+ GREEN('a', 0xA){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.GREEN; -+ } -+ }, - /** - * Represents aqua - */ -- AQUA('b', 0xB), -+ AQUA('b', 0xB){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.AQUA; -+ } -+ }, - /** - * Represents red - */ -- RED('c', 0xC), -+ RED('c', 0xC){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.RED; -+ } -+ }, - /** - * Represents light purple - */ -- LIGHT_PURPLE('d', 0xD), -+ LIGHT_PURPLE('d', 0xD){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.LIGHT_PURPLE; -+ } -+ }, - /** - * Represents yellow - */ -- YELLOW('e', 0xE), -+ YELLOW('e', 0xE){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.YELLOW; -+ } -+ }, - /** - * Represents white - */ -- WHITE('f', 0xF), -+ WHITE('f', 0xF){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.WHITE; -+ } -+ }, - /** - * Represents magical characters that change around randomly - */ -- MAGIC('k', 0x10, true), -+ MAGIC('k', 0x10, true){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.MAGIC; -+ } -+ }, - /** - * Makes the text bold. - */ -- BOLD('l', 0x11, true), -+ BOLD('l', 0x11, true){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.BOLD; -+ } -+ }, - /** - * Makes a line appear through the text. - */ -- STRIKETHROUGH('m', 0x12, true), -+ STRIKETHROUGH('m', 0x12, true){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.STRIKETHROUGH; -+ } -+ }, - /** - * Makes the text appear underlined. - */ -- UNDERLINE('n', 0x13, true), -+ UNDERLINE('n', 0x13, true){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.UNDERLINE; -+ } -+ }, - /** - * Makes the text italic. - */ -- ITALIC('o', 0x14, true), -+ ITALIC('o', 0x14, true){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.ITALIC; -+ } -+ }, - /** - * Resets all previous chat colors or formats. - */ -- RESET('r', 0x15); -+ RESET('r', 0x15){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.RESET; -+ } -+ }; - - /** - * The special character which prefixes all chat colour codes. Use this if -@@ -125,6 +235,10 @@ public enum ChatColor { - this.toString = new String(new char[] {COLOR_CHAR, code}); - } - -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.RESET; -+ }; -+ - /** - * Gets the char value associated with this color - * -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index cdccaf3..1ae5e96 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -947,6 +947,24 @@ public interface Server extends PluginMessageRecipient { - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Sends the component to the player -+ * -+ * @param component the components to send -+ */ -+ public void broadcast(net.md_5.bungee.api.chat.BaseComponent component) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ -+ /** -+ * Sends an array of components as a single message to the player -+ * -+ * @param components the components to send -+ */ -+ public void broadcast(net.md_5.bungee.api.chat.BaseComponent... components) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } - } - - Spigot spigot(); -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index a89df18..dc58bea 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1338,6 +1338,24 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Sends the component to the player -+ * -+ * @param component the components to send -+ */ -+ public void sendMessage(net.md_5.bungee.api.chat.BaseComponent component) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ -+ /** -+ * Sends an array of components as a single message to the player -+ * -+ * @param components the components to send -+ */ -+ public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } - } - - Spigot spigot(); --- -2.7.0.windows.1 - diff --git a/Bukkit-Patches/0029-Add-restart-API.patch b/Bukkit-Patches/0029-Add-restart-API.patch deleted file mode 100644 index b7e80017cf..0000000000 --- a/Bukkit-Patches/0029-Add-restart-API.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 785014588a688d3453f23d230ef33662d51e3556 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 13 Jul 2015 19:10:15 +1000 -Subject: [PATCH] Add restart API. - - -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 1ae5e96..69720e9 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -965,6 +965,13 @@ public interface Server extends PluginMessageRecipient { - public void broadcast(net.md_5.bungee.api.chat.BaseComponent... components) { - throw new UnsupportedOperationException("Not supported yet."); - } -+ -+ /** -+ * Restart the server. If the server administrator has not configured restarting, the server will stop. -+ */ -+ public void restart() { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } - } - - Spigot spigot(); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0001-POM-Changes.patch b/CraftBukkit-Patches/0001-POM-Changes.patch deleted file mode 100644 index 61518b37bf..0000000000 --- a/CraftBukkit-Patches/0001-POM-Changes.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 87d690ad5537531bc6eb1ac0d96dd4c21d6f64c9 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 2 Jul 2013 13:07:39 +1000 -Subject: [PATCH] POM Changes - -Basic changes to the build system which mark the artifact as Spigot, and the necessary code changes to ensure proper functionality. Also disables the auto updater provided by CraftBukkit as it is useless to us. - -diff --git a/pom.xml b/pom.xml -index 452ed6c..4f7cea7 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -1,12 +1,12 @@ - - 4.0.0 -- org.bukkit -- craftbukkit -+ org.spigotmc -+ spigot - jar - 1.9-R0.1-SNAPSHOT -- CraftBukkit -- http://www.bukkit.org -+ Spigot -+ http://www.spigotmc.org - - - UTF-8 -@@ -19,10 +19,17 @@ - 1.6 - - -+ -+ org.spigotmc -+ spigot-parent -+ dev-SNAPSHOT -+ ../pom.xml -+ -+ - - -- org.bukkit -- bukkit -+ org.spigotmc -+ spigot-api - ${project.version} - compile - -@@ -56,6 +63,11 @@ - 5.1.37 - compile - -+ -+ net.sf.trove4j -+ trove4j -+ 3.0.3 -+ - - - junit -@@ -86,11 +98,26 @@ - net.md-5 - scriptus - 0.2 -- -- git-Bukkit-%s -- - - -+ ex-spigot -+ -+ git-Spigot-%s -+ ../ -+ spigot.desc -+ -+ initialize -+ -+ describe -+ -+ -+ -+ ex-craftbukkit -+ -+ -%s -+ ../../CraftBukkit -+ craftbukkit.desc -+ - initialize - - describe -@@ -107,7 +134,7 @@ - - org.bukkit.craftbukkit.Main - CraftBukkit -- ${describe} -+ ${spigot.desc}${craftbukkit.desc} - Bukkit Team - Bukkit - ${api.version} -diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java -index f905d17..9304637 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java -@@ -11,7 +11,7 @@ public final class Versioning { - public static String getBukkitVersion() { - String result = "Unknown-Version"; - -- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.bukkit/bukkit/pom.properties"); -+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.spigotmc/spigot-api/pom.properties"); - Properties properties = new Properties(); - - if (stream != null) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0002-Skeleton-API-Implementations.patch b/CraftBukkit-Patches/0002-Skeleton-API-Implementations.patch deleted file mode 100644 index 2e904bfe25..0000000000 --- a/CraftBukkit-Patches/0002-Skeleton-API-Implementations.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 166aa5db2d713b8877a070bf885da3f94f66cfb6 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 2 Jun 2013 15:10:56 +1000 -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 d330226..6b37266 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1653,4 +1653,14 @@ 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 2c82ecb..fb84060 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1508,4 +1508,14 @@ public class CraftWorld implements World { - cps.queueUnload(chunk.locX, chunk.locZ); - } - } -+ // Spigot start -+ private final Spigot spigot = new Spigot() -+ { -+ }; -+ -+ public Spigot spigot() -+ { -+ return spigot; -+ } -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java -index dca8520..bf48e6e 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java -@@ -71,4 +71,15 @@ public class CraftArrow extends AbstractProjectile implements Arrow { - public void _INVALID_setShooter(LivingEntity shooter) { - getHandle().shooter = ((CraftLivingEntity) shooter).getHandle(); - } -+ -+ // Spigot start -+ private final Arrow.Spigot spigot = new Arrow.Spigot() -+ { -+ }; -+ -+ public Arrow.Spigot spigot() -+ { -+ return spigot; -+ } -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 27c1851..cc88297 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -563,4 +563,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { - public boolean isGlowing() { - return getHandle().glowing; - } -+ -+ // Spigot start -+ private final Spigot spigot = new Spigot() -+ { -+ }; -+ -+ public Spigot spigot() -+ { -+ return spigot; -+ } -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java -index 64e346d..243e8e5 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java -@@ -27,4 +27,15 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike - public EntityType getType() { - return EntityType.LIGHTNING; - } -+ -+ // Spigot start -+ private final LightningStrike.Spigot spigot = new LightningStrike.Spigot() { -+ -+ }; -+ -+ @Override -+ public LightningStrike.Spigot spigot() { -+ return spigot; -+ } -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 303da2d..01ba89f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1402,4 +1402,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - getHandle().playerConnection.sendPacket(packetplayoutworldparticles); - - } -+ -+ // Spigot start -+ private final Player.Spigot spigot = new Player.Spigot() -+ { -+ }; -+ -+ public Player.Spigot spigot() -+ { -+ 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 294f6c9..0a5edb5 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -820,4 +820,16 @@ class CraftMetaItem implements ItemMeta, Repairable { - return HANDLED_TAGS; - } - } -+ -+ // Spigot start -+ private final Spigot spigot = new Spigot() -+ { -+ }; -+ -+ @Override -+ public Spigot spigot() -+ { -+ return spigot; -+ } -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java -index d3ae91b..0b71b53 100644 ---- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java -+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java -@@ -59,4 +59,11 @@ final class CraftScore implements Score { - public CraftScoreboard getScoreboard() { - return objective.getScoreboard(); - } -+ -+ // Spigot start -+ @Override -+ public boolean isScoreSet() throws IllegalStateException { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ // Spigot end - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0003-mc-dev-imports.patch b/CraftBukkit-Patches/0003-mc-dev-imports.patch deleted file mode 100644 index c96c70f0cc..0000000000 --- a/CraftBukkit-Patches/0003-mc-dev-imports.patch +++ /dev/null @@ -1,4522 +0,0 @@ -From 7240a96ab5bddb473069ea9c03370f8fb9e5a694 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 1 Dec 2013 15:10:48 +1100 -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/src/main/java/net/minecraft/server/AttributeRanged.java b/src/main/java/net/minecraft/server/AttributeRanged.java -new file mode 100644 -index 0000000..13602f0 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/AttributeRanged.java -@@ -0,0 +1,35 @@ -+package net.minecraft.server; -+ -+public class AttributeRanged extends AttributeBase { -+ -+ private final double a; -+ private final double b; -+ private String c; -+ -+ public AttributeRanged(IAttribute iattribute, String s, double d0, double d1, double d2) { -+ super(iattribute, s, d0); -+ this.a = d1; -+ this.b = d2; -+ if (d1 > d2) { -+ throw new IllegalArgumentException("Minimum value cannot be bigger than maximum value!"); -+ } else if (d0 < d1) { -+ throw new IllegalArgumentException("Default value cannot be lower than minimum value!"); -+ } else if (d0 > d2) { -+ throw new IllegalArgumentException("Default value cannot be bigger than maximum value!"); -+ } -+ } -+ -+ public AttributeRanged a(String s) { -+ this.c = s; -+ return this; -+ } -+ -+ public String g() { -+ return this.c; -+ } -+ -+ public double a(double d0) { -+ d0 = MathHelper.a(d0, this.a, this.b); -+ return d0; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java -new file mode 100644 -index 0000000..54140f7 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/BlockTNT.java -@@ -0,0 +1,98 @@ -+package net.minecraft.server; -+ -+public class BlockTNT extends Block { -+ -+ public static final BlockStateBoolean EXPLODE = BlockStateBoolean.of("explode"); -+ -+ public BlockTNT() { -+ super(Material.TNT); -+ this.w(this.blockStateList.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(false))); -+ this.a(CreativeModeTab.d); -+ } -+ -+ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { -+ super.onPlace(world, blockposition, iblockdata); -+ if (world.isBlockIndirectlyPowered(blockposition)) { -+ this.postBreak(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true))); -+ world.setAir(blockposition); -+ } -+ -+ } -+ -+ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) { -+ if (world.isBlockIndirectlyPowered(blockposition)) { -+ this.postBreak(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true))); -+ world.setAir(blockposition); -+ } -+ -+ } -+ -+ public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) { -+ if (!world.isClientSide) { -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); -+ -+ entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8)); -+ world.addEntity(entitytntprimed); -+ } -+ } -+ -+ public void postBreak(World world, BlockPosition blockposition, IBlockData iblockdata) { -+ this.a(world, blockposition, iblockdata, (EntityLiving) null); -+ } -+ -+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) { -+ if (!world.isClientSide) { -+ if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) { -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving); -+ -+ world.addEntity(entitytntprimed); -+ world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gj, SoundCategory.BLOCKS, 1.0F, 1.0F); -+ } -+ -+ } -+ } -+ -+ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) { -+ if (itemstack != null && (itemstack.getItem() == Items.FLINT_AND_STEEL || itemstack.getItem() == Items.FIRE_CHARGE)) { -+ this.a(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true)), (EntityLiving) entityhuman); -+ world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 11); -+ if (itemstack.getItem() == Items.FLINT_AND_STEEL) { -+ itemstack.damage(1, entityhuman); -+ } else if (!entityhuman.abilities.canInstantlyBuild) { -+ --itemstack.count; -+ } -+ -+ return true; -+ } else { -+ return super.interact(world, blockposition, iblockdata, entityhuman, enumhand, itemstack, enumdirection, f, f1, f2); -+ } -+ } -+ -+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) { -+ if (!world.isClientSide && entity instanceof EntityArrow) { -+ EntityArrow entityarrow = (EntityArrow) entity; -+ -+ if (entityarrow.isBurning()) { -+ this.a(world, blockposition, world.getType(blockposition).set(BlockTNT.EXPLODE, Boolean.valueOf(true)), entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null); -+ world.setAir(blockposition); -+ } -+ } -+ -+ } -+ -+ public boolean a(Explosion explosion) { -+ return false; -+ } -+ -+ public IBlockData fromLegacyData(int i) { -+ return this.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf((i & 1) > 0)); -+ } -+ -+ public int toLegacyData(IBlockData iblockdata) { -+ return ((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue() ? 1 : 0; -+ } -+ -+ protected BlockStateList getStateList() { -+ return new BlockStateList(this, new IBlockState[] { BlockTNT.EXPLODE}); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java -new file mode 100644 -index 0000000..3e4a31b ---- /dev/null -+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java -@@ -0,0 +1,125 @@ -+package net.minecraft.server; -+ -+import java.util.Iterator; -+ -+public class CommandDispatcher extends CommandHandler implements ICommandDispatcher { -+ -+ private final MinecraftServer a; -+ -+ public CommandDispatcher(MinecraftServer minecraftserver) { -+ this.a = minecraftserver; -+ this.a((ICommand) (new CommandTime())); -+ this.a((ICommand) (new CommandGamemode())); -+ this.a((ICommand) (new CommandDifficulty())); -+ this.a((ICommand) (new CommandGamemodeDefault())); -+ this.a((ICommand) (new CommandKill())); -+ this.a((ICommand) (new CommandToggleDownfall())); -+ this.a((ICommand) (new CommandWeather())); -+ this.a((ICommand) (new CommandXp())); -+ this.a((ICommand) (new CommandTp())); -+ this.a((ICommand) (new CommandGive())); -+ this.a((ICommand) (new CommandReplaceItem())); -+ this.a((ICommand) (new CommandStats())); -+ this.a((ICommand) (new CommandEffect())); -+ this.a((ICommand) (new CommandEnchant())); -+ this.a((ICommand) (new CommandParticle())); -+ this.a((ICommand) (new CommandMe())); -+ this.a((ICommand) (new CommandSeed())); -+ this.a((ICommand) (new CommandHelp())); -+ this.a((ICommand) (new CommandDebug())); -+ this.a((ICommand) (new CommandTell())); -+ this.a((ICommand) (new CommandSay())); -+ this.a((ICommand) (new CommandSpawnpoint())); -+ this.a((ICommand) (new CommandSetWorldSpawn())); -+ this.a((ICommand) (new CommandGamerule())); -+ this.a((ICommand) (new CommandClear())); -+ this.a((ICommand) (new CommandTestFor())); -+ this.a((ICommand) (new CommandSpreadPlayers())); -+ this.a((ICommand) (new CommandPlaySound())); -+ this.a((ICommand) (new CommandScoreboard())); -+ this.a((ICommand) (new CommandExecute())); -+ this.a((ICommand) (new CommandTrigger())); -+ this.a((ICommand) (new CommandAchievement())); -+ this.a((ICommand) (new CommandSummon())); -+ this.a((ICommand) (new CommandSetBlock())); -+ this.a((ICommand) (new CommandFill())); -+ this.a((ICommand) (new CommandClone())); -+ this.a((ICommand) (new CommandTestForBlocks())); -+ this.a((ICommand) (new CommandBlockData())); -+ this.a((ICommand) (new CommandTestForBlock())); -+ this.a((ICommand) (new CommandTellRaw())); -+ this.a((ICommand) (new CommandWorldBorder())); -+ this.a((ICommand) (new CommandTitle())); -+ this.a((ICommand) (new CommandEntityData())); -+ if (minecraftserver.aa()) { -+ this.a((ICommand) (new CommandOp())); -+ this.a((ICommand) (new CommandDeop())); -+ this.a((ICommand) (new CommandStop())); -+ this.a((ICommand) (new CommandSaveAll())); -+ this.a((ICommand) (new CommandSaveOff())); -+ this.a((ICommand) (new CommandSaveOn())); -+ this.a((ICommand) (new CommandBanIp())); -+ this.a((ICommand) (new CommandPardonIP())); -+ this.a((ICommand) (new CommandBan())); -+ this.a((ICommand) (new CommandBanList())); -+ this.a((ICommand) (new CommandPardon())); -+ this.a((ICommand) (new CommandKick())); -+ this.a((ICommand) (new CommandList())); -+ this.a((ICommand) (new CommandWhitelist())); -+ this.a((ICommand) (new CommandIdleTimeout())); -+ } else { -+ this.a((ICommand) (new CommandPublish())); -+ } -+ -+ CommandAbstract.a((ICommandDispatcher) this); -+ } -+ -+ public void a(ICommandListener icommandlistener, ICommand icommand, int i, String s, Object... aobject) { -+ boolean flag = true; -+ MinecraftServer minecraftserver = this.a; -+ -+ if (!icommandlistener.getSendCommandFeedback()) { -+ flag = false; -+ } -+ -+ ChatMessage chatmessage = new ChatMessage("chat.type.admin", new Object[] { icommandlistener.getName(), new ChatMessage(s, aobject)}); -+ -+ chatmessage.getChatModifier().setColor(EnumChatFormat.GRAY); -+ chatmessage.getChatModifier().setItalic(Boolean.valueOf(true)); -+ if (flag) { -+ Iterator iterator = minecraftserver.getPlayerList().v().iterator(); -+ -+ while (iterator.hasNext()) { -+ EntityHuman entityhuman = (EntityHuman) iterator.next(); -+ -+ if (entityhuman != icommandlistener && minecraftserver.getPlayerList().isOp(entityhuman.getProfile()) && icommand.canUse(this.a, icommandlistener)) { -+ boolean flag1 = icommandlistener instanceof MinecraftServer && this.a.s(); -+ boolean flag2 = icommandlistener instanceof RemoteControlCommandListener && this.a.r(); -+ -+ if (flag1 || flag2 || !(icommandlistener instanceof RemoteControlCommandListener) && !(icommandlistener instanceof MinecraftServer)) { -+ entityhuman.sendMessage(chatmessage); -+ } -+ } -+ } -+ } -+ -+ if (icommandlistener != minecraftserver && minecraftserver.worldServer[0].getGameRules().getBoolean("logAdminCommands")) { -+ minecraftserver.sendMessage(chatmessage); -+ } -+ -+ boolean flag3 = minecraftserver.worldServer[0].getGameRules().getBoolean("sendCommandFeedback"); -+ -+ if (icommandlistener instanceof CommandBlockListenerAbstract) { -+ flag3 = ((CommandBlockListenerAbstract) icommandlistener).n(); -+ } -+ -+ if ((i & 1) != 1 && flag3 || icommandlistener instanceof MinecraftServer) { -+ icommandlistener.sendMessage(new ChatMessage(s, aobject)); -+ } -+ -+ } -+ -+ protected MinecraftServer a() { -+ return this.a; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -new file mode 100644 -index 0000000..27ce9d9 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -@@ -0,0 +1,47 @@ -+package net.minecraft.server; -+ -+import com.google.gson.JsonObject; -+import com.mojang.authlib.GameProfile; -+import java.util.Date; -+import java.util.UUID; -+ -+public class GameProfileBanEntry extends ExpirableListEntry { -+ -+ public GameProfileBanEntry(GameProfile gameprofile) { -+ this(gameprofile, (Date) null, (String) null, (Date) null, (String) null); -+ } -+ -+ public GameProfileBanEntry(GameProfile gameprofile, Date date, String s, Date date1, String s1) { -+ super(gameprofile, date1, s, date1, s1); -+ } -+ -+ public GameProfileBanEntry(JsonObject jsonobject) { -+ super(b(jsonobject), jsonobject); -+ } -+ -+ protected void a(JsonObject jsonobject) { -+ if (this.getKey() != null) { -+ jsonobject.addProperty("uuid", ((GameProfile) this.getKey()).getId() == null ? "" : ((GameProfile) this.getKey()).getId().toString()); -+ jsonobject.addProperty("name", ((GameProfile) this.getKey()).getName()); -+ super.a(jsonobject); -+ } -+ } -+ -+ private static GameProfile b(JsonObject jsonobject) { -+ if (jsonobject.has("uuid") && jsonobject.has("name")) { -+ String s = jsonobject.get("uuid").getAsString(); -+ -+ UUID uuid; -+ -+ try { -+ uuid = UUID.fromString(s); -+ } catch (Throwable throwable) { -+ return null; -+ } -+ -+ return new GameProfile(uuid, jsonobject.get("name").getAsString()); -+ } else { -+ return null; -+ } -+ } -+} -diff --git a/src/main/java/net/minecraft/server/GenericAttributes.java b/src/main/java/net/minecraft/server/GenericAttributes.java -new file mode 100644 -index 0000000..16aaf1a ---- /dev/null -+++ b/src/main/java/net/minecraft/server/GenericAttributes.java -@@ -0,0 +1,116 @@ -+package net.minecraft.server; -+ -+import java.util.Collection; -+import java.util.Iterator; -+import java.util.UUID; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+ -+public class GenericAttributes { -+ -+ private static final Logger i = LogManager.getLogger(); -+ public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)).a("Max Health").a(true); -+ public static final IAttribute FOLLOW_RANGE = (new AttributeRanged((IAttribute) null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); -+ public static final IAttribute c = (new AttributeRanged((IAttribute) null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); -+ public static final IAttribute MOVEMENT_SPEED = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, 1024.0D)).a("Movement Speed").a(true); -+ public static final IAttribute ATTACK_DAMAGE = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, 2048.0D); -+ public static final IAttribute f = (new AttributeRanged((IAttribute) null, "generic.attackSpeed", 4.0D, 0.0D, 1024.0D)).a(true); -+ public static final IAttribute g = (new AttributeRanged((IAttribute) null, "generic.armor", 0.0D, 0.0D, 30.0D)).a(true); -+ public static final IAttribute h = (new AttributeRanged((IAttribute) null, "generic.luck", 0.0D, -1024.0D, 1024.0D)).a(true); -+ -+ public static NBTTagList a(AttributeMapBase attributemapbase) { -+ NBTTagList nbttaglist = new NBTTagList(); -+ Iterator iterator = attributemapbase.a().iterator(); -+ -+ while (iterator.hasNext()) { -+ AttributeInstance attributeinstance = (AttributeInstance) iterator.next(); -+ -+ nbttaglist.add(a(attributeinstance)); -+ } -+ -+ return nbttaglist; -+ } -+ -+ private static NBTTagCompound a(AttributeInstance attributeinstance) { -+ NBTTagCompound nbttagcompound = new NBTTagCompound(); -+ IAttribute iattribute = attributeinstance.getAttribute(); -+ -+ nbttagcompound.setString("Name", iattribute.getName()); -+ nbttagcompound.setDouble("Base", attributeinstance.b()); -+ Collection collection = attributeinstance.c(); -+ -+ if (collection != null && !collection.isEmpty()) { -+ NBTTagList nbttaglist = new NBTTagList(); -+ Iterator iterator = collection.iterator(); -+ -+ while (iterator.hasNext()) { -+ AttributeModifier attributemodifier = (AttributeModifier) iterator.next(); -+ -+ if (attributemodifier.e()) { -+ nbttaglist.add(a(attributemodifier)); -+ } -+ } -+ -+ nbttagcompound.set("Modifiers", nbttaglist); -+ } -+ -+ return nbttagcompound; -+ } -+ -+ public static NBTTagCompound a(AttributeModifier attributemodifier) { -+ NBTTagCompound nbttagcompound = new NBTTagCompound(); -+ -+ nbttagcompound.setString("Name", attributemodifier.b()); -+ nbttagcompound.setDouble("Amount", attributemodifier.d()); -+ nbttagcompound.setInt("Operation", attributemodifier.c()); -+ nbttagcompound.a("UUID", attributemodifier.a()); -+ return nbttagcompound; -+ } -+ -+ public static void a(AttributeMapBase attributemapbase, NBTTagList nbttaglist) { -+ for (int i = 0; i < nbttaglist.size(); ++i) { -+ NBTTagCompound nbttagcompound = nbttaglist.get(i); -+ AttributeInstance attributeinstance = attributemapbase.a(nbttagcompound.getString("Name")); -+ -+ if (attributeinstance != null) { -+ a(attributeinstance, nbttagcompound); -+ } else { -+ GenericAttributes.i.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'"); -+ } -+ } -+ -+ } -+ -+ private static void a(AttributeInstance attributeinstance, NBTTagCompound nbttagcompound) { -+ attributeinstance.setValue(nbttagcompound.getDouble("Base")); -+ if (nbttagcompound.hasKeyOfType("Modifiers", 9)) { -+ NBTTagList nbttaglist = nbttagcompound.getList("Modifiers", 10); -+ -+ for (int i = 0; i < nbttaglist.size(); ++i) { -+ AttributeModifier attributemodifier = a(nbttaglist.get(i)); -+ -+ if (attributemodifier != null) { -+ AttributeModifier attributemodifier1 = attributeinstance.a(attributemodifier.a()); -+ -+ if (attributemodifier1 != null) { -+ attributeinstance.c(attributemodifier1); -+ } -+ -+ attributeinstance.b(attributemodifier); -+ } -+ } -+ } -+ -+ } -+ -+ public static AttributeModifier a(NBTTagCompound nbttagcompound) { -+ UUID uuid = nbttagcompound.a("UUID"); -+ -+ try { -+ return new AttributeModifier(uuid, nbttagcompound.getString("Name"), nbttagcompound.getDouble("Amount"), nbttagcompound.getInt("Operation")); -+ } catch (Exception exception) { -+ GenericAttributes.i.warn("Unable to create attribute: " + exception.getMessage()); -+ return null; -+ } -+ } -+} -diff --git a/src/main/java/net/minecraft/server/IntCache.java b/src/main/java/net/minecraft/server/IntCache.java -new file mode 100644 -index 0000000..8167fdd ---- /dev/null -+++ b/src/main/java/net/minecraft/server/IntCache.java -@@ -0,0 +1,63 @@ -+package net.minecraft.server; -+ -+import com.google.common.collect.Lists; -+import java.util.List; -+ -+public class IntCache { -+ -+ private static int a = 256; -+ private static List b = Lists.newArrayList(); -+ private static List c = Lists.newArrayList(); -+ private static List d = Lists.newArrayList(); -+ private static List e = Lists.newArrayList(); -+ -+ public static synchronized int[] a(int i) { -+ int[] aint; -+ -+ if (i <= 256) { -+ if (IntCache.b.isEmpty()) { -+ aint = new int[256]; -+ IntCache.c.add(aint); -+ return aint; -+ } else { -+ aint = (int[]) IntCache.b.remove(IntCache.b.size() - 1); -+ IntCache.c.add(aint); -+ return aint; -+ } -+ } else if (i > IntCache.a) { -+ IntCache.a = i; -+ IntCache.d.clear(); -+ IntCache.e.clear(); -+ aint = new int[IntCache.a]; -+ IntCache.e.add(aint); -+ return aint; -+ } else if (IntCache.d.isEmpty()) { -+ aint = new int[IntCache.a]; -+ IntCache.e.add(aint); -+ return aint; -+ } else { -+ aint = (int[]) IntCache.d.remove(IntCache.d.size() - 1); -+ IntCache.e.add(aint); -+ return aint; -+ } -+ } -+ -+ public static synchronized void a() { -+ if (!IntCache.d.isEmpty()) { -+ IntCache.d.remove(IntCache.d.size() - 1); -+ } -+ -+ if (!IntCache.b.isEmpty()) { -+ IntCache.b.remove(IntCache.b.size() - 1); -+ } -+ -+ IntCache.d.addAll(IntCache.e); -+ IntCache.b.addAll(IntCache.c); -+ IntCache.e.clear(); -+ IntCache.c.clear(); -+ } -+ -+ public static synchronized String b() { -+ return "cache: " + IntCache.d.size() + ", tcache: " + IntCache.b.size() + ", allocated: " + IntCache.e.size() + ", tallocated: " + IntCache.c.size(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java -new file mode 100644 -index 0000000..669940a ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ItemDoor.java -@@ -0,0 +1,66 @@ -+package net.minecraft.server; -+ -+public class ItemDoor extends Item { -+ -+ private Block a; -+ -+ public ItemDoor(Block block) { -+ this.a = block; -+ this.a(CreativeModeTab.d); -+ } -+ -+ public EnumInteractionResult a(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) { -+ if (enumdirection != EnumDirection.UP) { -+ return EnumInteractionResult.FAIL; -+ } else { -+ IBlockData iblockdata = world.getType(blockposition); -+ Block block = iblockdata.getBlock(); -+ -+ if (!block.a((IBlockAccess) world, blockposition)) { -+ blockposition = blockposition.shift(enumdirection); -+ } -+ -+ if (entityhuman.a(blockposition, enumdirection, itemstack) && this.a.canPlace(world, blockposition)) { -+ EnumDirection enumdirection1 = EnumDirection.fromAngle((double) entityhuman.yaw); -+ int i = enumdirection1.getAdjacentX(); -+ int j = enumdirection1.getAdjacentZ(); -+ boolean flag = i < 0 && f2 < 0.5F || i > 0 && f2 > 0.5F || j < 0 && f > 0.5F || j > 0 && f < 0.5F; -+ -+ a(world, blockposition, enumdirection1, this.a, flag); -+ SoundEffectType soundeffecttype = this.a.w(); -+ -+ world.a(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); -+ --itemstack.count; -+ return EnumInteractionResult.SUCCESS; -+ } else { -+ return EnumInteractionResult.FAIL; -+ } -+ } -+ } -+ -+ public static void a(World world, BlockPosition blockposition, EnumDirection enumdirection, Block block, boolean flag) { -+ BlockPosition blockposition1 = blockposition.shift(enumdirection.e()); -+ BlockPosition blockposition2 = blockposition.shift(enumdirection.f()); -+ int i = (world.getType(blockposition2).l() ? 1 : 0) + (world.getType(blockposition2.up()).l() ? 1 : 0); -+ int j = (world.getType(blockposition1).l() ? 1 : 0) + (world.getType(blockposition1.up()).l() ? 1 : 0); -+ boolean flag1 = world.getType(blockposition2).getBlock() == block || world.getType(blockposition2.up()).getBlock() == block; -+ boolean flag2 = world.getType(blockposition1).getBlock() == block || world.getType(blockposition1.up()).getBlock() == block; -+ -+ if ((!flag1 || flag2) && j <= i) { -+ if (flag2 && !flag1 || j < i) { -+ flag = false; -+ } -+ } else { -+ flag = true; -+ } -+ -+ BlockPosition blockposition3 = blockposition.up(); -+ boolean flag3 = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition3); -+ IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag ? BlockDoor.EnumDoorHinge.RIGHT : BlockDoor.EnumDoorHinge.LEFT).set(BlockDoor.POWERED, Boolean.valueOf(flag3)).set(BlockDoor.OPEN, Boolean.valueOf(flag3)); -+ -+ world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2); -+ world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2); -+ world.applyPhysics(blockposition, block); -+ world.applyPhysics(blockposition3, block); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java -new file mode 100644 -index 0000000..40338ae ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ItemSkull.java -@@ -0,0 +1,123 @@ -+package net.minecraft.server; -+ -+import com.mojang.authlib.GameProfile; -+import java.util.UUID; -+ -+public class ItemSkull extends Item { -+ -+ private static final String[] a = new String[] { "skeleton", "wither", "zombie", "char", "creeper", "dragon"}; -+ -+ public ItemSkull() { -+ this.a(CreativeModeTab.c); -+ this.setMaxDurability(0); -+ this.a(true); -+ } -+ -+ public EnumInteractionResult a(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) { -+ if (enumdirection == EnumDirection.DOWN) { -+ return EnumInteractionResult.FAIL; -+ } else { -+ IBlockData iblockdata = world.getType(blockposition); -+ Block block = iblockdata.getBlock(); -+ boolean flag = block.a((IBlockAccess) world, blockposition); -+ -+ if (!flag) { -+ if (!world.getType(blockposition).getMaterial().isBuildable()) { -+ return EnumInteractionResult.FAIL; -+ } -+ -+ blockposition = blockposition.shift(enumdirection); -+ } -+ -+ if (entityhuman.a(blockposition, enumdirection, itemstack) && Blocks.SKULL.canPlace(world, blockposition)) { -+ if (world.isClientSide) { -+ return EnumInteractionResult.SUCCESS; -+ } else { -+ world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 11); -+ int i = 0; -+ -+ if (enumdirection == EnumDirection.UP) { -+ i = MathHelper.floor((double) (entityhuman.yaw * 16.0F / 360.0F) + 0.5D) & 15; -+ } -+ -+ TileEntity tileentity = world.getTileEntity(blockposition); -+ -+ if (tileentity instanceof TileEntitySkull) { -+ TileEntitySkull tileentityskull = (TileEntitySkull) tileentity; -+ -+ if (itemstack.getData() == 3) { -+ GameProfile gameprofile = null; -+ -+ if (itemstack.hasTag()) { -+ NBTTagCompound nbttagcompound = itemstack.getTag(); -+ -+ if (nbttagcompound.hasKeyOfType("SkullOwner", 10)) { -+ gameprofile = GameProfileSerializer.deserialize(nbttagcompound.getCompound("SkullOwner")); -+ } else if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && !nbttagcompound.getString("SkullOwner").isEmpty()) { -+ gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); -+ } -+ } -+ -+ tileentityskull.setGameProfile(gameprofile); -+ } else { -+ tileentityskull.setSkullType(itemstack.getData()); -+ } -+ -+ tileentityskull.setRotation(i); -+ Blocks.SKULL.a(world, blockposition, tileentityskull); -+ } -+ -+ --itemstack.count; -+ return EnumInteractionResult.SUCCESS; -+ } -+ } else { -+ return EnumInteractionResult.FAIL; -+ } -+ } -+ } -+ -+ public int filterData(int i) { -+ return i; -+ } -+ -+ public String f_(ItemStack itemstack) { -+ int i = itemstack.getData(); -+ -+ if (i < 0 || i >= ItemSkull.a.length) { -+ i = 0; -+ } -+ -+ return super.getName() + "." + ItemSkull.a[i]; -+ } -+ -+ public String a(ItemStack itemstack) { -+ if (itemstack.getData() == 3 && itemstack.hasTag()) { -+ if (itemstack.getTag().hasKeyOfType("SkullOwner", 8)) { -+ return LocaleI18n.a("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")}); -+ } -+ -+ if (itemstack.getTag().hasKeyOfType("SkullOwner", 10)) { -+ NBTTagCompound nbttagcompound = itemstack.getTag().getCompound("SkullOwner"); -+ -+ if (nbttagcompound.hasKeyOfType("Name", 8)) { -+ return LocaleI18n.a("item.skull.player.name", new Object[] { nbttagcompound.getString("Name")}); -+ } -+ } -+ } -+ -+ return super.a(itemstack); -+ } -+ -+ public boolean a(NBTTagCompound nbttagcompound) { -+ super.a(nbttagcompound); -+ if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && !nbttagcompound.getString("SkullOwner").isEmpty()) { -+ GameProfile gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); -+ -+ gameprofile = TileEntitySkull.b(gameprofile); -+ nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile)); -+ return true; -+ } else { -+ return false; -+ } -+ } -+} -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..2a04b86 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -@@ -0,0 +1,90 @@ -+package net.minecraft.server; -+ -+import java.io.BufferedInputStream; -+import java.io.BufferedOutputStream; -+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) throws IOException { -+ DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(inputstream))); -+ -+ NBTTagCompound nbttagcompound; -+ -+ try { -+ nbttagcompound = a((DataInput) datainputstream, NBTReadLimiter.a); -+ } finally { -+ datainputstream.close(); -+ } -+ -+ return nbttagcompound; -+ } -+ -+ public static void a(NBTTagCompound nbttagcompound, OutputStream outputstream) throws IOException { -+ DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(outputstream))); -+ -+ try { -+ a(nbttagcompound, (DataOutput) dataoutputstream); -+ } finally { -+ dataoutputstream.close(); -+ } -+ -+ } -+ -+ public static NBTTagCompound a(DataInputStream datainputstream) throws IOException { -+ return a((DataInput) datainputstream, NBTReadLimiter.a); -+ } -+ -+ public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) throws IOException { -+ 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"); -+ } -+ } -+ -+ public static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { -+ a((NBTBase) nbttagcompound, dataoutput); -+ } -+ -+ private static void a(NBTBase nbtbase, DataOutput dataoutput) throws IOException { -+ dataoutput.writeByte(nbtbase.getTypeId()); -+ if (nbtbase.getTypeId() != 0) { -+ dataoutput.writeUTF(""); -+ nbtbase.write(dataoutput); -+ } -+ } -+ -+ private static NBTBase a(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { -+ 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", (Object) "[UNNAMED TAG]"); -+ crashreportsystemdetails.a("Tag type", (Object) Byte.valueOf(b0)); -+ throw new ReportedException(crashreport); -+ } -+ } -+ } -+} -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 0000000..c6b5f70 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java -@@ -0,0 +1,58 @@ -+package net.minecraft.server; -+ -+import java.io.DataInput; -+import java.io.DataOutput; -+import java.io.IOException; -+import java.util.Arrays; -+ -+public class NBTTagByteArray extends NBTBase { -+ -+ private byte[] data; -+ -+ NBTTagByteArray() {} -+ -+ public NBTTagByteArray(byte[] abyte) { -+ this.data = abyte; -+ } -+ -+ void write(DataOutput dataoutput) throws IOException { -+ dataoutput.writeInt(this.data.length); -+ dataoutput.write(this.data); -+ } -+ -+ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { -+ nbtreadlimiter.a(192L); -+ int j = datainput.readInt(); -+ -+ nbtreadlimiter.a((long) (8 * j)); -+ this.data = new byte[j]; -+ datainput.readFully(this.data); -+ } -+ -+ public byte getTypeId() { -+ return (byte) 7; -+ } -+ -+ public String toString() { -+ return "[" + this.data.length + " bytes]"; -+ } -+ -+ public NBTBase clone() { -+ byte[] abyte = new byte[this.data.length]; -+ -+ System.arraycopy(this.data, 0, abyte, 0, this.data.length); -+ return new NBTTagByteArray(abyte); -+ } -+ -+ public boolean equals(Object object) { -+ return super.equals(object) ? Arrays.equals(this.data, ((NBTTagByteArray) object).data) : false; -+ } -+ -+ public int hashCode() { -+ return super.hashCode() ^ Arrays.hashCode(this.data); -+ } -+ -+ public byte[] c() { -+ return this.data; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/NBTTagIntArray.java b/src/main/java/net/minecraft/server/NBTTagIntArray.java -new file mode 100644 -index 0000000..5f17034 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java -@@ -0,0 +1,76 @@ -+package net.minecraft.server; -+ -+import java.io.DataInput; -+import java.io.DataOutput; -+import java.io.IOException; -+import java.util.Arrays; -+ -+public class NBTTagIntArray extends NBTBase { -+ -+ private int[] data; -+ -+ NBTTagIntArray() {} -+ -+ public NBTTagIntArray(int[] aint) { -+ this.data = aint; -+ } -+ -+ void write(DataOutput dataoutput) throws IOException { -+ dataoutput.writeInt(this.data.length); -+ -+ for (int i = 0; i < this.data.length; ++i) { -+ dataoutput.writeInt(this.data[i]); -+ } -+ -+ } -+ -+ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { -+ nbtreadlimiter.a(192L); -+ int j = datainput.readInt(); -+ -+ nbtreadlimiter.a((long) (32 * j)); -+ this.data = new int[j]; -+ -+ for (int k = 0; k < j; ++k) { -+ this.data[k] = datainput.readInt(); -+ } -+ -+ } -+ -+ public byte getTypeId() { -+ return (byte) 11; -+ } -+ -+ public String toString() { -+ String s = "["; -+ int[] aint = this.data; -+ int i = aint.length; -+ -+ for (int j = 0; j < i; ++j) { -+ int k = aint[j]; -+ -+ s = s + k + ","; -+ } -+ -+ return s + "]"; -+ } -+ -+ public NBTBase clone() { -+ int[] aint = new int[this.data.length]; -+ -+ System.arraycopy(this.data, 0, aint, 0, this.data.length); -+ return new NBTTagIntArray(aint); -+ } -+ -+ public boolean equals(Object object) { -+ return super.equals(object) ? Arrays.equals(this.data, ((NBTTagIntArray) object).data) : false; -+ } -+ -+ public int hashCode() { -+ return super.hashCode() ^ Arrays.hashCode(this.data); -+ } -+ -+ public int[] c() { -+ return this.data; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -new file mode 100644 -index 0000000..2f4265a ---- /dev/null -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -0,0 +1,275 @@ -+package net.minecraft.server; -+ -+public abstract class NavigationAbstract { -+ -+ private static int f = 20; -+ protected EntityInsentient a; -+ protected World b; -+ protected PathEntity c; -+ protected double d; -+ private final AttributeInstance g; -+ private int h; -+ private int i; -+ private Vec3D j; -+ private Vec3D k; -+ private long l; -+ private long m; -+ private double n; -+ private float o; -+ private boolean p; -+ private long q; -+ protected PathfinderAbstract e; -+ private BlockPosition r; -+ private final Pathfinder s; -+ -+ public NavigationAbstract(EntityInsentient entityinsentient, World world) { -+ this.j = Vec3D.a; -+ this.k = Vec3D.a; -+ this.l = 0L; -+ this.m = 0L; -+ this.o = 0.5F; -+ this.a = entityinsentient; -+ this.b = world; -+ this.g = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE); -+ this.s = this.a(); -+ this.b.C().a(this); -+ } -+ -+ protected abstract Pathfinder a(); -+ -+ public void a(double d0) { -+ this.d = d0; -+ } -+ -+ public float h() { -+ return (float) this.g.getValue(); -+ } -+ -+ public boolean i() { -+ return this.p; -+ } -+ -+ public void j() { -+ if (this.b.getTime() - this.q > (long) NavigationAbstract.f) { -+ if (this.r != null) { -+ this.c = null; -+ this.c = this.a(this.r); -+ this.q = this.b.getTime(); -+ this.p = false; -+ } -+ } else { -+ this.p = true; -+ } -+ -+ } -+ -+ public final PathEntity a(double d0, double d1, double d2) { -+ return this.a(new BlockPosition(MathHelper.floor(d0), (int) d1, MathHelper.floor(d2))); -+ } -+ -+ public PathEntity a(BlockPosition blockposition) { -+ if (!this.b()) { -+ return null; -+ } else if (this.c != null && !this.c.b() && blockposition.equals(this.r)) { -+ return this.c; -+ } else { -+ this.r = blockposition; -+ float f = this.h(); -+ -+ this.b.methodProfiler.a("pathfind"); -+ BlockPosition blockposition1 = new BlockPosition(this.a); -+ int i = (int) (f + 8.0F); -+ ChunkCache chunkcache = new ChunkCache(this.b, blockposition1.a(-i, -i, -i), blockposition1.a(i, i, i), 0); -+ PathEntity pathentity = this.s.a(chunkcache, this.a, this.r, f); -+ -+ this.b.methodProfiler.b(); -+ return pathentity; -+ } -+ } -+ -+ public PathEntity a(Entity entity) { -+ if (!this.b()) { -+ return null; -+ } else { -+ BlockPosition blockposition = new BlockPosition(entity); -+ -+ if (this.c != null && !this.c.b() && blockposition.equals(this.r)) { -+ return this.c; -+ } else { -+ this.r = blockposition; -+ float f = this.h(); -+ -+ this.b.methodProfiler.a("pathfind"); -+ BlockPosition blockposition1 = (new BlockPosition(this.a)).up(); -+ int i = (int) (f + 16.0F); -+ ChunkCache chunkcache = new ChunkCache(this.b, blockposition1.a(-i, -i, -i), blockposition1.a(i, i, i), 0); -+ PathEntity pathentity = this.s.a(chunkcache, this.a, entity, f); -+ -+ this.b.methodProfiler.b(); -+ return pathentity; -+ } -+ } -+ } -+ -+ public boolean a(double d0, double d1, double d2, double d3) { -+ PathEntity pathentity = this.a((double) MathHelper.floor(d0), (double) ((int) d1), (double) MathHelper.floor(d2)); -+ -+ return this.a(pathentity, d3); -+ } -+ -+ public boolean a(Entity entity, double d0) { -+ PathEntity pathentity = this.a(entity); -+ -+ return pathentity != null ? this.a(pathentity, d0) : false; -+ } -+ -+ public boolean a(PathEntity pathentity, double d0) { -+ if (pathentity == null) { -+ this.c = null; -+ return false; -+ } else { -+ if (!pathentity.a(this.c)) { -+ this.c = pathentity; -+ } -+ -+ this.d(); -+ if (this.c.d() == 0) { -+ return false; -+ } else { -+ this.d = d0; -+ Vec3D vec3d = this.c(); -+ -+ this.i = this.h; -+ this.j = vec3d; -+ return true; -+ } -+ } -+ } -+ -+ public PathEntity k() { -+ return this.c; -+ } -+ -+ public void l() { -+ ++this.h; -+ if (this.p) { -+ this.j(); -+ } -+ -+ if (!this.n()) { -+ Vec3D vec3d; -+ -+ if (this.b()) { -+ this.m(); -+ } else if (this.c != null && this.c.e() < this.c.d()) { -+ vec3d = this.c(); -+ Vec3D vec3d1 = this.c.a(this.a, this.c.e()); -+ -+ if (vec3d.y > vec3d1.y && !this.a.onGround && MathHelper.floor(vec3d.x) == MathHelper.floor(vec3d1.x) && MathHelper.floor(vec3d.z) == MathHelper.floor(vec3d1.z)) { -+ this.c.c(this.c.e() + 1); -+ } -+ } -+ -+ if (!this.n()) { -+ vec3d = this.c.a((Entity) this.a); -+ if (vec3d != null) { -+ BlockPosition blockposition = (new BlockPosition(vec3d)).down(); -+ AxisAlignedBB axisalignedbb = this.b.getType(blockposition).c(this.b, blockposition); -+ -+ vec3d = vec3d.a(0.0D, 1.0D - axisalignedbb.e, 0.0D); -+ this.a.getControllerMove().a(vec3d.x, vec3d.y, vec3d.z, this.d); -+ } -+ } -+ } -+ } -+ -+ protected void m() { -+ Vec3D vec3d = this.c(); -+ int i = this.c.d(); -+ -+ for (int j = this.c.e(); j < this.c.d(); ++j) { -+ if ((double) this.c.a(j).b != Math.floor(vec3d.y)) { -+ i = j; -+ break; -+ } -+ } -+ -+ this.o = this.a.width > 0.75F ? this.a.width / 2.0F : 0.75F - this.a.width / 2.0F; -+ Vec3D vec3d1 = this.c.f(); -+ -+ if (MathHelper.e((float) (this.a.locX - (vec3d1.x + 0.5D))) < this.o && MathHelper.e((float) (this.a.locZ - (vec3d1.z + 0.5D))) < this.o) { -+ this.c.c(this.c.e() + 1); -+ } -+ -+ int k = MathHelper.f(this.a.width); -+ int l = (int) this.a.length + 1; -+ int i1 = k; -+ -+ for (int j1 = i - 1; j1 >= this.c.e(); --j1) { -+ if (this.a(vec3d, this.c.a(this.a, j1), k, l, i1)) { -+ this.c.c(j1); -+ break; -+ } -+ } -+ -+ this.a(vec3d); -+ } -+ -+ protected void a(Vec3D vec3d) { -+ if (this.h - this.i > 100) { -+ if (vec3d.distanceSquared(this.j) < 2.25D) { -+ this.o(); -+ } -+ -+ this.i = this.h; -+ this.j = vec3d; -+ } -+ -+ if (this.c != null && !this.c.b()) { -+ Vec3D vec3d1 = this.c.f(); -+ -+ if (!vec3d1.equals(this.k)) { -+ this.k = vec3d1; -+ double d0 = vec3d.f(this.k); -+ -+ this.n = this.a.ck() > 0.0F ? d0 / (double) this.a.ck() * 1000.0D : 0.0D; -+ } else { -+ this.l += System.currentTimeMillis() - this.m; -+ } -+ -+ if (this.n > 0.0D && (double) this.l > this.n * 3.0D) { -+ this.k = Vec3D.a; -+ this.l = 0L; -+ this.n = 0.0D; -+ this.o(); -+ } -+ -+ this.m = System.currentTimeMillis(); -+ } -+ -+ } -+ -+ public boolean n() { -+ return this.c == null || this.c.b(); -+ } -+ -+ public void o() { -+ this.c = null; -+ } -+ -+ protected abstract Vec3D c(); -+ -+ protected abstract boolean b(); -+ -+ protected boolean p() { -+ return this.a.isInWater() || this.a.an(); -+ } -+ -+ protected void d() {} -+ -+ protected abstract boolean a(Vec3D vec3d, Vec3D vec3d1, int i, int j, int k); -+ -+ public boolean b(BlockPosition blockposition) { -+ return this.b.getType(blockposition.down()).b(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/NavigationListener.java b/src/main/java/net/minecraft/server/NavigationListener.java -new file mode 100644 -index 0000000..f82ea80 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/NavigationListener.java -@@ -0,0 +1,69 @@ -+package net.minecraft.server; -+ -+import java.util.WeakHashMap; -+ -+public class NavigationListener implements IWorldAccess { -+ -+ private static final Object a = new Object(); -+ private final WeakHashMap b = new WeakHashMap(); -+ -+ public NavigationListener() {} -+ -+ public void a(NavigationAbstract navigationabstract) { -+ this.b.put(navigationabstract, NavigationListener.a); -+ } -+ -+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, int i) { -+ if (this.a(world, blockposition, iblockdata, iblockdata1)) { -+ NavigationAbstract[] anavigationabstract = (NavigationAbstract[]) this.b.keySet().toArray(new NavigationAbstract[0]); -+ NavigationAbstract[] anavigationabstract1 = anavigationabstract; -+ int j = anavigationabstract.length; -+ -+ for (int k = 0; k < j; ++k) { -+ NavigationAbstract navigationabstract = anavigationabstract1[k]; -+ -+ if (navigationabstract != null && !navigationabstract.i()) { -+ PathEntity pathentity = navigationabstract.k(); -+ -+ if (pathentity != null && !pathentity.b() && pathentity.d() != 0) { -+ PathPoint pathpoint = navigationabstract.c.c(); -+ double d0 = blockposition.distanceSquared(((double) pathpoint.a + navigationabstract.a.locX) / 2.0D, ((double) pathpoint.b + navigationabstract.a.locY) / 2.0D, ((double) pathpoint.c + navigationabstract.a.locZ) / 2.0D); -+ int l = (pathentity.d() - pathentity.e()) * (pathentity.d() - pathentity.e()); -+ -+ if (d0 < (double) l) { -+ navigationabstract.j(); -+ } -+ } -+ } -+ } -+ -+ } -+ } -+ -+ protected boolean a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) { -+ AxisAlignedBB axisalignedbb = iblockdata.d(world, blockposition); -+ AxisAlignedBB axisalignedbb1 = iblockdata1.d(world, blockposition); -+ -+ return axisalignedbb != axisalignedbb1 && (axisalignedbb == null || !axisalignedbb.equals(axisalignedbb1)); -+ } -+ -+ public void a(BlockPosition blockposition) {} -+ -+ public void a(int i, int j, int k, int l, int i1, int j1) {} -+ -+ public void a(EntityHuman entityhuman, SoundEffect soundeffect, SoundCategory soundcategory, double d0, double d1, double d2, float f, float f1) {} -+ -+ public void a(int i, boolean flag, double d0, double d1, double d2, double d3, double d4, double d5, int... aint) {} -+ -+ public void a(Entity entity) {} -+ -+ public void b(Entity entity) {} -+ -+ public void a(SoundEffect soundeffect, BlockPosition blockposition) {} -+ -+ public void a(int i, BlockPosition blockposition, int j) {} -+ -+ public void a(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) {} -+ -+ public void b(int i, BlockPosition blockposition, int j) {} -+} -diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -new file mode 100644 -index 0000000..86f1be7 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -@@ -0,0 +1,39 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketHandshakingInSetProtocol implements Packet { -+ -+ private int a; -+ public String hostname; -+ public int port; -+ private EnumProtocol d; -+ -+ public PacketHandshakingInSetProtocol() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.g(); -+ this.hostname = packetdataserializer.c(255); -+ this.port = packetdataserializer.readUnsignedShort(); -+ this.d = EnumProtocol.a(packetdataserializer.g()); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.b(this.a); -+ packetdataserializer.a(this.hostname); -+ packetdataserializer.writeShort(this.port); -+ packetdataserializer.b(this.d.a()); -+ } -+ -+ public void a(PacketHandshakingInListener packethandshakinginlistener) { -+ packethandshakinginlistener.a(this); -+ } -+ -+ public EnumProtocol a() { -+ return this.d; -+ } -+ -+ public int b() { -+ return this.a; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -new file mode 100644 -index 0000000..cb0356e ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -@@ -0,0 +1,30 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayInArmAnimation implements Packet { -+ -+ private EnumHand a; -+ -+ public PacketPlayInArmAnimation() {} -+ -+ public PacketPlayInArmAnimation(EnumHand enumhand) { -+ this.a = enumhand; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = (EnumHand) packetdataserializer.a(EnumHand.class); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a((Enum) this.a); -+ } -+ -+ public void a(PacketListenerPlayIn packetlistenerplayin) { -+ packetlistenerplayin.a(this); -+ } -+ -+ public EnumHand a() { -+ return this.a; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main/java/net/minecraft/server/PacketPlayInChat.java -new file mode 100644 -index 0000000..0ab90f3 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java -@@ -0,0 +1,34 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayInChat implements Packet { -+ -+ private String a; -+ -+ public PacketPlayInChat() {} -+ -+ public PacketPlayInChat(String s) { -+ if (s.length() > 100) { -+ s = s.substring(0, 100); -+ } -+ -+ this.a = s; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(100); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ } -+ -+ public void a(PacketListenerPlayIn packetlistenerplayin) { -+ packetlistenerplayin.a(this); -+ } -+ -+ public String a() { -+ return this.a; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -new file mode 100644 -index 0000000..c5147b6 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -0,0 +1,38 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutChat implements Packet { -+ -+ private IChatBaseComponent a; -+ private byte b; -+ -+ public PacketPlayOutChat() {} -+ -+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent) { -+ this(ichatbasecomponent, (byte) 1); -+ } -+ -+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, byte b0) { -+ this.a = ichatbasecomponent; -+ this.b = b0; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.f(); -+ this.b = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.writeByte(this.b); -+ } -+ -+ public void a(PacketListenerPlayOut packetlistenerplayout) { -+ packetlistenerplayout.a(this); -+ } -+ -+ public boolean b() { -+ return this.b == 1 || this.b == 2; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -new file mode 100644 -index 0000000..b5dc220 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -0,0 +1,110 @@ -+package net.minecraft.server; -+ -+import io.netty.buffer.ByteBuf; -+import io.netty.buffer.Unpooled; -+import java.io.IOException; -+ -+public class PacketPlayOutMapChunk implements Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private byte[] d; -+ private boolean e; -+ -+ public PacketPlayOutMapChunk() {} -+ -+ public PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i) { -+ this.a = chunk.locX; -+ this.b = chunk.locZ; -+ this.e = flag; -+ boolean flag1 = !chunk.getWorld().worldProvider.m(); -+ -+ this.d = new byte[a(chunk, flag, flag1, i)]; -+ this.c = a(new PacketDataSerializer(this.f()), chunk, flag, flag1, i); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readInt(); -+ this.e = packetdataserializer.readBoolean(); -+ this.c = packetdataserializer.g(); -+ int i = packetdataserializer.g(); -+ -+ if (i > 2097152) { -+ throw new RuntimeException("Chunk Packet trying to allocate too much memory on read."); -+ } else { -+ this.d = new byte[i]; -+ packetdataserializer.readBytes(this.d); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeBoolean(this.e); -+ packetdataserializer.b(this.c); -+ packetdataserializer.b(this.d.length); -+ packetdataserializer.writeBytes(this.d); -+ } -+ -+ public void a(PacketListenerPlayOut packetlistenerplayout) { -+ packetlistenerplayout.a(this); -+ } -+ -+ private ByteBuf f() { -+ ByteBuf bytebuf = Unpooled.wrappedBuffer(this.d); -+ -+ bytebuf.writerIndex(0); -+ return bytebuf; -+ } -+ -+ public static int a(PacketDataSerializer packetdataserializer, Chunk chunk, boolean flag, boolean flag1, int i) { -+ int j = 0; -+ ChunkSection[] achunksection = chunk.getSections(); -+ int k = 0; -+ -+ for (int l = achunksection.length; k < l; ++k) { -+ ChunkSection chunksection = achunksection[k]; -+ -+ if (chunksection != Chunk.a && (!flag || !chunksection.a()) && (i & 1 << k) != 0) { -+ j |= 1 << k; -+ chunksection.getBlocks().b(packetdataserializer); -+ packetdataserializer.writeBytes(chunksection.getEmittedLightArray().asBytes()); -+ if (flag1) { -+ packetdataserializer.writeBytes(chunksection.getSkyLightArray().asBytes()); -+ } -+ } -+ } -+ -+ if (flag) { -+ packetdataserializer.writeBytes(chunk.getBiomeIndex()); -+ } -+ -+ return j; -+ } -+ -+ protected static int a(Chunk chunk, boolean flag, boolean flag1, int i) { -+ int j = 0; -+ ChunkSection[] achunksection = chunk.getSections(); -+ int k = 0; -+ -+ for (int l = achunksection.length; k < l; ++k) { -+ ChunkSection chunksection = achunksection[k]; -+ -+ if (chunksection != Chunk.a && (!flag || !chunksection.a()) && (i & 1 << k) != 0) { -+ j += chunksection.getBlocks().a(); -+ j += chunksection.getEmittedLightArray().asBytes().length; -+ if (flag1) { -+ j += chunksection.getSkyLightArray().asBytes().length; -+ } -+ } -+ } -+ -+ if (flag) { -+ j += chunk.getBiomeIndex().length; -+ } -+ -+ return j; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java -new file mode 100644 -index 0000000..c29e3f7 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PersistentCollection.java -@@ -0,0 +1,183 @@ -+package net.minecraft.server; -+ -+import com.google.common.collect.Lists; -+import com.google.common.collect.Maps; -+import java.io.DataInputStream; -+import java.io.DataOutput; -+import java.io.DataOutputStream; -+import java.io.File; -+import java.io.FileInputStream; -+import java.io.FileOutputStream; -+import java.io.InputStream; -+import java.io.OutputStream; -+import java.util.Iterator; -+import java.util.List; -+import java.util.Map; -+ -+public class PersistentCollection { -+ -+ private IDataManager b; -+ protected Map a = Maps.newHashMap(); -+ private List c = Lists.newArrayList(); -+ private Map d = Maps.newHashMap(); -+ -+ public PersistentCollection(IDataManager idatamanager) { -+ this.b = idatamanager; -+ this.b(); -+ } -+ -+ public PersistentBase get(Class oclass, String s) { -+ PersistentBase persistentbase = (PersistentBase) this.a.get(s); -+ -+ if (persistentbase != null) { -+ return persistentbase; -+ } else { -+ if (this.b != null) { -+ try { -+ File file = this.b.getDataFile(s); -+ -+ if (file != null && file.exists()) { -+ try { -+ persistentbase = (PersistentBase) oclass.getConstructor(new Class[] { String.class}).newInstance(new Object[] { s}); -+ } catch (Exception exception) { -+ throw new RuntimeException("Failed to instantiate " + oclass.toString(), exception); -+ } -+ -+ FileInputStream fileinputstream = new FileInputStream(file); -+ NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a((InputStream) fileinputstream); -+ -+ fileinputstream.close(); -+ persistentbase.a(nbttagcompound.getCompound("data")); -+ } -+ } catch (Exception exception1) { -+ exception1.printStackTrace(); -+ } -+ } -+ -+ if (persistentbase != null) { -+ this.a.put(s, persistentbase); -+ this.c.add(persistentbase); -+ } -+ -+ return persistentbase; -+ } -+ } -+ -+ public void a(String s, PersistentBase persistentbase) { -+ if (this.a.containsKey(s)) { -+ this.c.remove(this.a.remove(s)); -+ } -+ -+ this.a.put(s, persistentbase); -+ this.c.add(persistentbase); -+ } -+ -+ public void a() { -+ for (int i = 0; i < this.c.size(); ++i) { -+ PersistentBase persistentbase = (PersistentBase) this.c.get(i); -+ -+ if (persistentbase.d()) { -+ this.a(persistentbase); -+ persistentbase.a(false); -+ } -+ } -+ -+ } -+ -+ private void a(PersistentBase persistentbase) { -+ if (this.b != null) { -+ try { -+ File file = this.b.getDataFile(persistentbase.id); -+ -+ if (file != null) { -+ NBTTagCompound nbttagcompound = new NBTTagCompound(); -+ -+ persistentbase.b(nbttagcompound); -+ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); -+ -+ nbttagcompound1.set("data", nbttagcompound); -+ FileOutputStream fileoutputstream = new FileOutputStream(file); -+ -+ NBTCompressedStreamTools.a(nbttagcompound1, (OutputStream) fileoutputstream); -+ fileoutputstream.close(); -+ } -+ } catch (Exception exception) { -+ exception.printStackTrace(); -+ } -+ -+ } -+ } -+ -+ private void b() { -+ try { -+ this.d.clear(); -+ if (this.b == null) { -+ return; -+ } -+ -+ File file = this.b.getDataFile("idcounts"); -+ -+ if (file != null && file.exists()) { -+ DataInputStream datainputstream = new DataInputStream(new FileInputStream(file)); -+ NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a(datainputstream); -+ -+ datainputstream.close(); -+ Iterator iterator = nbttagcompound.c().iterator(); -+ -+ while (iterator.hasNext()) { -+ String s = (String) iterator.next(); -+ NBTBase nbtbase = nbttagcompound.get(s); -+ -+ if (nbtbase instanceof NBTTagShort) { -+ NBTTagShort nbttagshort = (NBTTagShort) nbtbase; -+ short short0 = nbttagshort.e(); -+ -+ this.d.put(s, Short.valueOf(short0)); -+ } -+ } -+ } -+ } catch (Exception exception) { -+ exception.printStackTrace(); -+ } -+ -+ } -+ -+ public int a(String s) { -+ Short oshort = (Short) this.d.get(s); -+ -+ if (oshort == null) { -+ oshort = Short.valueOf((short) 0); -+ } else { -+ oshort = Short.valueOf((short) (oshort.shortValue() + 1)); -+ } -+ -+ this.d.put(s, oshort); -+ if (this.b == null) { -+ return oshort.shortValue(); -+ } else { -+ try { -+ File file = this.b.getDataFile("idcounts"); -+ -+ if (file != null) { -+ NBTTagCompound nbttagcompound = new NBTTagCompound(); -+ Iterator iterator = this.d.keySet().iterator(); -+ -+ while (iterator.hasNext()) { -+ String s1 = (String) iterator.next(); -+ -+ nbttagcompound.setShort(s1, ((Short) this.d.get(s1)).shortValue()); -+ } -+ -+ DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file)); -+ -+ NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream); -+ dataoutputstream.close(); -+ } -+ } catch (Exception exception) { -+ exception.printStackTrace(); -+ } -+ -+ return oshort.shortValue(); -+ } -+ } -+} -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -new file mode 100644 -index 0000000..b07e7d5 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -0,0 +1,67 @@ -+package net.minecraft.server; -+ -+import com.google.common.collect.Maps; -+import java.io.DataInputStream; -+import java.io.DataOutputStream; -+import java.io.File; -+import java.io.IOException; -+import java.util.Iterator; -+import java.util.Map; -+ -+public class RegionFileCache { -+ -+ private static final Map a = Maps.newHashMap(); -+ -+ public static synchronized RegionFile a(File file, int i, int j) { -+ File file1 = new File(file, "region"); -+ File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca"); -+ RegionFile regionfile = (RegionFile) RegionFileCache.a.get(file2); -+ -+ if (regionfile != null) { -+ return regionfile; -+ } else { -+ if (!file1.exists()) { -+ file1.mkdirs(); -+ } -+ -+ if (RegionFileCache.a.size() >= 256) { -+ a(); -+ } -+ -+ RegionFile regionfile1 = new RegionFile(file2); -+ -+ RegionFileCache.a.put(file2, regionfile1); -+ return regionfile1; -+ } -+ } -+ -+ public static synchronized void a() { -+ Iterator iterator = RegionFileCache.a.values().iterator(); -+ -+ while (iterator.hasNext()) { -+ RegionFile regionfile = (RegionFile) iterator.next(); -+ -+ try { -+ if (regionfile != null) { -+ regionfile.c(); -+ } -+ } catch (IOException ioexception) { -+ ioexception.printStackTrace(); -+ } -+ } -+ -+ RegionFileCache.a.clear(); -+ } -+ -+ public static DataInputStream c(File file, int i, int j) { -+ RegionFile regionfile = a(file, i, j); -+ -+ return regionfile.a(i & 31, j & 31); -+ } -+ -+ public static DataOutputStream d(File file, int i, int j) { -+ RegionFile regionfile = a(file, i, j); -+ -+ return regionfile.b(i & 31, j & 31); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java -new file mode 100644 -index 0000000..968a1b7 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ServerConnection.java -@@ -0,0 +1,175 @@ -+package net.minecraft.server; -+ -+import com.google.common.collect.Lists; -+import com.google.common.util.concurrent.ThreadFactoryBuilder; -+import io.netty.bootstrap.ServerBootstrap; -+import io.netty.channel.Channel; -+import io.netty.channel.ChannelException; -+import io.netty.channel.ChannelFuture; -+import io.netty.channel.ChannelInitializer; -+import io.netty.channel.ChannelOption; -+import io.netty.channel.EventLoopGroup; -+import io.netty.channel.epoll.Epoll; -+import io.netty.channel.epoll.EpollEventLoopGroup; -+import io.netty.channel.epoll.EpollServerSocketChannel; -+import io.netty.channel.local.LocalEventLoopGroup; -+import io.netty.channel.nio.NioEventLoopGroup; -+import io.netty.channel.socket.nio.NioServerSocketChannel; -+import io.netty.handler.timeout.ReadTimeoutHandler; -+import io.netty.util.concurrent.Future; -+import io.netty.util.concurrent.GenericFutureListener; -+import java.io.IOException; -+import java.net.InetAddress; -+import java.util.Collections; -+import java.util.Iterator; -+import java.util.List; -+import java.util.concurrent.Callable; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+ -+public class ServerConnection { -+ -+ private static final Logger e = LogManager.getLogger(); -+ public static final LazyInitVar a = new LazyInitVar() { -+ protected NioEventLoopGroup a() { -+ return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).build()); -+ } -+ -+ protected Object init() { -+ return this.a(); -+ } -+ }; -+ public static final LazyInitVar b = new LazyInitVar() { -+ protected EpollEventLoopGroup a() { -+ return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).build()); -+ } -+ -+ protected Object init() { -+ return this.a(); -+ } -+ }; -+ public static final LazyInitVar c = new LazyInitVar() { -+ protected LocalEventLoopGroup a() { -+ return new LocalEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Server IO #%d").setDaemon(true).build()); -+ } -+ -+ protected Object init() { -+ return this.a(); -+ } -+ }; -+ private final MinecraftServer f; -+ public volatile boolean d; -+ private final List g = Collections.synchronizedList(Lists.newArrayList()); -+ private final List h = Collections.synchronizedList(Lists.newArrayList()); -+ -+ public ServerConnection(MinecraftServer minecraftserver) { -+ this.f = minecraftserver; -+ this.d = true; -+ } -+ -+ public void a(InetAddress inetaddress, int i) throws IOException { -+ List list = this.g; -+ -+ synchronized (this.g) { -+ Class oclass; -+ LazyInitVar lazyinitvar; -+ -+ if (Epoll.isAvailable() && this.f.ae()) { -+ oclass = EpollServerSocketChannel.class; -+ lazyinitvar = ServerConnection.b; -+ ServerConnection.e.info("Using epoll channel type"); -+ } else { -+ oclass = NioServerSocketChannel.class; -+ lazyinitvar = ServerConnection.a; -+ ServerConnection.e.info("Using default channel type"); -+ } -+ -+ this.g.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer() { -+ protected void initChannel(Channel channel) throws Exception { -+ try { -+ channel.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true)); -+ } catch (ChannelException channelexception) { -+ ; -+ } -+ -+ channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(ServerConnection.this)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND)); -+ NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND); -+ -+ ServerConnection.this.h.add(networkmanager); -+ channel.pipeline().addLast("packet_handler", networkmanager); -+ networkmanager.setPacketListener(new HandshakeListener(ServerConnection.this.f, networkmanager)); -+ } -+ }).group((EventLoopGroup) lazyinitvar.c()).localAddress(inetaddress, i)).bind().syncUninterruptibly()); -+ } -+ } -+ -+ public void b() { -+ this.d = false; -+ Iterator iterator = this.g.iterator(); -+ -+ while (iterator.hasNext()) { -+ ChannelFuture channelfuture = (ChannelFuture) iterator.next(); -+ -+ try { -+ channelfuture.channel().close().sync(); -+ } catch (InterruptedException interruptedexception) { -+ ServerConnection.e.error("Interrupted whilst closing channel"); -+ } -+ } -+ -+ } -+ -+ public void c() { -+ List list = this.h; -+ -+ synchronized (this.h) { -+ Iterator iterator = this.h.iterator(); -+ -+ while (iterator.hasNext()) { -+ final NetworkManager networkmanager = (NetworkManager) iterator.next(); -+ -+ if (!networkmanager.h()) { -+ if (networkmanager.isConnected()) { -+ try { -+ networkmanager.a(); -+ } catch (Exception exception) { -+ if (networkmanager.isLocal()) { -+ CrashReport crashreport = CrashReport.a(exception, "Ticking memory connection"); -+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Ticking connection"); -+ -+ crashreportsystemdetails.a("Connection", new Callable() { -+ public String a() throws Exception { -+ return networkmanager.toString(); -+ } -+ -+ public Object call() throws Exception { -+ return this.a(); -+ } -+ }); -+ throw new ReportedException(crashreport); -+ } -+ -+ ServerConnection.e.warn("Failed to handle packet for " + networkmanager.getSocketAddress(), exception); -+ final ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error"); -+ -+ networkmanager.sendPacket(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener() { -+ public void operationComplete(Future future) throws Exception { -+ networkmanager.close(chatcomponenttext); -+ } -+ }, new GenericFutureListener[0]); -+ networkmanager.stopReading(); -+ } -+ } else { -+ iterator.remove(); -+ networkmanager.handleDisconnection(); -+ } -+ } -+ } -+ -+ } -+ } -+ -+ public MinecraftServer d() { -+ return this.f; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java -new file mode 100644 -index 0000000..76bd9c1 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java -@@ -0,0 +1,212 @@ -+package net.minecraft.server; -+ -+import com.google.common.collect.Maps; -+import com.google.common.collect.Sets; -+import com.google.gson.JsonElement; -+import com.google.gson.JsonObject; -+import com.google.gson.JsonParseException; -+import com.google.gson.JsonParser; -+import java.io.File; -+import java.io.IOException; -+import java.lang.reflect.Constructor; -+import java.util.HashMap; -+import java.util.HashSet; -+import java.util.Iterator; -+import java.util.Map; -+import java.util.Set; -+import java.util.Map.Entry; -+import org.apache.commons.io.FileUtils; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+ -+public class ServerStatisticManager extends StatisticManager { -+ -+ private static final Logger b = LogManager.getLogger(); -+ private final MinecraftServer c; -+ private final File d; -+ private final Set e = Sets.newHashSet(); -+ private int f = -300; -+ private boolean g = false; -+ -+ public ServerStatisticManager(MinecraftServer minecraftserver, File file) { -+ this.c = minecraftserver; -+ this.d = file; -+ } -+ -+ public void a() { -+ if (this.d.isFile()) { -+ try { -+ this.a.clear(); -+ this.a.putAll(this.a(FileUtils.readFileToString(this.d))); -+ } catch (IOException ioexception) { -+ ServerStatisticManager.b.error("Couldn\'t read statistics file " + this.d, ioexception); -+ } catch (JsonParseException jsonparseexception) { -+ ServerStatisticManager.b.error("Couldn\'t parse statistics file " + this.d, jsonparseexception); -+ } -+ } -+ -+ } -+ -+ public void b() { -+ try { -+ FileUtils.writeStringToFile(this.d, a(this.a)); -+ } catch (IOException ioexception) { -+ ServerStatisticManager.b.error("Couldn\'t save stats", ioexception); -+ } -+ -+ } -+ -+ public void setStatistic(EntityHuman entityhuman, Statistic statistic, int i) { -+ int j = statistic.d() ? this.getStatisticValue(statistic) : 0; -+ -+ super.setStatistic(entityhuman, statistic, i); -+ this.e.add(statistic); -+ if (statistic.d() && j == 0 && i > 0) { -+ this.g = true; -+ if (this.c.ax()) { -+ this.c.getPlayerList().sendMessage(new ChatMessage("chat.type.achievement", new Object[] { entityhuman.getScoreboardDisplayName(), statistic.j()})); -+ } -+ } -+ -+ if (statistic.d() && j > 0 && i == 0) { -+ this.g = true; -+ if (this.c.ax()) { -+ this.c.getPlayerList().sendMessage(new ChatMessage("chat.type.achievement.taken", new Object[] { entityhuman.getScoreboardDisplayName(), statistic.j()})); -+ } -+ } -+ -+ } -+ -+ public Set c() { -+ HashSet hashset = Sets.newHashSet(this.e); -+ -+ this.e.clear(); -+ this.g = false; -+ return hashset; -+ } -+ -+ public Map a(String s) { -+ JsonElement jsonelement = (new JsonParser()).parse(s); -+ -+ if (!jsonelement.isJsonObject()) { -+ return Maps.newHashMap(); -+ } else { -+ JsonObject jsonobject = jsonelement.getAsJsonObject(); -+ HashMap hashmap = Maps.newHashMap(); -+ Iterator iterator = jsonobject.entrySet().iterator(); -+ -+ while (iterator.hasNext()) { -+ Entry entry = (Entry) iterator.next(); -+ Statistic statistic = StatisticList.getStatistic((String) entry.getKey()); -+ -+ if (statistic != null) { -+ StatisticWrapper statisticwrapper = new StatisticWrapper(); -+ -+ if (((JsonElement) entry.getValue()).isJsonPrimitive() && ((JsonElement) entry.getValue()).getAsJsonPrimitive().isNumber()) { -+ statisticwrapper.a(((JsonElement) entry.getValue()).getAsInt()); -+ } else if (((JsonElement) entry.getValue()).isJsonObject()) { -+ JsonObject jsonobject1 = ((JsonElement) entry.getValue()).getAsJsonObject(); -+ -+ if (jsonobject1.has("value") && jsonobject1.get("value").isJsonPrimitive() && jsonobject1.get("value").getAsJsonPrimitive().isNumber()) { -+ statisticwrapper.a(jsonobject1.getAsJsonPrimitive("value").getAsInt()); -+ } -+ -+ if (jsonobject1.has("progress") && statistic.l() != null) { -+ try { -+ Constructor constructor = statistic.l().getConstructor(new Class[0]); -+ IJsonStatistic ijsonstatistic = (IJsonStatistic) constructor.newInstance(new Object[0]); -+ -+ ijsonstatistic.a(jsonobject1.get("progress")); -+ statisticwrapper.a(ijsonstatistic); -+ } catch (Throwable throwable) { -+ ServerStatisticManager.b.warn("Invalid statistic progress in " + this.d, throwable); -+ } -+ } -+ } -+ -+ hashmap.put(statistic, statisticwrapper); -+ } else { -+ ServerStatisticManager.b.warn("Invalid statistic in " + this.d + ": Don\'t know what " + (String) entry.getKey() + " is"); -+ } -+ } -+ -+ return hashmap; -+ } -+ } -+ -+ public static String a(Map map) { -+ JsonObject jsonobject = new JsonObject(); -+ Iterator iterator = map.entrySet().iterator(); -+ -+ while (iterator.hasNext()) { -+ Entry entry = (Entry) iterator.next(); -+ -+ if (((StatisticWrapper) entry.getValue()).b() != null) { -+ JsonObject jsonobject1 = new JsonObject(); -+ -+ jsonobject1.addProperty("value", Integer.valueOf(((StatisticWrapper) entry.getValue()).a())); -+ -+ try { -+ jsonobject1.add("progress", ((StatisticWrapper) entry.getValue()).b().a()); -+ } catch (Throwable throwable) { -+ ServerStatisticManager.b.warn("Couldn\'t save statistic " + ((Statistic) entry.getKey()).e() + ": error serializing progress", throwable); -+ } -+ -+ jsonobject.add(((Statistic) entry.getKey()).name, jsonobject1); -+ } else { -+ jsonobject.addProperty(((Statistic) entry.getKey()).name, Integer.valueOf(((StatisticWrapper) entry.getValue()).a())); -+ } -+ } -+ -+ return jsonobject.toString(); -+ } -+ -+ public void d() { -+ Iterator iterator = this.a.keySet().iterator(); -+ -+ while (iterator.hasNext()) { -+ Statistic statistic = (Statistic) iterator.next(); -+ -+ this.e.add(statistic); -+ } -+ -+ } -+ -+ public void a(EntityPlayer entityplayer) { -+ int i = this.c.ap(); -+ HashMap hashmap = Maps.newHashMap(); -+ -+ if (this.g || i - this.f > 300) { -+ this.f = i; -+ Iterator iterator = this.c().iterator(); -+ -+ while (iterator.hasNext()) { -+ Statistic statistic = (Statistic) iterator.next(); -+ -+ hashmap.put(statistic, Integer.valueOf(this.getStatisticValue(statistic))); -+ } -+ } -+ -+ entityplayer.playerConnection.sendPacket(new PacketPlayOutStatistic(hashmap)); -+ } -+ -+ public void updateStatistics(EntityPlayer entityplayer) { -+ HashMap hashmap = Maps.newHashMap(); -+ Iterator iterator = AchievementList.e.iterator(); -+ -+ while (iterator.hasNext()) { -+ Achievement achievement = (Achievement) iterator.next(); -+ -+ if (this.hasAchievement(achievement)) { -+ hashmap.put(achievement, Integer.valueOf(this.getStatisticValue(achievement))); -+ this.e.remove(achievement); -+ } -+ } -+ -+ entityplayer.playerConnection.sendPacket(new PacketPlayOutStatistic(hashmap)); -+ } -+ -+ public boolean e() { -+ return this.g; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -new file mode 100644 -index 0000000..dacba33 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -0,0 +1,239 @@ -+package net.minecraft.server; -+ -+import com.google.common.collect.Maps; -+import java.util.Iterator; -+import java.util.List; -+import java.util.Map; -+import java.util.Random; -+import java.util.concurrent.Callable; -+ -+public abstract class StructureGenerator extends WorldGenBase { -+ -+ private PersistentStructure a; -+ protected Map c = Maps.newHashMap(); -+ -+ public StructureGenerator() {} -+ -+ public abstract String a(); -+ -+ protected final synchronized void a(World world, final int i, final int j, int k, int l, ChunkSnapshot chunksnapshot) { -+ this.a(world); -+ if (!this.c.containsKey(Long.valueOf(ChunkCoordIntPair.a(i, j)))) { -+ this.f.nextInt(); -+ -+ try { -+ if (this.a(i, j)) { -+ StructureStart structurestart = this.b(i, j); -+ -+ this.c.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); -+ if (structurestart.a()) { -+ this.a(i, j, structurestart); -+ } -+ } -+ -+ } catch (Throwable throwable) { -+ CrashReport crashreport = CrashReport.a(throwable, "Exception preparing structure feature"); -+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Feature being prepared"); -+ -+ crashreportsystemdetails.a("Is feature chunk", new Callable() { -+ public String a() throws Exception { -+ return StructureGenerator.this.a(i, j) ? "True" : "False"; -+ } -+ -+ public Object call() throws Exception { -+ return this.a(); -+ } -+ }); -+ crashreportsystemdetails.a("Chunk location", (Object) String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)})); -+ crashreportsystemdetails.a("Chunk pos hash", new Callable() { -+ public String a() throws Exception { -+ return String.valueOf(ChunkCoordIntPair.a(i, j)); -+ } -+ -+ public Object call() throws Exception { -+ return this.a(); -+ } -+ }); -+ crashreportsystemdetails.a("Structure type", new Callable() { -+ public String a() throws Exception { -+ return StructureGenerator.this.getClass().getCanonicalName(); -+ } -+ -+ public Object call() throws Exception { -+ return this.a(); -+ } -+ }); -+ throw new ReportedException(crashreport); -+ } -+ } -+ } -+ -+ public synchronized boolean a(World world, Random random, ChunkCoordIntPair chunkcoordintpair) { -+ this.a(world); -+ int i = (chunkcoordintpair.x << 4) + 8; -+ int j = (chunkcoordintpair.z << 4) + 8; -+ boolean flag = false; -+ Iterator iterator = this.c.values().iterator(); -+ -+ while (iterator.hasNext()) { -+ StructureStart structurestart = (StructureStart) iterator.next(); -+ -+ if (structurestart.a() && structurestart.a(chunkcoordintpair) && structurestart.b().a(i, j, i + 15, j + 15)) { -+ structurestart.a(world, random, new StructureBoundingBox(i, j, i + 15, j + 15)); -+ structurestart.b(chunkcoordintpair); -+ flag = true; -+ this.a(structurestart.e(), structurestart.f(), structurestart); -+ } -+ } -+ -+ return flag; -+ } -+ -+ public boolean b(BlockPosition blockposition) { -+ this.a(this.g); -+ return this.c(blockposition) != null; -+ } -+ -+ protected StructureStart c(BlockPosition blockposition) { -+ Iterator iterator = this.c.values().iterator(); -+ -+ while (iterator.hasNext()) { -+ StructureStart structurestart = (StructureStart) iterator.next(); -+ -+ if (structurestart.a() && structurestart.b().b((BaseBlockPosition) blockposition)) { -+ Iterator iterator1 = structurestart.c().iterator(); -+ -+ while (iterator1.hasNext()) { -+ StructurePiece structurepiece = (StructurePiece) iterator1.next(); -+ -+ if (structurepiece.c().b((BaseBlockPosition) blockposition)) { -+ return structurestart; -+ } -+ } -+ } -+ } -+ -+ return null; -+ } -+ -+ public boolean b(World world, BlockPosition blockposition) { -+ this.a(world); -+ Iterator iterator = this.c.values().iterator(); -+ -+ StructureStart structurestart; -+ -+ do { -+ if (!iterator.hasNext()) { -+ return false; -+ } -+ -+ structurestart = (StructureStart) iterator.next(); -+ } while (!structurestart.a() || !structurestart.b().b((BaseBlockPosition) blockposition)); -+ -+ return true; -+ } -+ -+ public BlockPosition getNearestGeneratedFeature(World world, BlockPosition blockposition) { -+ this.g = world; -+ this.a(world); -+ this.f.setSeed(world.getSeed()); -+ long i = this.f.nextLong(); -+ long j = this.f.nextLong(); -+ long k = (long) (blockposition.getX() >> 4) * i; -+ long l = (long) (blockposition.getZ() >> 4) * j; -+ -+ this.f.setSeed(k ^ l ^ world.getSeed()); -+ this.a(world, blockposition.getX() >> 4, blockposition.getZ() >> 4, 0, 0, (ChunkSnapshot) null); -+ double d0 = Double.MAX_VALUE; -+ BlockPosition blockposition1 = null; -+ Iterator iterator = this.c.values().iterator(); -+ -+ BlockPosition blockposition2; -+ double d1; -+ -+ while (iterator.hasNext()) { -+ StructureStart structurestart = (StructureStart) iterator.next(); -+ -+ if (structurestart.a()) { -+ StructurePiece structurepiece = (StructurePiece) structurestart.c().get(0); -+ -+ blockposition2 = structurepiece.a(); -+ d1 = blockposition2.k(blockposition); -+ if (d1 < d0) { -+ d0 = d1; -+ blockposition1 = blockposition2; -+ } -+ } -+ } -+ -+ if (blockposition1 != null) { -+ return blockposition1; -+ } else { -+ List list = this.E_(); -+ -+ if (list != null) { -+ BlockPosition blockposition3 = null; -+ Iterator iterator1 = list.iterator(); -+ -+ while (iterator1.hasNext()) { -+ blockposition2 = (BlockPosition) iterator1.next(); -+ d1 = blockposition2.k(blockposition); -+ if (d1 < d0) { -+ d0 = d1; -+ blockposition3 = blockposition2; -+ } -+ } -+ -+ return blockposition3; -+ } else { -+ return null; -+ } -+ } -+ } -+ -+ protected List E_() { -+ return null; -+ } -+ -+ protected void a(World world) { -+ if (this.a == null) { -+ this.a = (PersistentStructure) world.a(PersistentStructure.class, this.a()); -+ if (this.a == null) { -+ this.a = new PersistentStructure(this.a()); -+ world.a(this.a(), (PersistentBase) this.a); -+ } else { -+ NBTTagCompound nbttagcompound = this.a.a(); -+ Iterator iterator = nbttagcompound.c().iterator(); -+ -+ while (iterator.hasNext()) { -+ String s = (String) iterator.next(); -+ NBTBase nbtbase = nbttagcompound.get(s); -+ -+ if (nbtbase.getTypeId() == 10) { -+ NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbtbase; -+ -+ if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ")) { -+ int i = nbttagcompound1.getInt("ChunkX"); -+ int j = nbttagcompound1.getInt("ChunkZ"); -+ StructureStart structurestart = WorldGenFactory.a(nbttagcompound1, world); -+ -+ if (structurestart != null) { -+ this.c.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); -+ } -+ } -+ } -+ } -+ } -+ } -+ -+ } -+ -+ private void a(int i, int j, StructureStart structurestart) { -+ this.a.a(structurestart.a(i, j), i, j); -+ this.a.c(); -+ } -+ -+ protected abstract boolean a(int i, int j); -+ -+ protected abstract StructureStart b(int i, int j); -+} -diff --git a/src/main/java/net/minecraft/server/WorldGenLargeFeature.java b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java -new file mode 100644 -index 0000000..462dc76 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java -@@ -0,0 +1,139 @@ -+package net.minecraft.server; -+ -+import com.google.common.collect.Lists; -+import java.util.Arrays; -+import java.util.Iterator; -+import java.util.List; -+import java.util.Map; -+import java.util.Random; -+import java.util.Map.Entry; -+ -+public class WorldGenLargeFeature extends StructureGenerator { -+ -+ private static final List a = Arrays.asList(new BiomeBase[] { Biomes.d, Biomes.s, Biomes.w, Biomes.x, Biomes.h, Biomes.n, Biomes.F}); -+ private List b; -+ private int d; -+ private int h; -+ -+ public WorldGenLargeFeature() { -+ this.b = Lists.newArrayList(); -+ this.d = 32; -+ this.h = 8; -+ this.b.add(new BiomeBase.BiomeMeta(EntityWitch.class, 1, 1, 1)); -+ } -+ -+ public WorldGenLargeFeature(Map map) { -+ this(); -+ Iterator iterator = map.entrySet().iterator(); -+ -+ while (iterator.hasNext()) { -+ Entry entry = (Entry) iterator.next(); -+ -+ if (((String) entry.getKey()).equals("distance")) { -+ this.d = MathHelper.a((String) entry.getValue(), this.d, this.h + 1); -+ } -+ } -+ -+ } -+ -+ public String a() { -+ return "Temple"; -+ } -+ -+ protected boolean a(int i, int j) { -+ int k = i; -+ int l = j; -+ -+ if (i < 0) { -+ i -= this.d - 1; -+ } -+ -+ if (j < 0) { -+ j -= this.d - 1; -+ } -+ -+ int i1 = i / this.d; -+ int j1 = j / this.d; -+ Random random = this.g.a(i1, j1, 14357617); -+ -+ i1 *= this.d; -+ j1 *= this.d; -+ i1 += random.nextInt(this.d - this.h); -+ j1 += random.nextInt(this.d - this.h); -+ if (k == i1 && l == j1) { -+ BiomeBase biomebase = this.g.getWorldChunkManager().getBiome(new BlockPosition(k * 16 + 8, 0, l * 16 + 8)); -+ -+ if (biomebase == null) { -+ return false; -+ } -+ -+ Iterator iterator = WorldGenLargeFeature.a.iterator(); -+ -+ while (iterator.hasNext()) { -+ BiomeBase biomebase1 = (BiomeBase) iterator.next(); -+ -+ if (biomebase == biomebase1) { -+ return true; -+ } -+ } -+ } -+ -+ return false; -+ } -+ -+ protected StructureStart b(int i, int j) { -+ return new WorldGenLargeFeature.WorldGenLargeFeatureStart(this.g, this.f, i, j); -+ } -+ -+ public boolean a(BlockPosition blockposition) { -+ StructureStart structurestart = this.c(blockposition); -+ -+ if (structurestart != null && structurestart instanceof WorldGenLargeFeature.WorldGenLargeFeatureStart && !structurestart.a.isEmpty()) { -+ StructurePiece structurepiece = (StructurePiece) structurestart.a.get(0); -+ -+ return structurepiece instanceof WorldGenRegistration.WorldGenWitchHut; -+ } else { -+ return false; -+ } -+ } -+ -+ public List b() { -+ return this.b; -+ } -+ -+ public static class WorldGenLargeFeatureStart extends StructureStart { -+ -+ public WorldGenLargeFeatureStart() {} -+ -+ public WorldGenLargeFeatureStart(World world, Random random, int i, int j) { -+ this(world, random, i, j, world.getBiome(new BlockPosition(i * 16 + 8, 0, j * 16 + 8))); -+ } -+ -+ public WorldGenLargeFeatureStart(World world, Random random, int i, int j, BiomeBase biomebase) { -+ super(i, j); -+ if (biomebase != Biomes.w && biomebase != Biomes.x) { -+ if (biomebase == Biomes.h) { -+ WorldGenRegistration.WorldGenWitchHut worldgenregistration_worldgenwitchhut = new WorldGenRegistration.WorldGenWitchHut(random, i * 16, j * 16); -+ -+ this.a.add(worldgenregistration_worldgenwitchhut); -+ } else if (biomebase != Biomes.d && biomebase != Biomes.s) { -+ if (biomebase == Biomes.n || biomebase == Biomes.F) { -+ WorldGenRegistration.b worldgenregistration_b = new WorldGenRegistration.b(random, i * 16, j * 16); -+ -+ this.a.add(worldgenregistration_b); -+ } -+ } else { -+ WorldGenRegistration.WorldGenPyramidPiece worldgenregistration_worldgenpyramidpiece = new WorldGenRegistration.WorldGenPyramidPiece(random, i * 16, j * 16); -+ -+ this.a.add(worldgenregistration_worldgenpyramidpiece); -+ } -+ } else { -+ WorldGenRegistration.WorldGenJungleTemple worldgenregistration_worldgenjungletemple = new WorldGenRegistration.WorldGenJungleTemple(random, i * 16, j * 16); -+ -+ this.a.add(worldgenregistration_worldgenjungletemple); -+ } -+ -+ this.d(); -+ } -+ } -+} -diff --git a/src/main/java/net/minecraft/server/WorldGenVillage.java b/src/main/java/net/minecraft/server/WorldGenVillage.java -new file mode 100644 -index 0000000..2f43742 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/WorldGenVillage.java -@@ -0,0 +1,138 @@ -+package net.minecraft.server; -+ -+import java.util.Arrays; -+import java.util.Iterator; -+import java.util.List; -+import java.util.Map; -+import java.util.Random; -+import java.util.Map.Entry; -+ -+public class WorldGenVillage extends StructureGenerator { -+ -+ public static final List a = Arrays.asList(new BiomeBase[] { Biomes.c, Biomes.d, Biomes.K}); -+ private int b; -+ private int d; -+ private int h; -+ -+ public WorldGenVillage() { -+ this.d = 32; -+ this.h = 8; -+ } -+ -+ public WorldGenVillage(Map map) { -+ this(); -+ Iterator iterator = map.entrySet().iterator(); -+ -+ while (iterator.hasNext()) { -+ Entry entry = (Entry) iterator.next(); -+ -+ if (((String) entry.getKey()).equals("size")) { -+ this.b = MathHelper.a((String) entry.getValue(), this.b, 0); -+ } else if (((String) entry.getKey()).equals("distance")) { -+ this.d = MathHelper.a((String) entry.getValue(), this.d, this.h + 1); -+ } -+ } -+ -+ } -+ -+ public String a() { -+ return "Village"; -+ } -+ -+ protected boolean a(int i, int j) { -+ int k = i; -+ int l = j; -+ -+ if (i < 0) { -+ i -= this.d - 1; -+ } -+ -+ if (j < 0) { -+ j -= this.d - 1; -+ } -+ -+ int i1 = i / this.d; -+ int j1 = j / this.d; -+ Random random = this.g.a(i1, j1, 10387312); -+ -+ i1 *= this.d; -+ j1 *= this.d; -+ i1 += random.nextInt(this.d - this.h); -+ j1 += random.nextInt(this.d - this.h); -+ if (k == i1 && l == j1) { -+ boolean flag = this.g.getWorldChunkManager().a(k * 16 + 8, l * 16 + 8, 0, WorldGenVillage.a); -+ -+ if (flag) { -+ return true; -+ } -+ } -+ -+ return false; -+ } -+ -+ protected StructureStart b(int i, int j) { -+ return new WorldGenVillage.WorldGenVillageStart(this.g, this.f, i, j, this.b); -+ } -+ -+ public static class WorldGenVillageStart extends StructureStart { -+ -+ private boolean c; -+ -+ public WorldGenVillageStart() {} -+ -+ public WorldGenVillageStart(World world, Random random, int i, int j, int k) { -+ super(i, j); -+ List list = WorldGenVillagePieces.a(random, k); -+ WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece = new WorldGenVillagePieces.WorldGenVillageStartPiece(world.getWorldChunkManager(), 0, random, (i << 4) + 2, (j << 4) + 2, list, k); -+ -+ this.a.add(worldgenvillagepieces_worldgenvillagestartpiece); -+ worldgenvillagepieces_worldgenvillagestartpiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, this.a, random); -+ List list1 = worldgenvillagepieces_worldgenvillagestartpiece.g; -+ List list2 = worldgenvillagepieces_worldgenvillagestartpiece.f; -+ -+ int l; -+ -+ while (!list1.isEmpty() || !list2.isEmpty()) { -+ StructurePiece structurepiece; -+ -+ if (list1.isEmpty()) { -+ l = random.nextInt(list2.size()); -+ structurepiece = (StructurePiece) list2.remove(l); -+ structurepiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, this.a, random); -+ } else { -+ l = random.nextInt(list1.size()); -+ structurepiece = (StructurePiece) list1.remove(l); -+ structurepiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, this.a, random); -+ } -+ } -+ -+ this.d(); -+ l = 0; -+ Iterator iterator = this.a.iterator(); -+ -+ while (iterator.hasNext()) { -+ StructurePiece structurepiece1 = (StructurePiece) iterator.next(); -+ -+ if (!(structurepiece1 instanceof WorldGenVillagePieces.WorldGenVillageRoadPiece)) { -+ ++l; -+ } -+ } -+ -+ this.c = l > 2; -+ } -+ -+ public boolean a() { -+ return this.c; -+ } -+ -+ public void a(NBTTagCompound nbttagcompound) { -+ super.a(nbttagcompound); -+ nbttagcompound.setBoolean("Valid", this.c); -+ } -+ -+ public void b(NBTTagCompound nbttagcompound) { -+ super.b(nbttagcompound); -+ this.c = nbttagcompound.getBoolean("Valid"); -+ } -+ } -+} -diff --git a/src/main/java/net/minecraft/server/WorldGenVillagePieces.java b/src/main/java/net/minecraft/server/WorldGenVillagePieces.java -deleted file mode 100644 -index 35d3ed1..0000000 ---- a/src/main/java/net/minecraft/server/WorldGenVillagePieces.java -+++ /dev/null -@@ -1,1690 +0,0 @@ --package net.minecraft.server; -- --import com.google.common.collect.Lists; --import java.util.ArrayList; --import java.util.Iterator; --import java.util.List; --import java.util.Random; -- --public class WorldGenVillagePieces { -- -- public static void a() { -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageLibrary.class, "ViBH"); -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageFarm2.class, "ViDF"); -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageFarm.class, "ViF"); -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageLight.class, "ViL"); -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageButcher.class, "ViPH"); -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageHouse.class, "ViSH"); -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageHut.class, "ViSmH"); -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageTemple.class, "ViST"); -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageBlacksmith.class, "ViS"); -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageStartPiece.class, "ViStart"); -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageRoad.class, "ViSR"); -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageHouse2.class, "ViTRH"); -- WorldGenFactory.a(WorldGenVillagePieces.WorldGenVillageWell.class, "ViW"); -- } -- -- public static List a(Random random, int i) { -- ArrayList arraylist = Lists.newArrayList(); -- -- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageHouse.class, 4, MathHelper.nextInt(random, 2 + i, 4 + i * 2))); -- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageTemple.class, 20, MathHelper.nextInt(random, 0 + i, 1 + i))); -- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageLibrary.class, 20, MathHelper.nextInt(random, 0 + i, 2 + i))); -- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageHut.class, 3, MathHelper.nextInt(random, 2 + i, 5 + i * 3))); -- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageButcher.class, 15, MathHelper.nextInt(random, 0 + i, 2 + i))); -- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageFarm2.class, 3, MathHelper.nextInt(random, 1 + i, 4 + i))); -- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageFarm.class, 3, MathHelper.nextInt(random, 2 + i, 4 + i * 2))); -- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageBlacksmith.class, 15, MathHelper.nextInt(random, 0, 1 + i))); -- arraylist.add(new WorldGenVillagePieces.WorldGenVillagePieceWeight(WorldGenVillagePieces.WorldGenVillageHouse2.class, 8, MathHelper.nextInt(random, 0 + i, 3 + i * 2))); -- Iterator iterator = arraylist.iterator(); -- -- while (iterator.hasNext()) { -- if (((WorldGenVillagePieces.WorldGenVillagePieceWeight) iterator.next()).d == 0) { -- iterator.remove(); -- } -- } -- -- return arraylist; -- } -- -- private static int a(List list) { -- boolean flag = false; -- int i = 0; -- -- WorldGenVillagePieces.WorldGenVillagePieceWeight worldgenvillagepieces_worldgenvillagepieceweight; -- -- for (Iterator iterator = list.iterator(); iterator.hasNext(); i += worldgenvillagepieces_worldgenvillagepieceweight.b) { -- worldgenvillagepieces_worldgenvillagepieceweight = (WorldGenVillagePieces.WorldGenVillagePieceWeight) iterator.next(); -- if (worldgenvillagepieces_worldgenvillagepieceweight.d > 0 && worldgenvillagepieces_worldgenvillagepieceweight.c < worldgenvillagepieces_worldgenvillagepieceweight.d) { -- flag = true; -- } -- } -- -- return flag ? i : -1; -- } -- -- private static WorldGenVillagePieces.WorldGenVillagePiece a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, WorldGenVillagePieces.WorldGenVillagePieceWeight worldgenvillagepieces_worldgenvillagepieceweight, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- Class oclass = worldgenvillagepieces_worldgenvillagepieceweight.a; -- Object object = null; -- -- if (oclass == WorldGenVillagePieces.WorldGenVillageHouse.class) { -- object = WorldGenVillagePieces.WorldGenVillageHouse.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l); -- } else if (oclass == WorldGenVillagePieces.WorldGenVillageTemple.class) { -- object = WorldGenVillagePieces.WorldGenVillageTemple.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l); -- } else if (oclass == WorldGenVillagePieces.WorldGenVillageLibrary.class) { -- object = WorldGenVillagePieces.WorldGenVillageLibrary.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l); -- } else if (oclass == WorldGenVillagePieces.WorldGenVillageHut.class) { -- object = WorldGenVillagePieces.WorldGenVillageHut.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l); -- } else if (oclass == WorldGenVillagePieces.WorldGenVillageButcher.class) { -- object = WorldGenVillagePieces.WorldGenVillageButcher.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l); -- } else if (oclass == WorldGenVillagePieces.WorldGenVillageFarm2.class) { -- object = WorldGenVillagePieces.WorldGenVillageFarm2.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l); -- } else if (oclass == WorldGenVillagePieces.WorldGenVillageFarm.class) { -- object = WorldGenVillagePieces.WorldGenVillageFarm.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l); -- } else if (oclass == WorldGenVillagePieces.WorldGenVillageBlacksmith.class) { -- object = WorldGenVillagePieces.WorldGenVillageBlacksmith.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l); -- } else if (oclass == WorldGenVillagePieces.WorldGenVillageHouse2.class) { -- object = WorldGenVillagePieces.WorldGenVillageHouse2.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l); -- } -- -- return (WorldGenVillagePieces.WorldGenVillagePiece) object; -- } -- -- private static WorldGenVillagePieces.WorldGenVillagePiece c(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- int i1 = a(worldgenvillagepieces_worldgenvillagestartpiece.e); -- -- if (i1 <= 0) { -- return null; -- } else { -- int j1 = 0; -- -- while (j1 < 5) { -- ++j1; -- int k1 = random.nextInt(i1); -- Iterator iterator = worldgenvillagepieces_worldgenvillagestartpiece.e.iterator(); -- -- while (iterator.hasNext()) { -- WorldGenVillagePieces.WorldGenVillagePieceWeight worldgenvillagepieces_worldgenvillagepieceweight = (WorldGenVillagePieces.WorldGenVillagePieceWeight) iterator.next(); -- -- k1 -= worldgenvillagepieces_worldgenvillagepieceweight.b; -- if (k1 < 0) { -- if (!worldgenvillagepieces_worldgenvillagepieceweight.a(l) || worldgenvillagepieces_worldgenvillagepieceweight == worldgenvillagepieces_worldgenvillagestartpiece.d && worldgenvillagepieces_worldgenvillagestartpiece.e.size() > 1) { -- break; -- } -- -- WorldGenVillagePieces.WorldGenVillagePiece worldgenvillagepieces_worldgenvillagepiece = a(worldgenvillagepieces_worldgenvillagestartpiece, worldgenvillagepieces_worldgenvillagepieceweight, list, random, i, j, k, enumdirection, l); -- -- if (worldgenvillagepieces_worldgenvillagepiece != null) { -- ++worldgenvillagepieces_worldgenvillagepieceweight.c; -- worldgenvillagepieces_worldgenvillagestartpiece.d = worldgenvillagepieces_worldgenvillagepieceweight; -- if (!worldgenvillagepieces_worldgenvillagepieceweight.a()) { -- worldgenvillagepieces_worldgenvillagestartpiece.e.remove(worldgenvillagepieces_worldgenvillagepieceweight); -- } -- -- return worldgenvillagepieces_worldgenvillagepiece; -- } -- } -- } -- } -- -- StructureBoundingBox structureboundingbox = WorldGenVillagePieces.WorldGenVillageLight.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection); -- -- if (structureboundingbox != null) { -- return new WorldGenVillagePieces.WorldGenVillageLight(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection); -- } else { -- return null; -- } -- } -- } -- -- private static StructurePiece d(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- if (l > 50) { -- return null; -- } else if (Math.abs(i - worldgenvillagepieces_worldgenvillagestartpiece.c().a) <= 112 && Math.abs(k - worldgenvillagepieces_worldgenvillagestartpiece.c().c) <= 112) { -- WorldGenVillagePieces.WorldGenVillagePiece worldgenvillagepieces_worldgenvillagepiece = c(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection, l + 1); -- -- if (worldgenvillagepieces_worldgenvillagepiece != null) { -- int i1 = (worldgenvillagepieces_worldgenvillagepiece.l.a + worldgenvillagepieces_worldgenvillagepiece.l.d) / 2; -- int j1 = (worldgenvillagepieces_worldgenvillagepiece.l.c + worldgenvillagepieces_worldgenvillagepiece.l.f) / 2; -- int k1 = worldgenvillagepieces_worldgenvillagepiece.l.d - worldgenvillagepieces_worldgenvillagepiece.l.a; -- int l1 = worldgenvillagepieces_worldgenvillagepiece.l.f - worldgenvillagepieces_worldgenvillagepiece.l.c; -- int i2 = k1 > l1 ? k1 : l1; -- -- if (worldgenvillagepieces_worldgenvillagestartpiece.h().a(i1, j1, i2 / 2 + 4, WorldGenVillage.a)) { -- list.add(worldgenvillagepieces_worldgenvillagepiece); -- worldgenvillagepieces_worldgenvillagestartpiece.f.add(worldgenvillagepieces_worldgenvillagepiece); -- return worldgenvillagepieces_worldgenvillagepiece; -- } -- } -- -- return null; -- } else { -- return null; -- } -- } -- -- private static StructurePiece e(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- if (l > 3 + worldgenvillagepieces_worldgenvillagestartpiece.c) { -- return null; -- } else if (Math.abs(i - worldgenvillagepieces_worldgenvillagestartpiece.c().a) <= 112 && Math.abs(k - worldgenvillagepieces_worldgenvillagestartpiece.c().c) <= 112) { -- StructureBoundingBox structureboundingbox = WorldGenVillagePieces.WorldGenVillageRoad.a(worldgenvillagepieces_worldgenvillagestartpiece, list, random, i, j, k, enumdirection); -- -- if (structureboundingbox != null && structureboundingbox.b > 10) { -- WorldGenVillagePieces.WorldGenVillageRoad worldgenvillagepieces_worldgenvillageroad = new WorldGenVillagePieces.WorldGenVillageRoad(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection); -- int i1 = (worldgenvillagepieces_worldgenvillageroad.l.a + worldgenvillagepieces_worldgenvillageroad.l.d) / 2; -- int j1 = (worldgenvillagepieces_worldgenvillageroad.l.c + worldgenvillagepieces_worldgenvillageroad.l.f) / 2; -- int k1 = worldgenvillagepieces_worldgenvillageroad.l.d - worldgenvillagepieces_worldgenvillageroad.l.a; -- int l1 = worldgenvillagepieces_worldgenvillageroad.l.f - worldgenvillagepieces_worldgenvillageroad.l.c; -- int i2 = k1 > l1 ? k1 : l1; -- -- if (worldgenvillagepieces_worldgenvillagestartpiece.h().a(i1, j1, i2 / 2 + 4, WorldGenVillage.a)) { -- list.add(worldgenvillagepieces_worldgenvillageroad); -- worldgenvillagepieces_worldgenvillagestartpiece.g.add(worldgenvillagepieces_worldgenvillageroad); -- return worldgenvillagepieces_worldgenvillageroad; -- } -- } -- -- return null; -- } else { -- return null; -- } -- } -- -- static class SyntheticClass_1 { -- -- static final int[] a = new int[EnumDirection.values().length]; -- -- static { -- try { -- WorldGenVillagePieces.SyntheticClass_1.a[EnumDirection.NORTH.ordinal()] = 1; -- } catch (NoSuchFieldError nosuchfielderror) { -- ; -- } -- -- try { -- WorldGenVillagePieces.SyntheticClass_1.a[EnumDirection.SOUTH.ordinal()] = 2; -- } catch (NoSuchFieldError nosuchfielderror1) { -- ; -- } -- -- try { -- WorldGenVillagePieces.SyntheticClass_1.a[EnumDirection.WEST.ordinal()] = 3; -- } catch (NoSuchFieldError nosuchfielderror2) { -- ; -- } -- -- try { -- WorldGenVillagePieces.SyntheticClass_1.a[EnumDirection.EAST.ordinal()] = 4; -- } catch (NoSuchFieldError nosuchfielderror3) { -- ; -- } -- -- } -- } -- -- public static class WorldGenVillageLight extends WorldGenVillagePieces.WorldGenVillagePiece { -- -- public WorldGenVillageLight() {} -- -- public WorldGenVillageLight(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- this.a(enumdirection); -- this.l = structureboundingbox; -- } -- -- public static StructureBoundingBox a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection) { -- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 3, 4, 2, enumdirection); -- -- return StructurePiece.a(list, structureboundingbox) != null ? null : structureboundingbox; -- } -- -- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) { -- if (this.h < 0) { -- this.h = this.b(world, structureboundingbox); -- if (this.h < 0) { -- return true; -- } -- -- this.l.a(0, this.h - this.l.e + 4 - 1, 0); -- } -- -- this.a(world, structureboundingbox, 0, 0, 0, 2, 3, 1, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, Blocks.FENCE.getBlockData(), 1, 0, 0, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 1, 1, 0, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 1, 2, 0, structureboundingbox); -- this.a(world, Blocks.WOOL.fromLegacyData(EnumColor.WHITE.getInvColorIndex()), 1, 3, 0, structureboundingbox); -- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.EAST), 2, 3, 0, structureboundingbox); -- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.NORTH), 1, 3, 1, structureboundingbox); -- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.WEST), 0, 3, 0, structureboundingbox); -- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.SOUTH), 1, 3, -1, structureboundingbox); -- return true; -- } -- } -- -- public static class WorldGenVillageFarm2 extends WorldGenVillagePieces.WorldGenVillagePiece { -- -- private Block a; -- private Block b; -- private Block c; -- private Block d; -- -- public WorldGenVillageFarm2() {} -- -- public WorldGenVillageFarm2(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- this.a(enumdirection); -- this.l = structureboundingbox; -- this.a = this.a(random); -- this.b = this.a(random); -- this.c = this.a(random); -- this.d = this.a(random); -- } -- -- protected void a(NBTTagCompound nbttagcompound) { -- super.a(nbttagcompound); -- nbttagcompound.setInt("CA", Block.REGISTRY.a(this.a)); -- nbttagcompound.setInt("CB", Block.REGISTRY.a(this.b)); -- nbttagcompound.setInt("CC", Block.REGISTRY.a(this.c)); -- nbttagcompound.setInt("CD", Block.REGISTRY.a(this.d)); -- } -- -- protected void b(NBTTagCompound nbttagcompound) { -- super.b(nbttagcompound); -- this.a = Block.getById(nbttagcompound.getInt("CA")); -- this.b = Block.getById(nbttagcompound.getInt("CB")); -- this.c = Block.getById(nbttagcompound.getInt("CC")); -- this.d = Block.getById(nbttagcompound.getInt("CD")); -- if (!(this.a instanceof BlockCrops)) { -- this.a = Blocks.WHEAT; -- } -- -- if (!(this.b instanceof BlockCrops)) { -- this.b = Blocks.CARROTS; -- } -- -- if (!(this.c instanceof BlockCrops)) { -- this.c = Blocks.POTATOES; -- } -- -- if (!(this.d instanceof BlockCrops)) { -- this.d = Blocks.BEETROOT; -- } -- -- } -- -- private Block a(Random random) { -- switch (random.nextInt(10)) { -- case 0: -- case 1: -- return Blocks.CARROTS; -- -- case 2: -- case 3: -- return Blocks.POTATOES; -- -- case 4: -- return Blocks.BEETROOT; -- -- default: -- return Blocks.WHEAT; -- } -- } -- -- public static WorldGenVillagePieces.WorldGenVillageFarm2 a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 13, 4, 9, enumdirection); -- -- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageFarm2(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null; -- } -- -- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) { -- if (this.h < 0) { -- this.h = this.b(world, structureboundingbox); -- if (this.h < 0) { -- return true; -- } -- -- this.l.a(0, this.h - this.l.e + 4 - 1, 0); -- } -- -- this.a(world, structureboundingbox, 0, 1, 0, 12, 4, 8, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 1, 2, 0, 7, Blocks.FARMLAND.getBlockData(), Blocks.FARMLAND.getBlockData(), false); -- this.a(world, structureboundingbox, 4, 0, 1, 5, 0, 7, Blocks.FARMLAND.getBlockData(), Blocks.FARMLAND.getBlockData(), false); -- this.a(world, structureboundingbox, 7, 0, 1, 8, 0, 7, Blocks.FARMLAND.getBlockData(), Blocks.FARMLAND.getBlockData(), false); -- this.a(world, structureboundingbox, 10, 0, 1, 11, 0, 7, Blocks.FARMLAND.getBlockData(), Blocks.FARMLAND.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 0, 0, 0, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 6, 0, 0, 6, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 12, 0, 0, 12, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 0, 11, 0, 0, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 8, 11, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 3, 0, 1, 3, 0, 7, Blocks.WATER.getBlockData(), Blocks.WATER.getBlockData(), false); -- this.a(world, structureboundingbox, 9, 0, 1, 9, 0, 7, Blocks.WATER.getBlockData(), Blocks.WATER.getBlockData(), false); -- -- int i; -- int j; -- -- for (i = 1; i <= 7; ++i) { -- j = ((BlockCrops) this.a).g(); -- int k = j / 3; -- -- this.a(world, this.a.fromLegacyData(MathHelper.nextInt(random, k, j)), 1, 1, i, structureboundingbox); -- this.a(world, this.a.fromLegacyData(MathHelper.nextInt(random, k, j)), 2, 1, i, structureboundingbox); -- int l = ((BlockCrops) this.b).g(); -- int i1 = l / 3; -- -- this.a(world, this.b.fromLegacyData(MathHelper.nextInt(random, i1, l)), 4, 1, i, structureboundingbox); -- this.a(world, this.b.fromLegacyData(MathHelper.nextInt(random, i1, l)), 5, 1, i, structureboundingbox); -- int j1 = ((BlockCrops) this.c).g(); -- int k1 = j1 / 3; -- -- this.a(world, this.c.fromLegacyData(MathHelper.nextInt(random, k1, j1)), 7, 1, i, structureboundingbox); -- this.a(world, this.c.fromLegacyData(MathHelper.nextInt(random, k1, j1)), 8, 1, i, structureboundingbox); -- int l1 = ((BlockCrops) this.d).g(); -- int i2 = l1 / 3; -- -- this.a(world, this.d.fromLegacyData(MathHelper.nextInt(random, i2, l1)), 10, 1, i, structureboundingbox); -- this.a(world, this.d.fromLegacyData(MathHelper.nextInt(random, i2, l1)), 11, 1, i, structureboundingbox); -- } -- -- for (i = 0; i < 9; ++i) { -- for (j = 0; j < 13; ++j) { -- this.b(world, j, 4, i, structureboundingbox); -- this.b(world, Blocks.DIRT.getBlockData(), j, -1, i, structureboundingbox); -- } -- } -- -- return true; -- } -- } -- -- public static class WorldGenVillageFarm extends WorldGenVillagePieces.WorldGenVillagePiece { -- -- private Block a; -- private Block b; -- -- public WorldGenVillageFarm() {} -- -- public WorldGenVillageFarm(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- this.a(enumdirection); -- this.l = structureboundingbox; -- this.a = this.a(random); -- this.b = this.a(random); -- } -- -- protected void a(NBTTagCompound nbttagcompound) { -- super.a(nbttagcompound); -- nbttagcompound.setInt("CA", Block.REGISTRY.a(this.a)); -- nbttagcompound.setInt("CB", Block.REGISTRY.a(this.b)); -- } -- -- protected void b(NBTTagCompound nbttagcompound) { -- super.b(nbttagcompound); -- this.a = Block.getById(nbttagcompound.getInt("CA")); -- this.b = Block.getById(nbttagcompound.getInt("CB")); -- } -- -- private Block a(Random random) { -- switch (random.nextInt(10)) { -- case 0: -- case 1: -- return Blocks.CARROTS; -- -- case 2: -- case 3: -- return Blocks.POTATOES; -- -- case 4: -- return Blocks.BEETROOT; -- -- default: -- return Blocks.WHEAT; -- } -- } -- -- public static WorldGenVillagePieces.WorldGenVillageFarm a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 7, 4, 9, enumdirection); -- -- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageFarm(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null; -- } -- -- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) { -- if (this.h < 0) { -- this.h = this.b(world, structureboundingbox); -- if (this.h < 0) { -- return true; -- } -- -- this.l.a(0, this.h - this.l.e + 4 - 1, 0); -- } -- -- this.a(world, structureboundingbox, 0, 1, 0, 6, 4, 8, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 1, 2, 0, 7, Blocks.FARMLAND.getBlockData(), Blocks.FARMLAND.getBlockData(), false); -- this.a(world, structureboundingbox, 4, 0, 1, 5, 0, 7, Blocks.FARMLAND.getBlockData(), Blocks.FARMLAND.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 0, 0, 0, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 6, 0, 0, 6, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 0, 5, 0, 0, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 8, 5, 0, 8, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 3, 0, 1, 3, 0, 7, Blocks.WATER.getBlockData(), Blocks.WATER.getBlockData(), false); -- -- int i; -- int j; -- -- for (i = 1; i <= 7; ++i) { -- j = ((BlockCrops) this.a).g(); -- int k = j / 3; -- -- this.a(world, this.a.fromLegacyData(MathHelper.nextInt(random, k, j)), 1, 1, i, structureboundingbox); -- this.a(world, this.a.fromLegacyData(MathHelper.nextInt(random, k, j)), 2, 1, i, structureboundingbox); -- int l = ((BlockCrops) this.b).g(); -- int i1 = l / 3; -- -- this.a(world, this.b.fromLegacyData(MathHelper.nextInt(random, i1, l)), 4, 1, i, structureboundingbox); -- this.a(world, this.b.fromLegacyData(MathHelper.nextInt(random, i1, l)), 5, 1, i, structureboundingbox); -- } -- -- for (i = 0; i < 9; ++i) { -- for (j = 0; j < 7; ++j) { -- this.b(world, j, 4, i, structureboundingbox); -- this.b(world, Blocks.DIRT.getBlockData(), j, -1, i, structureboundingbox); -- } -- } -- -- return true; -- } -- } -- -- public static class WorldGenVillageBlacksmith extends WorldGenVillagePieces.WorldGenVillagePiece { -- -- private boolean a; -- -- public WorldGenVillageBlacksmith() {} -- -- public WorldGenVillageBlacksmith(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- this.a(enumdirection); -- this.l = structureboundingbox; -- } -- -- public static WorldGenVillagePieces.WorldGenVillageBlacksmith a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 10, 6, 7, enumdirection); -- -- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageBlacksmith(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null; -- } -- -- protected void a(NBTTagCompound nbttagcompound) { -- super.a(nbttagcompound); -- nbttagcompound.setBoolean("Chest", this.a); -- } -- -- protected void b(NBTTagCompound nbttagcompound) { -- super.b(nbttagcompound); -- this.a = nbttagcompound.getBoolean("Chest"); -- } -- -- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) { -- if (this.h < 0) { -- this.h = this.b(world, structureboundingbox); -- if (this.h < 0) { -- return true; -- } -- -- this.l.a(0, this.h - this.l.e + 6 - 1, 0); -- } -- -- this.a(world, structureboundingbox, 0, 1, 0, 9, 4, 6, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 0, 0, 9, 0, 6, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 4, 0, 9, 4, 6, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 5, 0, 9, 5, 6, Blocks.STONE_SLAB.getBlockData(), Blocks.STONE_SLAB.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 5, 1, 8, 5, 5, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 1, 0, 2, 3, 0, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 1, 0, 0, 4, 0, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 3, 1, 0, 3, 4, 0, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 1, 6, 0, 4, 6, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, Blocks.PLANKS.getBlockData(), 3, 3, 1, structureboundingbox); -- this.a(world, structureboundingbox, 3, 1, 2, 3, 3, 2, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 4, 1, 3, 5, 3, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 1, 1, 0, 3, 5, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 1, 6, 5, 3, 6, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 5, 1, 0, 5, 3, 0, Blocks.FENCE.getBlockData(), Blocks.FENCE.getBlockData(), false); -- this.a(world, structureboundingbox, 9, 1, 0, 9, 3, 0, Blocks.FENCE.getBlockData(), Blocks.FENCE.getBlockData(), false); -- this.a(world, structureboundingbox, 6, 1, 4, 9, 4, 6, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, Blocks.FLOWING_LAVA.getBlockData(), 7, 1, 5, structureboundingbox); -- this.a(world, Blocks.FLOWING_LAVA.getBlockData(), 8, 1, 5, structureboundingbox); -- this.a(world, Blocks.IRON_BARS.getBlockData(), 9, 2, 5, structureboundingbox); -- this.a(world, Blocks.IRON_BARS.getBlockData(), 9, 2, 4, structureboundingbox); -- this.a(world, structureboundingbox, 7, 2, 4, 8, 2, 5, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 6, 1, 3, structureboundingbox); -- this.a(world, Blocks.FURNACE.getBlockData(), 6, 2, 3, structureboundingbox); -- this.a(world, Blocks.FURNACE.getBlockData(), 6, 3, 3, structureboundingbox); -- this.a(world, Blocks.DOUBLE_STONE_SLAB.getBlockData(), 8, 1, 1, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 4, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 2, 6, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 2, 6, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 2, 1, 4, structureboundingbox); -- this.a(world, Blocks.WOODEN_PRESSURE_PLATE.getBlockData(), 2, 2, 4, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 1, 1, 5, structureboundingbox); -- this.a(world, Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH), 2, 1, 5, structureboundingbox); -- this.a(world, Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.WEST), 1, 1, 4, structureboundingbox); -- if (!this.a && structureboundingbox.b((BaseBlockPosition) (new BlockPosition(this.a(5, 5), this.d(1), this.b(5, 5))))) { -- this.a = true; -- this.a(world, structureboundingbox, random, 5, 1, 5, LootTables.e); -- } -- -- int i; -- -- for (i = 6; i <= 8; ++i) { -- if (this.a(world, i, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, i, -1, -1, structureboundingbox).getMaterial() != Material.AIR) { -- this.a(world, Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH), i, 0, -1, structureboundingbox); -- } -- } -- -- for (i = 0; i < 7; ++i) { -- for (int j = 0; j < 10; ++j) { -- this.b(world, j, 6, i, structureboundingbox); -- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox); -- } -- } -- -- this.a(world, structureboundingbox, 7, 1, 1, 1); -- return true; -- } -- -- protected int c(int i, int j) { -- return 3; -- } -- } -- -- public static class WorldGenVillageHouse2 extends WorldGenVillagePieces.WorldGenVillagePiece { -- -- public WorldGenVillageHouse2() {} -- -- public WorldGenVillageHouse2(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- this.a(enumdirection); -- this.l = structureboundingbox; -- } -- -- public static WorldGenVillagePieces.WorldGenVillageHouse2 a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 9, 7, 12, enumdirection); -- -- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageHouse2(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null; -- } -- -- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) { -- if (this.h < 0) { -- this.h = this.b(world, structureboundingbox); -- if (this.h < 0) { -- return true; -- } -- -- this.l.a(0, this.h - this.l.e + 7 - 1, 0); -- } -- -- this.a(world, structureboundingbox, 1, 1, 1, 7, 4, 4, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, structureboundingbox, 2, 1, 6, 8, 4, 10, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, structureboundingbox, 2, 0, 5, 8, 0, 10, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 1, 7, 0, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 0, 0, 0, 3, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 8, 0, 0, 8, 3, 10, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 0, 7, 2, 0, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 5, 2, 1, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 2, 0, 6, 2, 3, 10, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 3, 0, 10, 7, 3, 10, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 2, 0, 7, 3, 0, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 2, 5, 2, 3, 5, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 4, 1, 8, 4, 1, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 4, 4, 3, 4, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 5, 2, 8, 5, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, Blocks.PLANKS.getBlockData(), 0, 4, 2, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 0, 4, 3, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 8, 4, 2, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 8, 4, 3, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 8, 4, 4, structureboundingbox); -- IBlockData iblockdata = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH); -- IBlockData iblockdata1 = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.SOUTH); -- IBlockData iblockdata2 = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.WEST); -- IBlockData iblockdata3 = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.EAST); -- -- int i; -- int j; -- -- for (i = -1; i <= 2; ++i) { -- for (j = 0; j <= 8; ++j) { -- this.a(world, iblockdata, j, 4 + i, i, structureboundingbox); -- if ((i > -1 || j <= 1) && (i > 0 || j <= 3) && (i > 1 || j <= 4 || j >= 6)) { -- this.a(world, iblockdata1, j, 4 + i, 5 - i, structureboundingbox); -- } -- } -- } -- -- this.a(world, structureboundingbox, 3, 4, 5, 3, 4, 10, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 7, 4, 2, 7, 4, 10, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 4, 5, 4, 4, 5, 10, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 6, 5, 4, 6, 5, 10, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 5, 6, 3, 5, 6, 10, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- -- for (i = 4; i >= 1; --i) { -- this.a(world, Blocks.PLANKS.getBlockData(), i, 2 + i, 7 - i, structureboundingbox); -- -- for (j = 8 - i; j <= 10; ++j) { -- this.a(world, iblockdata3, i, 2 + i, j, structureboundingbox); -- } -- } -- -- this.a(world, Blocks.PLANKS.getBlockData(), 6, 6, 3, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 7, 5, 4, structureboundingbox); -- this.a(world, iblockdata2, 6, 6, 4, structureboundingbox); -- -- for (i = 6; i <= 8; ++i) { -- for (j = 5; j <= 10; ++j) { -- this.a(world, iblockdata2, i, 12 - i, j, structureboundingbox); -- } -- } -- -- this.a(world, Blocks.LOG.getBlockData(), 0, 2, 1, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 0, 2, 4, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 3, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 4, 2, 0, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 5, 2, 0, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 6, 2, 0, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 8, 2, 1, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 3, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 8, 2, 4, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 8, 2, 5, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 8, 2, 6, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 7, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 8, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 8, 2, 9, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 2, 2, 6, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 2, 7, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 2, 8, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 2, 2, 9, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 4, 4, 10, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 5, 4, 10, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 6, 4, 10, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 5, 5, 10, structureboundingbox); -- this.a(world, Blocks.AIR.getBlockData(), 2, 1, 0, structureboundingbox); -- this.a(world, Blocks.AIR.getBlockData(), 2, 2, 0, structureboundingbox); -- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.NORTH), 2, 3, 1, structureboundingbox); -- this.a(world, structureboundingbox, random, 2, 1, 0, EnumDirection.NORTH); -- this.a(world, structureboundingbox, 1, 0, -1, 3, 2, -1, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- if (this.a(world, 2, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, 2, -1, -1, structureboundingbox).getMaterial() != Material.AIR) { -- this.a(world, iblockdata, 2, 0, -1, structureboundingbox); -- } -- -- for (i = 0; i < 5; ++i) { -- for (j = 0; j < 9; ++j) { -- this.b(world, j, 7, i, structureboundingbox); -- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox); -- } -- } -- -- for (i = 5; i < 11; ++i) { -- for (j = 2; j < 9; ++j) { -- this.b(world, j, 7, i, structureboundingbox); -- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox); -- } -- } -- -- this.a(world, structureboundingbox, 4, 1, 2, 2); -- return true; -- } -- } -- -- public static class WorldGenVillageButcher extends WorldGenVillagePieces.WorldGenVillagePiece { -- -- public WorldGenVillageButcher() {} -- -- public WorldGenVillageButcher(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- this.a(enumdirection); -- this.l = structureboundingbox; -- } -- -- public static WorldGenVillagePieces.WorldGenVillageButcher a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 9, 7, 11, enumdirection); -- -- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageButcher(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null; -- } -- -- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) { -- if (this.h < 0) { -- this.h = this.b(world, structureboundingbox); -- if (this.h < 0) { -- return true; -- } -- -- this.l.a(0, this.h - this.l.e + 7 - 1, 0); -- } -- -- this.a(world, structureboundingbox, 1, 1, 1, 7, 4, 4, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, structureboundingbox, 2, 1, 6, 8, 4, 10, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, structureboundingbox, 2, 0, 6, 8, 0, 10, Blocks.DIRT.getBlockData(), Blocks.DIRT.getBlockData(), false); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 6, 0, 6, structureboundingbox); -- this.a(world, structureboundingbox, 2, 1, 6, 2, 1, 10, Blocks.FENCE.getBlockData(), Blocks.FENCE.getBlockData(), false); -- this.a(world, structureboundingbox, 8, 1, 6, 8, 1, 10, Blocks.FENCE.getBlockData(), Blocks.FENCE.getBlockData(), false); -- this.a(world, structureboundingbox, 3, 1, 10, 7, 1, 10, Blocks.FENCE.getBlockData(), Blocks.FENCE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 1, 7, 0, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 0, 0, 0, 3, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 8, 0, 0, 8, 3, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 0, 7, 1, 0, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 5, 7, 1, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 2, 0, 7, 3, 0, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 2, 5, 7, 3, 5, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 4, 1, 8, 4, 1, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 4, 4, 8, 4, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 5, 2, 8, 5, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, Blocks.PLANKS.getBlockData(), 0, 4, 2, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 0, 4, 3, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 8, 4, 2, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 8, 4, 3, structureboundingbox); -- IBlockData iblockdata = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH); -- IBlockData iblockdata1 = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.SOUTH); -- IBlockData iblockdata2 = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.WEST); -- -- int i; -- int j; -- -- for (i = -1; i <= 2; ++i) { -- for (j = 0; j <= 8; ++j) { -- this.a(world, iblockdata, j, 4 + i, i, structureboundingbox); -- this.a(world, iblockdata1, j, 4 + i, 5 - i, structureboundingbox); -- } -- } -- -- this.a(world, Blocks.LOG.getBlockData(), 0, 2, 1, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 0, 2, 4, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 8, 2, 1, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 8, 2, 4, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 3, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 3, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 2, 5, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 3, 2, 5, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 5, 2, 0, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 6, 2, 5, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 2, 1, 3, structureboundingbox); -- this.a(world, Blocks.WOODEN_PRESSURE_PLATE.getBlockData(), 2, 2, 3, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 1, 1, 4, structureboundingbox); -- this.a(world, iblockdata, 2, 1, 4, structureboundingbox); -- this.a(world, iblockdata2, 1, 1, 3, structureboundingbox); -- this.a(world, structureboundingbox, 5, 0, 1, 7, 0, 3, Blocks.DOUBLE_STONE_SLAB.getBlockData(), Blocks.DOUBLE_STONE_SLAB.getBlockData(), false); -- this.a(world, Blocks.DOUBLE_STONE_SLAB.getBlockData(), 6, 1, 1, structureboundingbox); -- this.a(world, Blocks.DOUBLE_STONE_SLAB.getBlockData(), 6, 1, 2, structureboundingbox); -- this.a(world, Blocks.AIR.getBlockData(), 2, 1, 0, structureboundingbox); -- this.a(world, Blocks.AIR.getBlockData(), 2, 2, 0, structureboundingbox); -- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.NORTH), 2, 3, 1, structureboundingbox); -- this.a(world, structureboundingbox, random, 2, 1, 0, EnumDirection.NORTH); -- if (this.a(world, 2, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, 2, -1, -1, structureboundingbox).getMaterial() != Material.AIR) { -- this.a(world, iblockdata, 2, 0, -1, structureboundingbox); -- } -- -- this.a(world, Blocks.AIR.getBlockData(), 6, 1, 5, structureboundingbox); -- this.a(world, Blocks.AIR.getBlockData(), 6, 2, 5, structureboundingbox); -- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.SOUTH), 6, 3, 4, structureboundingbox); -- this.a(world, structureboundingbox, random, 6, 1, 5, EnumDirection.SOUTH); -- -- for (i = 0; i < 5; ++i) { -- for (j = 0; j < 9; ++j) { -- this.b(world, j, 7, i, structureboundingbox); -- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox); -- } -- } -- -- this.a(world, structureboundingbox, 4, 1, 2, 2); -- return true; -- } -- -- protected int c(int i, int j) { -- return i == 0 ? 4 : super.c(i, j); -- } -- } -- -- public static class WorldGenVillageHut extends WorldGenVillagePieces.WorldGenVillagePiece { -- -- private boolean a; -- private int b; -- -- public WorldGenVillageHut() {} -- -- public WorldGenVillageHut(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- this.a(enumdirection); -- this.l = structureboundingbox; -- this.a = random.nextBoolean(); -- this.b = random.nextInt(3); -- } -- -- protected void a(NBTTagCompound nbttagcompound) { -- super.a(nbttagcompound); -- nbttagcompound.setInt("T", this.b); -- nbttagcompound.setBoolean("C", this.a); -- } -- -- protected void b(NBTTagCompound nbttagcompound) { -- super.b(nbttagcompound); -- this.b = nbttagcompound.getInt("T"); -- this.a = nbttagcompound.getBoolean("C"); -- } -- -- public static WorldGenVillagePieces.WorldGenVillageHut a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 4, 6, 5, enumdirection); -- -- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageHut(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null; -- } -- -- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) { -- if (this.h < 0) { -- this.h = this.b(world, structureboundingbox); -- if (this.h < 0) { -- return true; -- } -- -- this.l.a(0, this.h - this.l.e + 6 - 1, 0); -- } -- -- this.a(world, structureboundingbox, 1, 1, 1, 3, 5, 4, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 0, 0, 3, 0, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 1, 2, 0, 3, Blocks.DIRT.getBlockData(), Blocks.DIRT.getBlockData(), false); -- if (this.a) { -- this.a(world, structureboundingbox, 1, 4, 1, 2, 4, 3, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- } else { -- this.a(world, structureboundingbox, 1, 5, 1, 2, 5, 3, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- } -- -- this.a(world, Blocks.LOG.getBlockData(), 1, 4, 0, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 2, 4, 0, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 1, 4, 4, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 2, 4, 4, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 0, 4, 1, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 0, 4, 2, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 0, 4, 3, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 3, 4, 1, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 3, 4, 2, structureboundingbox); -- this.a(world, Blocks.LOG.getBlockData(), 3, 4, 3, structureboundingbox); -- this.a(world, structureboundingbox, 0, 1, 0, 0, 3, 0, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 3, 1, 0, 3, 3, 0, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 1, 4, 0, 3, 4, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 3, 1, 4, 3, 3, 4, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 1, 1, 0, 3, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 3, 1, 1, 3, 3, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 1, 0, 2, 3, 0, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 1, 4, 2, 3, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 3, 2, 2, structureboundingbox); -- if (this.b > 0) { -- this.a(world, Blocks.FENCE.getBlockData(), this.b, 1, 3, structureboundingbox); -- this.a(world, Blocks.WOODEN_PRESSURE_PLATE.getBlockData(), this.b, 2, 3, structureboundingbox); -- } -- -- this.a(world, Blocks.AIR.getBlockData(), 1, 1, 0, structureboundingbox); -- this.a(world, Blocks.AIR.getBlockData(), 1, 2, 0, structureboundingbox); -- this.a(world, structureboundingbox, random, 1, 1, 0, EnumDirection.NORTH); -- if (this.a(world, 1, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, 1, -1, -1, structureboundingbox).getMaterial() != Material.AIR) { -- this.a(world, Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH), 1, 0, -1, structureboundingbox); -- } -- -- for (int i = 0; i < 5; ++i) { -- for (int j = 0; j < 4; ++j) { -- this.b(world, j, 6, i, structureboundingbox); -- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox); -- } -- } -- -- this.a(world, structureboundingbox, 1, 1, 2, 1); -- return true; -- } -- } -- -- public static class WorldGenVillageLibrary extends WorldGenVillagePieces.WorldGenVillagePiece { -- -- public WorldGenVillageLibrary() {} -- -- public WorldGenVillageLibrary(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- this.a(enumdirection); -- this.l = structureboundingbox; -- } -- -- public static WorldGenVillagePieces.WorldGenVillageLibrary a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 9, 9, 6, enumdirection); -- -- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageLibrary(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null; -- } -- -- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) { -- if (this.h < 0) { -- this.h = this.b(world, structureboundingbox); -- if (this.h < 0) { -- return true; -- } -- -- this.l.a(0, this.h - this.l.e + 9 - 1, 0); -- } -- -- this.a(world, structureboundingbox, 1, 1, 1, 7, 5, 4, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 0, 0, 8, 0, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 5, 0, 8, 5, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 6, 1, 8, 6, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 7, 2, 8, 7, 3, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- -- int i; -- -- for (int j = -1; j <= 2; ++j) { -- for (i = 0; i <= 8; ++i) { -- this.a(world, Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH), i, 6 + j, j, structureboundingbox); -- this.a(world, Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.SOUTH), i, 6 + j, 5 - j, structureboundingbox); -- } -- } -- -- this.a(world, structureboundingbox, 0, 1, 0, 0, 1, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 1, 5, 8, 1, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 8, 1, 0, 8, 1, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 2, 1, 0, 7, 1, 0, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 2, 0, 0, 4, 0, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 2, 5, 0, 4, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 8, 2, 5, 8, 4, 5, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 8, 2, 0, 8, 4, 0, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 2, 1, 0, 4, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 2, 5, 7, 4, 5, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 8, 2, 1, 8, 4, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 2, 0, 7, 4, 0, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 2, 0, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 5, 2, 0, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 6, 2, 0, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 3, 0, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 5, 3, 0, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 6, 3, 0, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 3, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 3, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 3, 3, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 2, 3, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 3, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 8, 3, 3, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 2, 5, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 3, 2, 5, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 5, 2, 5, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 6, 2, 5, structureboundingbox); -- this.a(world, structureboundingbox, 1, 4, 1, 7, 4, 1, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 4, 4, 7, 4, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 3, 4, 7, 3, 4, Blocks.BOOKSHELF.getBlockData(), Blocks.BOOKSHELF.getBlockData(), false); -- this.a(world, Blocks.PLANKS.getBlockData(), 7, 1, 4, structureboundingbox); -- this.a(world, Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.EAST), 7, 1, 3, structureboundingbox); -- IBlockData iblockdata = Blocks.OAK_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH); -- -- this.a(world, iblockdata, 6, 1, 4, structureboundingbox); -- this.a(world, iblockdata, 5, 1, 4, structureboundingbox); -- this.a(world, iblockdata, 4, 1, 4, structureboundingbox); -- this.a(world, iblockdata, 3, 1, 4, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 6, 1, 3, structureboundingbox); -- this.a(world, Blocks.WOODEN_PRESSURE_PLATE.getBlockData(), 6, 2, 3, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 4, 1, 3, structureboundingbox); -- this.a(world, Blocks.WOODEN_PRESSURE_PLATE.getBlockData(), 4, 2, 3, structureboundingbox); -- this.a(world, Blocks.CRAFTING_TABLE.getBlockData(), 7, 1, 1, structureboundingbox); -- this.a(world, Blocks.AIR.getBlockData(), 1, 1, 0, structureboundingbox); -- this.a(world, Blocks.AIR.getBlockData(), 1, 2, 0, structureboundingbox); -- this.a(world, structureboundingbox, random, 1, 1, 0, EnumDirection.NORTH); -- if (this.a(world, 1, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, 1, -1, -1, structureboundingbox).getMaterial() != Material.AIR) { -- this.a(world, Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH), 1, 0, -1, structureboundingbox); -- } -- -- for (i = 0; i < 6; ++i) { -- for (int k = 0; k < 9; ++k) { -- this.b(world, k, 9, i, structureboundingbox); -- this.b(world, Blocks.COBBLESTONE.getBlockData(), k, -1, i, structureboundingbox); -- } -- } -- -- this.a(world, structureboundingbox, 2, 1, 2, 1); -- return true; -- } -- -- protected int c(int i, int j) { -- return 1; -- } -- } -- -- public static class WorldGenVillageTemple extends WorldGenVillagePieces.WorldGenVillagePiece { -- -- public WorldGenVillageTemple() {} -- -- public WorldGenVillageTemple(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- this.a(enumdirection); -- this.l = structureboundingbox; -- } -- -- public static WorldGenVillagePieces.WorldGenVillageTemple a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 5, 12, 9, enumdirection); -- -- return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null ? new WorldGenVillagePieces.WorldGenVillageTemple(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection) : null; -- } -- -- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) { -- if (this.h < 0) { -- this.h = this.b(world, structureboundingbox); -- if (this.h < 0) { -- return true; -- } -- -- this.l.a(0, this.h - this.l.e + 12 - 1, 0); -- } -- -- this.a(world, structureboundingbox, 1, 1, 1, 3, 3, 7, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 5, 1, 3, 9, 3, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 0, 0, 3, 0, 8, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 1, 0, 3, 10, 0, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 1, 1, 0, 10, 3, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 4, 1, 1, 4, 10, 3, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 0, 4, 0, 4, 7, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 4, 0, 4, 4, 4, 7, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 1, 8, 3, 4, 8, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 5, 4, 3, 10, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 5, 5, 3, 5, 7, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 9, 0, 4, 9, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 4, 0, 4, 4, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 11, 2, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 11, 2, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 2, 11, 0, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 2, 11, 4, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 1, 1, 6, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 1, 1, 7, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 2, 1, 7, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 3, 1, 6, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 3, 1, 7, structureboundingbox); -- IBlockData iblockdata = Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH); -- IBlockData iblockdata1 = Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.WEST); -- IBlockData iblockdata2 = Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.EAST); -- -- this.a(world, iblockdata, 1, 1, 5, structureboundingbox); -- this.a(world, iblockdata, 2, 1, 6, structureboundingbox); -- this.a(world, iblockdata, 3, 1, 5, structureboundingbox); -- this.a(world, iblockdata1, 1, 2, 7, structureboundingbox); -- this.a(world, iblockdata2, 3, 2, 7, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 3, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 2, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 3, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 6, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 7, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 6, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 7, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 6, 0, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 7, 0, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 6, 4, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 7, 4, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 3, 6, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 3, 6, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 3, 8, structureboundingbox); -- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.SOUTH), 2, 4, 7, structureboundingbox); -- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.EAST), 1, 4, 6, structureboundingbox); -- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.WEST), 3, 4, 6, structureboundingbox); -- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.NORTH), 2, 4, 5, structureboundingbox); -- IBlockData iblockdata3 = Blocks.LADDER.getBlockData().set(BlockLadder.FACING, EnumDirection.WEST); -- -- int i; -- -- for (i = 1; i <= 9; ++i) { -- this.a(world, iblockdata3, 3, i, 3, structureboundingbox); -- } -- -- this.a(world, Blocks.AIR.getBlockData(), 2, 1, 0, structureboundingbox); -- this.a(world, Blocks.AIR.getBlockData(), 2, 2, 0, structureboundingbox); -- this.a(world, structureboundingbox, random, 2, 1, 0, EnumDirection.NORTH); -- if (this.a(world, 2, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, 2, -1, -1, structureboundingbox).getMaterial() != Material.AIR) { -- this.a(world, iblockdata, 2, 0, -1, structureboundingbox); -- } -- -- for (i = 0; i < 9; ++i) { -- for (int j = 0; j < 5; ++j) { -- this.b(world, j, 12, i, structureboundingbox); -- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox); -- } -- } -- -- this.a(world, structureboundingbox, 2, 1, 2, 1); -- return true; -- } -- -- protected int c(int i, int j) { -- return 2; -- } -- } -- -- public static class WorldGenVillageHouse extends WorldGenVillagePieces.WorldGenVillagePiece { -- -- private boolean a; -- -- public WorldGenVillageHouse() {} -- -- public WorldGenVillageHouse(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- this.a(enumdirection); -- this.l = structureboundingbox; -- this.a = random.nextBoolean(); -- } -- -- protected void a(NBTTagCompound nbttagcompound) { -- super.a(nbttagcompound); -- nbttagcompound.setBoolean("Terrace", this.a); -- } -- -- protected void b(NBTTagCompound nbttagcompound) { -- super.b(nbttagcompound); -- this.a = nbttagcompound.getBoolean("Terrace"); -- } -- -- public static WorldGenVillagePieces.WorldGenVillageHouse a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { -- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 5, 6, 5, enumdirection); -- -- return StructurePiece.a(list, structureboundingbox) != null ? null : new WorldGenVillagePieces.WorldGenVillageHouse(worldgenvillagepieces_worldgenvillagestartpiece, l, random, structureboundingbox, enumdirection); -- } -- -- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) { -- if (this.h < 0) { -- this.h = this.b(world, structureboundingbox); -- if (this.h < 0) { -- return true; -- } -- -- this.l.a(0, this.h - this.l.e + 6 - 1, 0); -- } -- -- this.a(world, structureboundingbox, 0, 0, 0, 4, 0, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- this.a(world, structureboundingbox, 0, 4, 0, 4, 4, 4, Blocks.LOG.getBlockData(), Blocks.LOG.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 4, 1, 3, 4, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 1, 0, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 2, 0, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 3, 0, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 1, 0, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 2, 0, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 3, 0, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 1, 4, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 2, 4, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 0, 3, 4, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 1, 4, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 2, 4, structureboundingbox); -- this.a(world, Blocks.COBBLESTONE.getBlockData(), 4, 3, 4, structureboundingbox); -- this.a(world, structureboundingbox, 0, 1, 1, 0, 3, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 4, 1, 1, 4, 3, 3, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, structureboundingbox, 1, 1, 4, 3, 3, 4, Blocks.PLANKS.getBlockData(), Blocks.PLANKS.getBlockData(), false); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 0, 2, 2, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 2, 2, 4, structureboundingbox); -- this.a(world, Blocks.GLASS_PANE.getBlockData(), 4, 2, 2, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 1, 1, 0, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 1, 2, 0, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 1, 3, 0, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 2, 3, 0, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 3, 3, 0, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 3, 2, 0, structureboundingbox); -- this.a(world, Blocks.PLANKS.getBlockData(), 3, 1, 0, structureboundingbox); -- if (this.a(world, 2, 0, -1, structureboundingbox).getMaterial() == Material.AIR && this.a(world, 2, -1, -1, structureboundingbox).getMaterial() != Material.AIR) { -- this.a(world, Blocks.STONE_STAIRS.getBlockData().set(BlockStairs.FACING, EnumDirection.NORTH), 2, 0, -1, structureboundingbox); -- } -- -- this.a(world, structureboundingbox, 1, 1, 1, 3, 3, 3, Blocks.AIR.getBlockData(), Blocks.AIR.getBlockData(), false); -- if (this.a) { -- this.a(world, Blocks.FENCE.getBlockData(), 0, 5, 0, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 1, 5, 0, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 2, 5, 0, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 3, 5, 0, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 4, 5, 0, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 0, 5, 4, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 1, 5, 4, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 2, 5, 4, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 3, 5, 4, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 4, 5, 4, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 4, 5, 1, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 4, 5, 2, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 4, 5, 3, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 0, 5, 1, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 0, 5, 2, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 0, 5, 3, structureboundingbox); -- } -- -- if (this.a) { -- IBlockData iblockdata = Blocks.LADDER.getBlockData().set(BlockLadder.FACING, EnumDirection.SOUTH); -- -- this.a(world, iblockdata, 3, 1, 3, structureboundingbox); -- this.a(world, iblockdata, 3, 2, 3, structureboundingbox); -- this.a(world, iblockdata, 3, 3, 3, structureboundingbox); -- this.a(world, iblockdata, 3, 4, 3, structureboundingbox); -- } -- -- this.a(world, Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.NORTH), 2, 3, 1, structureboundingbox); -- -- for (int i = 0; i < 5; ++i) { -- for (int j = 0; j < 5; ++j) { -- this.b(world, j, 6, i, structureboundingbox); -- this.b(world, Blocks.COBBLESTONE.getBlockData(), j, -1, i, structureboundingbox); -- } -- } -- -- this.a(world, structureboundingbox, 1, 1, 2, 1); -- return true; -- } -- } -- -- public static class WorldGenVillageRoad extends WorldGenVillagePieces.WorldGenVillageRoadPiece { -- -- private int a; -- -- public WorldGenVillageRoad() {} -- -- public WorldGenVillageRoad(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, StructureBoundingBox structureboundingbox, EnumDirection enumdirection) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- this.a(enumdirection); -- this.l = structureboundingbox; -- this.a = Math.max(structureboundingbox.c(), structureboundingbox.e()); -- } -- -- protected void a(NBTTagCompound nbttagcompound) { -- super.a(nbttagcompound); -- nbttagcompound.setInt("Length", this.a); -- } -- -- protected void b(NBTTagCompound nbttagcompound) { -- super.b(nbttagcompound); -- this.a = nbttagcompound.getInt("Length"); -- } -- -- public void a(StructurePiece structurepiece, List list, Random random) { -- boolean flag = false; -- -- int i; -- StructurePiece structurepiece1; -- -- for (i = random.nextInt(5); i < this.a - 8; i += 2 + random.nextInt(5)) { -- structurepiece1 = this.a((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, 0, i); -- if (structurepiece1 != null) { -- i += Math.max(structurepiece1.l.c(), structurepiece1.l.e()); -- flag = true; -- } -- } -- -- for (i = random.nextInt(5); i < this.a - 8; i += 2 + random.nextInt(5)) { -- structurepiece1 = this.b((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, 0, i); -- if (structurepiece1 != null) { -- i += Math.max(structurepiece1.l.c(), structurepiece1.l.e()); -- flag = true; -- } -- } -- -- EnumDirection enumdirection = this.e(); -- -- if (flag && random.nextInt(3) > 0 && enumdirection != null) { -- switch (WorldGenVillagePieces.SyntheticClass_1.a[enumdirection.ordinal()]) { -- case 1: -- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a - 1, this.l.b, this.l.c, EnumDirection.WEST, this.d()); -- break; -- -- case 2: -- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a - 1, this.l.b, this.l.f - 2, EnumDirection.WEST, this.d()); -- break; -- -- case 3: -- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a, this.l.b, this.l.c - 1, EnumDirection.NORTH, this.d()); -- break; -- -- case 4: -- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.d - 2, this.l.b, this.l.c - 1, EnumDirection.NORTH, this.d()); -- } -- } -- -- if (flag && random.nextInt(3) > 0 && enumdirection != null) { -- switch (WorldGenVillagePieces.SyntheticClass_1.a[enumdirection.ordinal()]) { -- case 1: -- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.d + 1, this.l.b, this.l.c, EnumDirection.EAST, this.d()); -- break; -- -- case 2: -- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.d + 1, this.l.b, this.l.f - 2, EnumDirection.EAST, this.d()); -- break; -- -- case 3: -- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a, this.l.b, this.l.f + 1, EnumDirection.SOUTH, this.d()); -- break; -- -- case 4: -- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.d - 2, this.l.b, this.l.f + 1, EnumDirection.SOUTH, this.d()); -- } -- } -- -- } -- -- public static StructureBoundingBox a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j, int k, EnumDirection enumdirection) { -- for (int l = 7 * MathHelper.nextInt(random, 3, 5); l >= 7; l -= 7) { -- StructureBoundingBox structureboundingbox = StructureBoundingBox.a(i, j, k, 0, 0, 0, 3, 3, l, enumdirection); -- -- if (StructurePiece.a(list, structureboundingbox) == null) { -- return structureboundingbox; -- } -- } -- -- return null; -- } -- -- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) { -- IBlockData iblockdata = this.a(Blocks.GRAVEL.getBlockData()); -- IBlockData iblockdata1 = this.a(Blocks.COBBLESTONE.getBlockData()); -- -- for (int i = this.l.a; i <= this.l.d; ++i) { -- for (int j = this.l.c; j <= this.l.f; ++j) { -- BlockPosition blockposition = new BlockPosition(i, 64, j); -- -- if (structureboundingbox.b((BaseBlockPosition) blockposition)) { -- blockposition = world.q(blockposition).down(); -- world.setTypeAndData(blockposition, iblockdata, 2); -- world.setTypeAndData(blockposition.down(), iblockdata1, 2); -- } -- } -- } -- -- return true; -- } -- } -- -- public abstract static class WorldGenVillageRoadPiece extends WorldGenVillagePieces.WorldGenVillagePiece { -- -- public WorldGenVillageRoadPiece() {} -- -- protected WorldGenVillageRoadPiece(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- } -- } -- -- public static class WorldGenVillageStartPiece extends WorldGenVillagePieces.WorldGenVillageWell { -- -- public WorldChunkManager a; -- public boolean b; -- public int c; -- public WorldGenVillagePieces.WorldGenVillagePieceWeight d; -- public List e; -- public List f = Lists.newArrayList(); -- public List g = Lists.newArrayList(); -- -- public WorldGenVillageStartPiece() {} -- -- public WorldGenVillageStartPiece(WorldChunkManager worldchunkmanager, int i, Random random, int j, int k, List list, int l) { -- super((WorldGenVillagePieces.WorldGenVillageStartPiece) null, 0, random, j, k); -- this.a = worldchunkmanager; -- this.e = list; -- this.c = l; -- BiomeBase biomebase = worldchunkmanager.getBiome(new BlockPosition(j, 0, k), Biomes.b); -- -- this.b = biomebase == Biomes.d || biomebase == Biomes.s; -- this.a(this.b); -- } -- -- public WorldChunkManager h() { -- return this.a; -- } -- } -- -- public static class WorldGenVillageWell extends WorldGenVillagePieces.WorldGenVillagePiece { -- -- public WorldGenVillageWell() {} -- -- public WorldGenVillageWell(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i, Random random, int j, int k) { -- super(worldgenvillagepieces_worldgenvillagestartpiece, i); -- this.a(EnumDirection.EnumDirectionLimit.HORIZONTAL.a(random)); -- if (this.e().k() == EnumDirection.EnumAxis.Z) { -- this.l = new StructureBoundingBox(j, 64, k, j + 6 - 1, 78, k + 6 - 1); -- } else { -- this.l = new StructureBoundingBox(j, 64, k, j + 6 - 1, 78, k + 6 - 1); -- } -- -- } -- -- public void a(StructurePiece structurepiece, List list, Random random) { -- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a - 1, this.l.e - 4, this.l.c + 1, EnumDirection.WEST, this.d()); -- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.d + 1, this.l.e - 4, this.l.c + 1, EnumDirection.EAST, this.d()); -- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a + 1, this.l.e - 4, this.l.c - 1, EnumDirection.NORTH, this.d()); -- WorldGenVillagePieces.e((WorldGenVillagePieces.WorldGenVillageStartPiece) structurepiece, list, random, this.l.a + 1, this.l.e - 4, this.l.f + 1, EnumDirection.SOUTH, this.d()); -- } -- -- public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) { -- if (this.h < 0) { -- this.h = this.b(world, structureboundingbox); -- if (this.h < 0) { -- return true; -- } -- -- this.l.a(0, this.h - this.l.e + 3, 0); -- } -- -- this.a(world, structureboundingbox, 1, 0, 1, 4, 12, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.FLOWING_WATER.getBlockData(), false); -- this.a(world, Blocks.AIR.getBlockData(), 2, 12, 2, structureboundingbox); -- this.a(world, Blocks.AIR.getBlockData(), 3, 12, 2, structureboundingbox); -- this.a(world, Blocks.AIR.getBlockData(), 2, 12, 3, structureboundingbox); -- this.a(world, Blocks.AIR.getBlockData(), 3, 12, 3, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 1, 13, 1, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 1, 14, 1, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 4, 13, 1, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 4, 14, 1, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 1, 13, 4, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 1, 14, 4, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 4, 13, 4, structureboundingbox); -- this.a(world, Blocks.FENCE.getBlockData(), 4, 14, 4, structureboundingbox); -- this.a(world, structureboundingbox, 1, 15, 1, 4, 15, 4, Blocks.COBBLESTONE.getBlockData(), Blocks.COBBLESTONE.getBlockData(), false); -- -- for (int i = 0; i <= 5; ++i) { -- for (int j = 0; j <= 5; ++j) { -- if (j == 0 || j == 5 || i == 0 || i == 5) { -- this.a(world, Blocks.GRAVEL.getBlockData(), j, 11, i, structureboundingbox); -- this.b(world, j, 12, i, structureboundingbox); -- } -- } -- } -- -- return true; -- } -- } -- -- abstract static class WorldGenVillagePiece extends StructurePiece { -- -- protected int h = -1; -- private int a; -- private boolean b; -- -- public WorldGenVillagePiece() {} -- -- protected WorldGenVillagePiece(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, int i) { -- super(i); -- if (worldgenvillagepieces_worldgenvillagestartpiece != null) { -- this.b = worldgenvillagepieces_worldgenvillagestartpiece.b; -- } -- -- } -- -- protected void a(NBTTagCompound nbttagcompound) { -- nbttagcompound.setInt("HPos", this.h); -- nbttagcompound.setInt("VCount", this.a); -- nbttagcompound.setBoolean("Desert", this.b); -- } -- -- protected void b(NBTTagCompound nbttagcompound) { -- this.h = nbttagcompound.getInt("HPos"); -- this.a = nbttagcompound.getInt("VCount"); -- this.b = nbttagcompound.getBoolean("Desert"); -- } -- -- protected StructurePiece a(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j) { -- EnumDirection enumdirection = this.e(); -- -- if (enumdirection != null) { -- switch (WorldGenVillagePieces.SyntheticClass_1.a[enumdirection.ordinal()]) { -- case 1: -- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.a - 1, this.l.b + i, this.l.c + j, EnumDirection.WEST, this.d()); -- -- case 2: -- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.a - 1, this.l.b + i, this.l.c + j, EnumDirection.WEST, this.d()); -- -- case 3: -- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.a + j, this.l.b + i, this.l.c - 1, EnumDirection.NORTH, this.d()); -- -- case 4: -- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.a + j, this.l.b + i, this.l.c - 1, EnumDirection.NORTH, this.d()); -- } -- } -- -- return null; -- } -- -- protected StructurePiece b(WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece, List list, Random random, int i, int j) { -- EnumDirection enumdirection = this.e(); -- -- if (enumdirection != null) { -- switch (WorldGenVillagePieces.SyntheticClass_1.a[enumdirection.ordinal()]) { -- case 1: -- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.d + 1, this.l.b + i, this.l.c + j, EnumDirection.EAST, this.d()); -- -- case 2: -- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.d + 1, this.l.b + i, this.l.c + j, EnumDirection.EAST, this.d()); -- -- case 3: -- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.a + j, this.l.b + i, this.l.f + 1, EnumDirection.SOUTH, this.d()); -- -- case 4: -- return WorldGenVillagePieces.d(worldgenvillagepieces_worldgenvillagestartpiece, list, random, this.l.a + j, this.l.b + i, this.l.f + 1, EnumDirection.SOUTH, this.d()); -- } -- } -- -- return null; -- } -- -- protected int b(World world, StructureBoundingBox structureboundingbox) { -- int i = 0; -- int j = 0; -- BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); -- -- for (int k = this.l.c; k <= this.l.f; ++k) { -- for (int l = this.l.a; l <= this.l.d; ++l) { -- blockposition_mutableblockposition.c(l, 64, k); -- if (structureboundingbox.b((BaseBlockPosition) blockposition_mutableblockposition)) { -- i += Math.max(world.q(blockposition_mutableblockposition).getY(), world.worldProvider.getSeaLevel()); -- ++j; -- } -- } -- } -- -- if (j == 0) { -- return -1; -- } else { -- return i / j; -- } -- } -- -- protected static boolean a(StructureBoundingBox structureboundingbox) { -- return structureboundingbox != null && structureboundingbox.b > 10; -- } -- -- protected void a(World world, StructureBoundingBox structureboundingbox, int i, int j, int k, int l) { -- if (this.a < l) { -- for (int i1 = this.a; i1 < l; ++i1) { -- int j1 = this.a(i + i1, k); -- int k1 = this.d(j); -- int l1 = this.b(i + i1, k); -- -- if (!structureboundingbox.b((BaseBlockPosition) (new BlockPosition(j1, k1, l1)))) { -- break; -- } -- -- ++this.a; -- EntityVillager entityvillager = new EntityVillager(world); -- -- entityvillager.setPositionRotation((double) j1 + 0.5D, (double) k1, (double) l1 + 0.5D, 0.0F, 0.0F); -- entityvillager.prepare(world.D(new BlockPosition(entityvillager)), (GroupDataEntity) null); -- entityvillager.setProfession(this.c(i1, entityvillager.getProfession())); -- world.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason -- } -- -- } -- } -- -- protected int c(int i, int j) { -- return j; -- } -- -- protected IBlockData a(IBlockData iblockdata) { -- if (this.b) { -- if (iblockdata.getBlock() == Blocks.LOG || iblockdata.getBlock() == Blocks.LOG2) { -- return Blocks.SANDSTONE.getBlockData(); -- } -- -- if (iblockdata.getBlock() == Blocks.COBBLESTONE) { -- return Blocks.SANDSTONE.fromLegacyData(BlockSandStone.EnumSandstoneVariant.DEFAULT.a()); -- } -- -- if (iblockdata.getBlock() == Blocks.PLANKS) { -- return Blocks.SANDSTONE.fromLegacyData(BlockSandStone.EnumSandstoneVariant.SMOOTH.a()); -- } -- -- if (iblockdata.getBlock() == Blocks.OAK_STAIRS) { -- return Blocks.SANDSTONE_STAIRS.getBlockData().set(BlockStairs.FACING, iblockdata.get(BlockStairs.FACING)); -- } -- -- if (iblockdata.getBlock() == Blocks.STONE_STAIRS) { -- return Blocks.SANDSTONE_STAIRS.getBlockData().set(BlockStairs.FACING, iblockdata.get(BlockStairs.FACING)); -- } -- -- if (iblockdata.getBlock() == Blocks.GRAVEL) { -- return Blocks.SANDSTONE.getBlockData(); -- } -- } -- -- return iblockdata; -- } -- -- protected void a(World world, IBlockData iblockdata, int i, int j, int k, StructureBoundingBox structureboundingbox) { -- IBlockData iblockdata1 = this.a(iblockdata); -- -- super.a(world, iblockdata1, i, j, k, structureboundingbox); -- } -- -- protected void a(World world, StructureBoundingBox structureboundingbox, int i, int j, int k, int l, int i1, int j1, IBlockData iblockdata, IBlockData iblockdata1, boolean flag) { -- IBlockData iblockdata2 = this.a(iblockdata); -- IBlockData iblockdata3 = this.a(iblockdata1); -- -- super.a(world, structureboundingbox, i, j, k, l, i1, j1, iblockdata2, iblockdata3, flag); -- } -- -- protected void b(World world, IBlockData iblockdata, int i, int j, int k, StructureBoundingBox structureboundingbox) { -- IBlockData iblockdata1 = this.a(iblockdata); -- -- super.b(world, iblockdata1, i, j, k, structureboundingbox); -- } -- -- protected void a(boolean flag) { -- this.b = flag; -- } -- } -- -- public static class WorldGenVillagePieceWeight { -- -- public Class a; -- public final int b; -- public int c; -- public int d; -- -- public WorldGenVillagePieceWeight(Class oclass, int i, int j) { -- this.a = oclass; -- this.b = i; -- this.d = j; -- } -- -- public boolean a(int i) { -- return this.d == 0 || this.c < this.d; -- } -- -- public boolean a() { -- return this.d == 0 || this.c < this.d; -- } -- } --} -diff --git a/src/main/java/org/spigotmc/SneakyThrow.java b/src/main/java/org/spigotmc/SneakyThrow.java -new file mode 100644 -index 0000000..31fc0a9 ---- /dev/null -+++ b/src/main/java/org/spigotmc/SneakyThrow.java -@@ -0,0 +1,15 @@ -+package org.spigotmc; -+ -+public class SneakyThrow -+{ -+ -+ public static void sneaky(Throwable t) -+ { -+ throw SneakyThrow.superSneaky( t ); -+ } -+ -+ private static T superSneaky(Throwable t) throws T -+ { -+ throw (T) t; -+ } -+} --- -2.7.4 - diff --git a/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch b/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch deleted file mode 100644 index d21ffce814..0000000000 --- a/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 2c942605d485c7bfc6ab5830baabd792f4d76be6 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 14 Apr 2014 10:38:04 +1000 -Subject: [PATCH] Obfuscation Helpers - -Provides several friendly named methods which map to a obfuscated method. Obfuscated methods which are used frequently should be added to this file to ease with updates to new Minecraft versions. - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 318d68a..c226e01 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1268,6 +1268,12 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - - } - -+ // Spigot Start -+ public ServerConnection getServerConnection() -+ { -+ return this.p; -+ } -+ // Spigot End - public ServerConnection am() { - return this.p; - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0005-Spigot-Configuration.patch b/CraftBukkit-Patches/0005-Spigot-Configuration.patch deleted file mode 100644 index 343b1bfe62..0000000000 --- a/CraftBukkit-Patches/0005-Spigot-Configuration.patch +++ /dev/null @@ -1,340 +0,0 @@ -From 990c91d3496dc24aca7e201b7bb46c7fce3f0279 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 7 Jul 2013 09:32:53 +1000 -Subject: [PATCH] Spigot Configuration - -Provides the basic infrastructure to load and save the Spigot configuration file, spigot.yml - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 6d80991..9a38cca 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -165,6 +165,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - if (this.P() < 0) { - this.setPort(this.propertyManager.getInt("server-port", 25565)); - } -+ // Spigot start -+ this.a((PlayerList) (new DedicatedPlayerList(this))); -+ org.spigotmc.SpigotConfig.init((File) options.valueOf("spigot-settings")); -+ org.spigotmc.SpigotConfig.registerCommands(); -+ // Spigot end - - DedicatedServer.LOGGER.info("Generating keypair"); - this.a(MinecraftEncryption.b()); -@@ -179,7 +184,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - return false; - } - -- this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit -+ // Spigot Start - Move DedicatedPlayerList up and bring plugin loading from CraftServer to here -+ // this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit -+ server.loadPlugins(); -+ server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP); -+ // Spigot End - - if (!this.getOnlineMode()) { - DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f5b497c..fa104d1 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -97,6 +97,7 @@ public abstract class World implements IBlockAccess { - public long ticksPerMonsterSpawns; - public boolean populating; - private int tickPosition; -+ public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot - - public CraftWorld getWorld() { - return this.world; -@@ -111,6 +112,7 @@ public abstract class World implements IBlockAccess { - } - - protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) { -+ this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot - this.generator = gen; - this.world = new CraftWorld((WorldServer) this, gen, env); - this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 6b37266..91965c0 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -252,8 +252,10 @@ public final class CraftServer implements Server { - chunkGCLoadThresh = configuration.getInt("chunk-gc.load-threshold"); - loadIcon(); - -- loadPlugins(); -- enablePlugins(PluginLoadOrder.STARTUP); -+ // Spigot Start - Moved to old location of new DedicatedPlayerList in DedicatedServer -+ // loadPlugins(); -+ // enablePlugins(PluginLoadOrder.STARTUP); -+ // Spigot End - } - - public boolean getCommandBlockOverride(String command) { -@@ -674,6 +676,7 @@ public final class CraftServer implements Server { - logger.log(Level.WARNING, "Failed to load banned-players.json, " + ex.getMessage()); - } - -+ org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot - for (WorldServer world : console.worlds) { - world.worldData.setDifficulty(difficulty); - world.setSpawnFlags(monsters, animals); -@@ -688,11 +691,14 @@ public final class CraftServer implements Server { - } else { - world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns(); - } -+ world.spigotConfig.init(); // Spigot - } - - pluginManager.clearPlugins(); - commandMap.clearCommands(); - resetRecipes(); -+ org.spigotmc.SpigotConfig.registerCommands(); // Spigot -+ - overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*"); - - int pollCount = 0; -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 4e642b7..aca0d97 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -114,6 +114,14 @@ public class Main { - acceptsAll(asList("v", "version"), "Show the CraftBukkit Version"); - - acceptsAll(asList("demo"), "Demo mode"); -+ -+ // Spigot Start -+ acceptsAll(asList("S", "spigot-settings"), "File for spigot settings") -+ .withRequiredArg() -+ .ofType(File.class) -+ .defaultsTo(new File("spigot.yml")) -+ .describedAs("Yml file"); -+ // Spigot End - } - }; - -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -new file mode 100644 -index 0000000..cb88089 ---- /dev/null -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -0,0 +1,139 @@ -+package org.spigotmc; -+ -+import com.google.common.base.Throwables; -+import java.io.File; -+import java.io.IOException; -+import java.lang.reflect.InvocationTargetException; -+import java.lang.reflect.Method; -+import java.lang.reflect.Modifier; -+import java.util.HashMap; -+import java.util.List; -+import java.util.Map; -+import java.util.logging.Level; -+import net.minecraft.server.MinecraftServer; -+import org.bukkit.Bukkit; -+import org.bukkit.command.Command; -+import org.bukkit.configuration.InvalidConfigurationException; -+import org.bukkit.configuration.file.YamlConfiguration; -+ -+public class SpigotConfig -+{ -+ -+ private static File CONFIG_FILE; -+ private static final String HEADER = "This is the main configuration file for Spigot.\n" -+ + "As you can see, there's tons to configure. Some options may impact gameplay, so use\n" -+ + "with caution, and make sure you know what each option does before configuring.\n" -+ + "For a reference for any variable inside this file, check out the Spigot wiki at\n" -+ + "http://www.spigotmc.org/wiki/spigot-configuration/\n" -+ + "\n" -+ + "If you need help with the configuration or have any questions related to Spigot,\n" -+ + "join us at the IRC or drop by our forums and leave a post.\n" -+ + "\n" -+ + "IRC: #spigot @ irc.spi.gt ( http://www.spigotmc.org/pages/irc/ )\n" -+ + "Forums: http://www.spigotmc.org/\n"; -+ /*========================================================================*/ -+ public static YamlConfiguration config; -+ static int version; -+ static Map commands; -+ /*========================================================================*/ -+ -+ public static void init(File configFile) -+ { -+ CONFIG_FILE = configFile; -+ config = new YamlConfiguration(); -+ try -+ { -+ config.load( CONFIG_FILE ); -+ } catch ( IOException ex ) -+ { -+ } catch ( InvalidConfigurationException ex ) -+ { -+ Bukkit.getLogger().log( Level.SEVERE, "Could not load spigot.yml, please correct your syntax errors", ex ); -+ throw Throwables.propagate( ex ); -+ } -+ -+ config.options().header( HEADER ); -+ config.options().copyDefaults( true ); -+ -+ commands = new HashMap(); -+ -+ version = getInt( "config-version", 8 ); -+ set( "config-version", 8 ); -+ readConfig( SpigotConfig.class, null ); -+ } -+ -+ public static void registerCommands() -+ { -+ for ( Map.Entry entry : commands.entrySet() ) -+ { -+ MinecraftServer.getServer().server.getCommandMap().register( entry.getKey(), "Spigot", entry.getValue() ); -+ } -+ } -+ -+ static void readConfig(Class clazz, Object instance) -+ { -+ for ( Method method : clazz.getDeclaredMethods() ) -+ { -+ if ( Modifier.isPrivate( method.getModifiers() ) ) -+ { -+ if ( method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE ) -+ { -+ try -+ { -+ method.setAccessible( true ); -+ method.invoke( instance ); -+ } catch ( InvocationTargetException ex ) -+ { -+ throw Throwables.propagate( ex.getCause() ); -+ } catch ( Exception ex ) -+ { -+ Bukkit.getLogger().log( Level.SEVERE, "Error invoking " + method, ex ); -+ } -+ } -+ } -+ } -+ -+ try -+ { -+ config.save( CONFIG_FILE ); -+ } catch ( IOException ex ) -+ { -+ Bukkit.getLogger().log( Level.SEVERE, "Could not save " + CONFIG_FILE, ex ); -+ } -+ } -+ -+ private static void set(String path, Object val) -+ { -+ config.set( path, val ); -+ } -+ -+ private static boolean getBoolean(String path, boolean def) -+ { -+ config.addDefault( path, def ); -+ return config.getBoolean( path, config.getBoolean( path ) ); -+ } -+ -+ private static int getInt(String path, int def) -+ { -+ config.addDefault( path, def ); -+ return config.getInt( path, config.getInt( path ) ); -+ } -+ -+ private static List getList(String path, T def) -+ { -+ config.addDefault( path, def ); -+ return (List) config.getList( path, config.getList( path ) ); -+ } -+ -+ private static String getString(String path, String def) -+ { -+ 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 -index 0000000..961ddb4 ---- /dev/null -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -0,0 +1,71 @@ -+package org.spigotmc; -+ -+import java.util.List; -+import org.bukkit.Bukkit; -+import org.bukkit.configuration.file.YamlConfiguration; -+ -+public class SpigotWorldConfig -+{ -+ -+ private final String worldName; -+ private final YamlConfiguration config; -+ private boolean verbose; -+ -+ public SpigotWorldConfig(String worldName) -+ { -+ this.worldName = worldName; -+ this.config = SpigotConfig.config; -+ init(); -+ } -+ -+ public void init() -+ { -+ this.verbose = getBoolean( "verbose", true ); -+ -+ log( "-------- World Settings For [" + worldName + "] --------" ); -+ SpigotConfig.readConfig( SpigotWorldConfig.class, this ); -+ } -+ -+ private void log(String s) -+ { -+ if ( verbose ) -+ { -+ Bukkit.getLogger().info( s ); -+ } -+ } -+ -+ private void set(String path, Object val) -+ { -+ config.set( "world-settings.default." + path, val ); -+ } -+ -+ private boolean getBoolean(String path, boolean def) -+ { -+ config.addDefault( "world-settings.default." + path, def ); -+ return config.getBoolean( "world-settings." + worldName + "." + path, config.getBoolean( "world-settings.default." + path ) ); -+ } -+ -+ private double getDouble(String path, double def) -+ { -+ config.addDefault( "world-settings.default." + path, def ); -+ return config.getDouble( "world-settings." + worldName + "." + path, config.getDouble( "world-settings.default." + path ) ); -+ } -+ -+ private int getInt(String path, int def) -+ { -+ config.addDefault( "world-settings.default." + path, def ); -+ return config.getInt( "world-settings." + worldName + "." + path, config.getInt( "world-settings.default." + path ) ); -+ } -+ -+ private List getList(String path, T def) -+ { -+ config.addDefault( "world-settings.default." + path, def ); -+ return (List) config.getList( "world-settings." + worldName + "." + path, config.getList( "world-settings.default." + path ) ); -+ } -+ -+ private String getString(String path, String def) -+ { -+ config.addDefault( "world-settings.default." + path, def ); -+ return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) ); -+ } -+} --- -2.5.0 - diff --git a/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch b/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch deleted file mode 100644 index 50249a144e..0000000000 --- a/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch +++ /dev/null @@ -1,164 +0,0 @@ -From bf9a9c1ba24bbc4cc668647b5e123717ba9defa9 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 7 Mar 2016 22:14:13 +1100 -Subject: [PATCH] Crop Growth Rates - -Allows configuring the growth rates of crops as a percentage of their normal growth rate. - -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 57f3981..12589d6 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java -@@ -857,4 +857,16 @@ public class Block { - private static void a(int i, String s, Block block) { - a(i, new MinecraftKey(s), block); - } -+ -+ // Spigot start -+ public static float range(float min, float value, float max) { -+ if (value < min) { -+ return min; -+ } -+ if (value > max) { -+ return max; -+ } -+ return value; -+ } -+ // Spigot end - } -diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java -index f4b90e1..c00d874 100644 ---- a/src/main/java/net/minecraft/server/BlockCactus.java -+++ b/src/main/java/net/minecraft/server/BlockCactus.java -@@ -31,7 +31,7 @@ public class BlockCactus extends Block { - if (i < 3) { - int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue(); - -- if (j == 15) { -+ if (j >= (byte) range(3, ((100 / world.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot - // world.setTypeUpdate(blockposition1, this.getBlockData()); // CraftBukkit - IBlockData iblockdata1 = iblockdata.set(BlockCactus.AGE, Integer.valueOf(0)); - -diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java -index 062f769..7c909d8 100644 ---- a/src/main/java/net/minecraft/server/BlockCrops.java -+++ b/src/main/java/net/minecraft/server/BlockCrops.java -@@ -54,7 +54,7 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement - if (i < this.g()) { - float f = a((Block) this, world, blockposition); - -- if (random.nextInt((int) (25.0F / f) + 1) == 0) { -+ if (random.nextInt((int) ((100 / world.spigotConfig.wheatModifier) * (25.0F / f)) + 1) == 0) { // Spigot - // CraftBukkit start - IBlockData data = this.setAge(i + 1); - CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data)); -diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java -index fa7919e..6148691 100644 ---- a/src/main/java/net/minecraft/server/BlockMushroom.java -+++ b/src/main/java/net/minecraft/server/BlockMushroom.java -@@ -23,7 +23,7 @@ public class BlockMushroom extends BlockPlant implements IBlockFragilePlantEleme - - public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - final int sourceX = blockposition.getX(), sourceY = blockposition.getY(), sourceZ = blockposition.getZ(); // CraftBukkit -- if (random.nextInt(25) == 0) { -+ if (random.nextInt(Math.max(1, (int) (100 / world.spigotConfig.mushroomModifier) * 25)) == 0) { // Spigot - int i = 5; - boolean flag = true; - Iterator iterator = BlockPosition.b(blockposition.a(-4, -1, -4), blockposition.a(4, 1, 4)).iterator(); -diff --git a/src/main/java/net/minecraft/server/BlockNetherWart.java b/src/main/java/net/minecraft/server/BlockNetherWart.java -index b2ca55f..ff485b0 100644 ---- a/src/main/java/net/minecraft/server/BlockNetherWart.java -+++ b/src/main/java/net/minecraft/server/BlockNetherWart.java -@@ -29,7 +29,7 @@ public class BlockNetherWart extends BlockPlant { - public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - int i = ((Integer) iblockdata.get(BlockNetherWart.AGE)).intValue(); - -- if (i < 3 && random.nextInt(10) == 0) { -+ if (i < 3 && random.nextInt(Math.max(1, (int) (100 / world.spigotConfig.wartModifier) * 10)) == 0) { // Spigot - iblockdata = iblockdata.set(BlockNetherWart.AGE, Integer.valueOf(i + 1)); - // world.setTypeAndData(blockposition, iblockdata, 2); // CraftBukkit - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(iblockdata)); // CraftBukkit -diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java -index f507b83..fb19f19 100644 ---- a/src/main/java/net/minecraft/server/BlockReed.java -+++ b/src/main/java/net/minecraft/server/BlockReed.java -@@ -30,7 +30,7 @@ public class BlockReed extends Block { - if (i < 3) { - int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue(); - -- if (j == 15) { -+ if (j >= (byte) range(3, ((100 / world.spigotConfig.caneModifier) * 15) + 0.5F, 15)) { // Spigot - // CraftBukkit start - // world.setTypeUpdate(blockposition.up(), this.getBlockData()); // CraftBukkit - BlockPosition upPos = blockposition.up(); -diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java -index a2691a5..8b34250 100644 ---- a/src/main/java/net/minecraft/server/BlockSapling.java -+++ b/src/main/java/net/minecraft/server/BlockSapling.java -@@ -34,7 +34,7 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen - public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - if (!world.isClientSide) { - super.b(world, blockposition, iblockdata, random); -- if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) { -+ if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(Math.max(2, (int) (((100 / world.spigotConfig.saplingModifier) * 7) + 0.5F))) == 0) { // Spigot - // CraftBukkit start - world.captureTreeGeneration = true; - // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java -index 41200fa..097d11e 100644 ---- a/src/main/java/net/minecraft/server/BlockStem.java -+++ b/src/main/java/net/minecraft/server/BlockStem.java -@@ -50,7 +50,7 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement { - if (world.getLightLevel(blockposition.up()) >= 9) { - float f = BlockCrops.a((Block) this, world, blockposition); - -- if (random.nextInt((int) (25.0F / f) + 1) == 0) { -+ if (random.nextInt((int) ((100 / (this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier)) * (25.0F / f)) + 1) == 0) { // Spigot - int i = ((Integer) iblockdata.get(BlockStem.AGE)).intValue(); - - if (i < 7) { -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 961ddb4..8860a96 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -68,4 +68,37 @@ public class SpigotWorldConfig - config.addDefault( "world-settings.default." + path, def ); - return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) ); - } -+ -+ // Crop growth rates -+ public int cactusModifier; -+ public int caneModifier; -+ public int melonModifier; -+ public int mushroomModifier; -+ public int pumpkinModifier; -+ public int saplingModifier; -+ public int wheatModifier; -+ public int wartModifier; -+ private int getAndValidateGrowth(String crop) -+ { -+ int modifier = getInt( "growth." + crop.toLowerCase() + "-modifier", 100 ); -+ if ( modifier == 0 ) -+ { -+ log( "Cannot set " + crop + " growth to zero, defaulting to 100" ); -+ modifier = 100; -+ } -+ log( crop + " Growth Modifier: " + modifier + "%" ); -+ -+ return modifier; -+ } -+ private void growthModifiers() -+ { -+ cactusModifier = getAndValidateGrowth( "Cactus" ); -+ caneModifier = getAndValidateGrowth( "Cane" ); -+ melonModifier = getAndValidateGrowth( "Melon" ); -+ mushroomModifier = getAndValidateGrowth( "Mushroom" ); -+ pumpkinModifier = getAndValidateGrowth( "Pumpkin" ); -+ saplingModifier = getAndValidateGrowth( "Sapling" ); -+ wheatModifier = getAndValidateGrowth( "Wheat" ); -+ wartModifier = getAndValidateGrowth( "NetherWart" ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0007-Merge-tweaks-and-configuration.patch b/CraftBukkit-Patches/0007-Merge-tweaks-and-configuration.patch deleted file mode 100644 index 61b488bfb7..0000000000 --- a/CraftBukkit-Patches/0007-Merge-tweaks-and-configuration.patch +++ /dev/null @@ -1,98 +0,0 @@ -From e96dfe4a2034662ef8c10920a9e2bfec4466bf8c Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 23 Mar 2013 09:46:33 +1100 -Subject: [PATCH] Merge tweaks and configuration - -This allows the merging of Experience orbs, as well as the configuration of the merge radius of items. Additionally it refactors the merge algorithm to be a better experience for players. - -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 6009cac..7ea1150 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -123,7 +123,10 @@ public class EntityItem extends Entity { - } - - private void x() { -- Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(0.5D, 0.0D, 0.5D)).iterator(); -+ // Spigot start -+ double radius = world.spigotConfig.itemMerge; -+ Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(radius, radius, radius)).iterator(); -+ // Spigot end - - while (iterator.hasNext()) { - EntityItem entityitem = (EntityItem) iterator.next(); -@@ -157,12 +160,14 @@ public class EntityItem extends Entity { - } else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) { - return false; - } else { -- if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemMergeEvent(this, entityitem).isCancelled()) return false; // CraftBukkit -- itemstack1.count += itemstack.count; -- entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay); -- entityitem.age = Math.min(entityitem.age, this.age); -- entityitem.setItemStack(itemstack1); -- this.die(); -+ // Spigot start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemMergeEvent(entityitem, this).isCancelled()) return false; // CraftBukkit -+ itemstack.count += itemstack1.count; -+ this.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay); -+ this.age = Math.min(entityitem.age, this.age); -+ this.setItemStack(itemstack); -+ entityitem.die(); -+ // Spigot end - return true; - } - } else { -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index c94fbb6..1ee65dd 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -927,6 +927,23 @@ public abstract class World implements IBlockAccess { - // Not all projectiles extend EntityProjectile, so check for Bukkit interface instead - event = CraftEventFactory.callProjectileLaunchEvent(entity); - } -+ // Spigot start -+ else if (entity instanceof EntityExperienceOrb) { -+ EntityExperienceOrb xp = (EntityExperienceOrb) entity; -+ double radius = spigotConfig.expMerge; -+ if (radius > 0) { -+ List entities = this.getEntities(entity, entity.getBoundingBox().grow(radius, radius, radius)); -+ for (Entity e : entities) { -+ if (e instanceof EntityExperienceOrb) { -+ EntityExperienceOrb loopItem = (EntityExperienceOrb) e; -+ if (!loopItem.dead) { -+ xp.value += loopItem.value; -+ loopItem.die(); -+ } -+ } -+ } -+ } -+ } // Spigot end - - if (event != null && (event.isCancelled() || entity.dead)) { - entity.dead = true; -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 8860a96..d4fb83c 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -101,4 +101,18 @@ public class SpigotWorldConfig - wheatModifier = getAndValidateGrowth( "Wheat" ); - wartModifier = getAndValidateGrowth( "NetherWart" ); - } -+ -+ public double itemMerge; -+ private void itemMerge() -+ { -+ itemMerge = getDouble("merge-radius.item", 2.5 ); -+ log( "Item Merge Radius: " + itemMerge ); -+ } -+ -+ public double expMerge; -+ private void expMerge() -+ { -+ expMerge = getDouble("merge-radius.exp", 3.0 ); -+ log( "Experience Merge Radius: " + expMerge ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0008-Async-Operation-Catching.patch b/CraftBukkit-Patches/0008-Async-Operation-Catching.patch deleted file mode 100644 index bd2f61dda1..0000000000 --- a/CraftBukkit-Patches/0008-Async-Operation-Catching.patch +++ /dev/null @@ -1,185 +0,0 @@ -From 5de73dd3d1df8ba2273c6b4192833ce7ffe5f0de Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 25 Mar 2014 16:10:01 +1100 -Subject: [PATCH] Async Operation Catching - -Catch and throw an exception when a potentially unsafe operation occurs on a thread other than the main server thread. - -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 12589d6..1d2f580 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java -@@ -274,9 +274,13 @@ public class Block { - return 10; - } - -- public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {} -+ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { -+ org.spigotmc.AsyncCatcher.catchOp( "block onPlace"); // Spigot -+ } - -- public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {} -+ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { -+ org.spigotmc.AsyncCatcher.catchOp( "block remove"); // Spigot -+ } - - public int a(Random random) { - return 1; -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 7004b58..6e3bcd7 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -620,6 +620,7 @@ public abstract class EntityLiving extends Entity { - } - - public void addEffect(MobEffect mobeffect) { -+ org.spigotmc.AsyncCatcher.catchOp( "effect add"); // Spigot - // CraftBukkit start - if (isTickingEffects) { - effectsToProcess.add(mobeffect); -diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java -index ed9b0e5..0c19e5a 100644 ---- a/src/main/java/net/minecraft/server/EntityTracker.java -+++ b/src/main/java/net/minecraft/server/EntityTracker.java -@@ -102,6 +102,7 @@ public class EntityTracker { - } - - public void addEntity(Entity entity, int i, final int j, boolean flag) { -+ org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot - try { - if (this.trackedEntities.b(entity.getId())) { - throw new IllegalStateException("Entity is already tracked!"); -@@ -146,6 +147,7 @@ public class EntityTracker { - } - - public void untrackEntity(Entity entity) { -+ org.spigotmc.AsyncCatcher.catchOp( "entity untrack"); // Spigot - if (entity instanceof EntityPlayer) { - EntityPlayer entityplayer = (EntityPlayer) entity; - Iterator iterator = this.c.iterator(); -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 8b38bd2..f8570a8 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -324,6 +324,7 @@ public class EntityTrackerEntry { - } - - public void updatePlayer(EntityPlayer entityplayer) { -+ org.spigotmc.AsyncCatcher.catchOp( "player tracker update"); // Spigot - if (entityplayer != this.tracker) { - if (this.c(entityplayer)) { - if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) { -@@ -558,6 +559,7 @@ public class EntityTrackerEntry { - } - - public void clear(EntityPlayer entityplayer) { -+ org.spigotmc.AsyncCatcher.catchOp( "player tracker clear"); // Spigot - if (this.trackedPlayers.contains(entityplayer)) { - this.trackedPlayers.remove(entityplayer); - this.tracker.c(entityplayer); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index e548d00..c73f0ef 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -897,6 +897,7 @@ public abstract class World implements IBlockAccess { - } - - public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason -+ org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot - if (entity == null) return false; - // CraftBukkit end - int i = MathHelper.floor(entity.locX / 16.0D); -@@ -1003,6 +1004,7 @@ public abstract class World implements IBlockAccess { - } - - public void removeEntity(Entity entity) { -+ org.spigotmc.AsyncCatcher.catchOp( "entity remove"); // Spigot - entity.b(false); - entity.die(); - if (entity instanceof EntityHuman) { -@@ -2446,6 +2448,7 @@ public abstract class World implements IBlockAccess { - } - - public void a(Collection collection) { -+ org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot - // CraftBukkit start - // this.entityList.addAll(collection); - Iterator iterator = collection.iterator(); -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 0dcdeab..dfe58c6 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -169,6 +169,7 @@ public class CraftWorld implements World { - } - - public boolean unloadChunkRequest(int x, int z, boolean safe) { -+ org.spigotmc.AsyncCatcher.catchOp( "chunk unload"); // Spigot - if (safe && isChunkInUse(x, z)) { - return false; - } -@@ -179,6 +180,7 @@ public class CraftWorld implements World { - } - - public boolean unloadChunk(int x, int z, boolean save, boolean safe) { -+ org.spigotmc.AsyncCatcher.catchOp( "chunk unload"); // Spigot - if (isChunkInUse(x, z)) { - return false; - } -@@ -261,6 +263,7 @@ public class CraftWorld implements World { - } - - public boolean loadChunk(int x, int z, boolean generate) { -+ org.spigotmc.AsyncCatcher.catchOp( "chunk load"); // Spigot - chunkLoadCount++; - if (generate) { - // Use the default variant of loadChunk when generate == true. -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 01ba89f..e93cedb 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -211,6 +211,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - - @Override - public void kickPlayer(String message) { -+ org.spigotmc.AsyncCatcher.catchOp( "player kick"); // Spigot - if (getHandle().playerConnection == null) return; - - getHandle().playerConnection.disconnect(message == null ? "" : message); -diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java -index 69fcb10..3992c71 100644 ---- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java -+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java -@@ -42,6 +42,7 @@ public final class CraftScoreboardManager implements ScoreboardManager { - } - - public CraftScoreboard getNewScoreboard() { -+ org.spigotmc.AsyncCatcher.catchOp( "scoreboard creation"); // Spigot - CraftScoreboard scoreboard = new CraftScoreboard(new ScoreboardServer(server)); - scoreboards.add(scoreboard); - return scoreboard; -diff --git a/src/main/java/org/spigotmc/AsyncCatcher.java b/src/main/java/org/spigotmc/AsyncCatcher.java -new file mode 100644 -index 0000000..4b3aa85 ---- /dev/null -+++ b/src/main/java/org/spigotmc/AsyncCatcher.java -@@ -0,0 +1,17 @@ -+package org.spigotmc; -+ -+import net.minecraft.server.MinecraftServer; -+ -+public class AsyncCatcher -+{ -+ -+ public static boolean enabled = true; -+ -+ public static void catchOp(String reason) -+ { -+ if ( enabled && Thread.currentThread() != MinecraftServer.getServer().primaryThread ) -+ { -+ throw new IllegalStateException( "Asynchronous " + reason + "!" ); -+ } -+ } -+} --- -2.5.0 - diff --git a/CraftBukkit-Patches/0009-View-Distance.patch b/CraftBukkit-Patches/0009-View-Distance.patch deleted file mode 100644 index 23ac74d92b..0000000000 --- a/CraftBukkit-Patches/0009-View-Distance.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 76af8264cfaab9954e9733d2822a35a9ab28817b Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 23 Mar 2013 09:52:41 +1100 -Subject: [PATCH] View Distance - -This commit allows the user to select per world view distances, and view distances below 3. Be wary of the issues selecting a view distance of 1 or 2 may cause! - -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 13d47d7..8ef7eb2 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -49,9 +49,9 @@ public class PlayerChunkMap { - private boolean m = true; - private boolean wasNotEmpty; // CraftBukkit - add field - -- public PlayerChunkMap(WorldServer worldserver) { -+ public PlayerChunkMap(WorldServer worldserver, int viewDistance /* Spigot */) { - this.world = worldserver; -- this.a(worldserver.getMinecraftServer().getPlayerList().s()); -+ this.a(viewDistance); // Spigot - } - - public WorldServer getWorld() { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index c65e557..59b78bb 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -57,7 +57,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { - // CraftBukkit end - this.server = minecraftserver; - this.tracker = new EntityTracker(this); -- this.manager = new PlayerChunkMap(this); -+ this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot - this.worldProvider.a((World) this); - this.chunkProvider = this.n(); - this.portalTravelAgent = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index d4fb83c..86300d6 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -115,4 +115,11 @@ public class SpigotWorldConfig - expMerge = getDouble("merge-radius.exp", 3.0 ); - log( "Experience Merge Radius: " + expMerge ); - } -+ -+ public int viewDistance; -+ private void viewDistance() -+ { -+ viewDistance = getInt( "view-distance", Bukkit.getViewDistance() ); -+ log( "View Distance: " + viewDistance ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0010-Spigot-Timings.patch b/CraftBukkit-Patches/0010-Spigot-Timings.patch deleted file mode 100644 index bfcca65672..0000000000 --- a/CraftBukkit-Patches/0010-Spigot-Timings.patch +++ /dev/null @@ -1,877 +0,0 @@ -From bb377d35a2ce39ec624b3e9c3761c28c46fc9367 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 10 Jan 2013 00:18:11 -0500 -Subject: [PATCH] Spigot Timings - -Overhauls the Timings System adding performance tracking all around the Minecraft Server - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 582e684..7980e80 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -834,6 +834,7 @@ public class Chunk { - } - - public void loadNearby(IChunkProvider ichunkprovider, ChunkGenerator chunkgenerator) { -+ world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot - Chunk chunk = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ - 1); - Chunk chunk1 = ichunkprovider.getLoadedChunkAt(this.locX + 1, this.locZ); - Chunk chunk2 = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ + 1); -@@ -858,6 +859,7 @@ public class Chunk { - chunk4.a(chunkgenerator); - } - } -+ world.timings.syncChunkLoadPostTimer.stopTiming(); // Spigot - - } - -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 22c17db..162613b 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -154,6 +154,7 @@ public class ChunkProviderServer implements IChunkProvider { - // CraftBukkit end - - if (chunk == null) { -+ world.timings.syncChunkLoadTimer.startTiming(); // Spigot - long k = ChunkCoordIntPair.a(i, j); - - chunk = this.loadChunk(i, j); -@@ -202,6 +203,7 @@ public class ChunkProviderServer implements IChunkProvider { - } - // CraftBukkit end - chunk.loadNearby(this, this.chunkGenerator); -+ world.timings.syncChunkLoadTimer.stopTiming(); // Spigot - } - - return chunk; -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 003aee0..53b5296 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -44,7 +44,9 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - - // CraftBukkit start - Add async variant, provide compatibility - public Chunk a(World world, int i, int j) throws IOException { -+ world.timings.syncChunkLoadDataTimer.startTiming(); // Spigot - Object[] data = loadChunk(world, i, j); -+ world.timings.syncChunkLoadDataTimer.stopTiming(); // Spigot - if (data != null) { - Chunk chunk = (Chunk) data[0]; - NBTTagCompound nbttagcompound = (NBTTagCompound) data[1]; -@@ -347,7 +349,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - - public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) { - // CraftBukkit end -- -+ world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot - NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10); - - if (nbttaglist1 != null) { -@@ -358,7 +360,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - chunk.g(true); - } - } -- -+ world.timings.syncChunkLoadEntitiesTimer.stopTiming(); // Spigot -+ world.timings.syncChunkLoadTileEntitiesTimer.startTiming(); // Spigot - NBTTagList nbttaglist2 = nbttagcompound.getList("TileEntities", 10); - - if (nbttaglist2 != null) { -@@ -371,6 +374,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - } - } - } -+ world.timings.syncChunkLoadTileEntitiesTimer.stopTiming(); // Spigot -+ world.timings.syncChunkLoadTileTicksTimer.startTiming(); // Spigot - - if (nbttagcompound.hasKeyOfType("TileTicks", 9)) { - NBTTagList nbttaglist3 = nbttagcompound.getList("TileTicks", 10); -@@ -390,6 +395,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - } - } - } -+ world.timings.syncChunkLoadTileTicksTimer.stopTiming(); // Spigot - - // return chunk; // CraftBukkit - } -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 9c17951..db78855 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -22,6 +22,7 @@ import java.io.PrintStream; - import org.apache.logging.log4j.Level; - - import org.bukkit.craftbukkit.LoggerOutputStream; -+import org.bukkit.craftbukkit.SpigotTimings; // Spigot - import org.bukkit.event.server.ServerCommandEvent; - import org.bukkit.craftbukkit.util.Waitable; - import org.bukkit.event.server.RemoteServerCommandEvent; -@@ -394,6 +395,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - } - - public void aL() { -+ SpigotTimings.serverCommandTimer.startTiming(); // Spigot - while (!this.serverCommandQueue.isEmpty()) { - ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0); - -@@ -408,6 +410,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - // CraftBukkit end - } - -+ SpigotTimings.serverCommandTimer.stopTiming(); // Spigot - } - - public boolean aa() { -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 6c81511..c1d4fb4 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -24,6 +24,7 @@ import org.bukkit.block.BlockFace; - import org.bukkit.entity.Hanging; - import org.bukkit.entity.LivingEntity; - import org.bukkit.entity.Vehicle; -+import org.spigotmc.CustomTimingsHandler; // Spigot - import org.bukkit.event.entity.EntityCombustByEntityEvent; - import org.bukkit.event.hanging.HangingBreakByEntityEvent; - import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; -@@ -139,6 +140,7 @@ public abstract class Entity implements ICommandListener { - public boolean valid; // CraftBukkit - public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only - public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949 -+ public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot - - public Entity(World world) { - this.id = Entity.entityCount++; -@@ -447,6 +449,7 @@ public abstract class Entity implements ICommandListener { - } - - public void move(double d0, double d1, double d2) { -+ org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot - if (this.noclip) { - this.a(this.getBoundingBox().c(d0, d1, d2)); - this.recalcPosition(); -@@ -787,6 +790,7 @@ public abstract class Entity implements ICommandListener { - - this.world.methodProfiler.b(); - } -+ org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot - } - - public void recalcPosition() { -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 6e3bcd7..ff20c9b 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -24,6 +24,8 @@ import org.bukkit.event.entity.EntityRegainHealthEvent; - import org.bukkit.event.player.PlayerItemConsumeEvent; - // CraftBukkit end - -+import org.bukkit.craftbukkit.SpigotTimings; // Spigot -+ - public abstract class EntityLiving extends Entity { - - private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); -@@ -1680,6 +1682,7 @@ public abstract class EntityLiving extends Entity { - } - - public void m() { -+ SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot - super.m(); - this.cu(); - if (!this.world.isClientSide) { -@@ -1752,7 +1755,9 @@ public abstract class EntityLiving extends Entity { - } - } - -+ SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot - this.n(); -+ SpigotTimings.timerEntityTickRest.startTiming(); // Spigot - double d0 = this.locX - this.lastX; - double d1 = this.locZ - this.lastZ; - float f = (float) (d0 * d0 + d1 * d1); -@@ -1822,6 +1827,7 @@ public abstract class EntityLiving extends Entity { - this.bo = 0; - } - -+ SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot - } - - protected float h(float f, float f1) { -@@ -1886,6 +1892,7 @@ public abstract class EntityLiving extends Entity { - } - - this.world.methodProfiler.a("ai"); -+ SpigotTimings.timerEntityAI.startTiming(); // Spigot - if (this.cf()) { - this.bc = false; - this.bd = 0.0F; -@@ -1896,6 +1903,7 @@ public abstract class EntityLiving extends Entity { - this.doTick(); - this.world.methodProfiler.b(); - } -+ SpigotTimings.timerEntityAI.stopTiming(); // Spigot - - this.world.methodProfiler.b(); - this.world.methodProfiler.a("jump"); -@@ -1918,10 +1926,14 @@ public abstract class EntityLiving extends Entity { - this.be *= 0.98F; - this.bf *= 0.9F; - this.r(); -+ SpigotTimings.timerEntityAIMove.startTiming(); // Spigot - this.g(this.bd, this.be); -+ SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot - this.world.methodProfiler.b(); - this.world.methodProfiler.a("push"); -+ SpigotTimings.timerEntityAICollision.startTiming(); // Spigot - this.cn(); -+ SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot - this.world.methodProfiler.b(); - } - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c226e01..d754d0d 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -45,6 +45,7 @@ import org.bukkit.craftbukkit.CraftServer; - - // CraftBukkit start - // CraftBukkit end -+import org.bukkit.craftbukkit.SpigotTimings; // Spigot - - public abstract class MinecraftServer implements Runnable, ICommandListener, IAsyncTaskHandler, IMojangStatistics { - -@@ -622,6 +623,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - protected void B() {} - - protected void C() throws ExceptionWorldConflict { // CraftBukkit - added throws -+ SpigotTimings.serverTickTimer.startTiming(); // Spigot - long i = System.nanoTime(); - - ++this.ticks; -@@ -648,10 +650,12 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - } - - if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit -+ SpigotTimings.worldSaveTimer.startTiming(); // Spigot - this.methodProfiler.a("save"); - this.v.savePlayers(); - this.saveChunks(true); - this.methodProfiler.b(); -+ SpigotTimings.worldSaveTimer.stopTiming(); // Spigot - } - - this.methodProfiler.a("tallying"); -@@ -668,6 +672,8 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - - this.methodProfiler.b(); - this.methodProfiler.b(); -+ SpigotTimings.serverTickTimer.stopTiming(); // Spigot -+ org.spigotmc.CustomTimingsHandler.tick(); // Spigot - } - - public void D() { -@@ -682,16 +688,23 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - - this.methodProfiler.c("levels"); - -+ SpigotTimings.schedulerTimer.startTiming(); // Spigot - // CraftBukkit start - this.server.getScheduler().mainThreadHeartbeat(this.ticks); -+ SpigotTimings.schedulerTimer.stopTiming(); // Spigot - - // Run tasks that are waiting on processing -+ SpigotTimings.processQueueTimer.startTiming(); // Spigot - while (!processQueue.isEmpty()) { - processQueue.remove().run(); - } -+ SpigotTimings.processQueueTimer.stopTiming(); // Spigot - -+ SpigotTimings.chunkIOTickTimer.startTiming(); // Spigot - org.bukkit.craftbukkit.chunkio.ChunkIOExecutor.tick(); -+ SpigotTimings.chunkIOTickTimer.stopTiming(); // Spigot - -+ SpigotTimings.timeUpdateTimer.startTiming(); // Spigot - // Send time updates to everyone, it will get the right time from the world the player is in. - if (this.ticks % 20 == 0) { - for (int i = 0; i < this.getPlayerList().players.size(); ++i) { -@@ -699,6 +712,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time - } - } -+ SpigotTimings.timeUpdateTimer.stopTiming(); // Spigot - - int i; - -@@ -722,7 +736,9 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - CrashReport crashreport; - - try { -+ worldserver.timings.doTick.startTiming(); // Spigot - worldserver.doTick(); -+ worldserver.timings.doTick.stopTiming(); // Spigot - } catch (Throwable throwable) { - crashreport = CrashReport.a(throwable, "Exception ticking world"); - worldserver.a(crashreport); -@@ -730,7 +746,9 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - } - - try { -+ worldserver.timings.tickEntities.startTiming(); // Spigot - worldserver.tickEntities(); -+ worldserver.timings.tickEntities.stopTiming(); // Spigot - } catch (Throwable throwable1) { - crashreport = CrashReport.a(throwable1, "Exception ticking world entities"); - worldserver.a(crashreport); -@@ -739,7 +757,9 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - - this.methodProfiler.b(); - this.methodProfiler.a("tracker"); -+ worldserver.timings.tracker.startTiming(); // Spigot - worldserver.getTracker().updatePlayers(); -+ worldserver.timings.tracker.stopTiming(); // Spigot - this.methodProfiler.b(); - this.methodProfiler.b(); - // } // CraftBukkit -@@ -748,14 +768,20 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - } - - this.methodProfiler.c("connection"); -+ SpigotTimings.connectionTimer.startTiming(); // Spigot - this.am().c(); -+ SpigotTimings.connectionTimer.stopTiming(); // Spigot - this.methodProfiler.c("players"); -+ SpigotTimings.playerListTimer.startTiming(); // Spigot - this.v.tick(); -+ SpigotTimings.playerListTimer.stopTiming(); // Spigot - this.methodProfiler.c("tickables"); - -+ SpigotTimings.tickablesTimer.startTiming(); // Spigot - for (i = 0; i < this.o.size(); ++i) { - ((ITickable) this.o.get(i)).c(); - } -+ SpigotTimings.tickablesTimer.stopTiming(); // Spigot - - this.methodProfiler.b(); - } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 969840c..76cbb21 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1282,6 +1282,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - // CraftBukkit end - - private void handleCommand(String s) { -+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot - // CraftBukkit start - whole method - this.LOGGER.info(this.player.getName() + " issued server command: " + s); - -@@ -1291,18 +1292,22 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - this.server.getPluginManager().callEvent(event); - - if (event.isCancelled()) { -+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot - return; - } - - try { - if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) { -+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot - return; - } - } catch (org.bukkit.command.CommandException ex) { - player.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command"); - java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); -+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot - return; - } -+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot - // this.minecraftServer.getCommandHandler().a(this.player, s); - // CraftBukkit end - } -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index baf1d73..8bbdc11 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -6,10 +6,12 @@ import java.util.concurrent.Callable; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -+import org.spigotmc.CustomTimingsHandler; // Spigot - import org.bukkit.inventory.InventoryHolder; // CraftBukkit - - public abstract class TileEntity { - -+ public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot - private static final Logger a = LogManager.getLogger(); - private static Map> f = Maps.newHashMap(); - private static Map, String> g = Maps.newHashMap(); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index c73f0ef..d6d4c5b 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -18,6 +18,7 @@ import com.google.common.collect.Maps; - import java.util.Map; - import org.bukkit.Bukkit; - import org.bukkit.block.BlockState; -+import org.bukkit.craftbukkit.SpigotTimings; // Spigot - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.CraftWorld; - import org.bukkit.craftbukkit.event.CraftEventFactory; -@@ -99,6 +100,8 @@ public abstract class World implements IBlockAccess { - private int tickPosition; - public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot - -+ public final SpigotTimings.WorldTimingsHandler timings; // Spigot -+ - public CraftWorld getWorld() { - return this.world; - } -@@ -160,6 +163,7 @@ public abstract class World implements IBlockAccess { - }); - this.getServer().addWorld(this.world); - // CraftBukkit end -+ timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings - } - - public World b() { -@@ -1332,6 +1336,7 @@ public abstract class World implements IBlockAccess { - CrashReportSystemDetails crashreportsystemdetails1; - CrashReport crashreport1; - -+ timings.entityTick.startTiming(); // Spigot - // CraftBukkit start - Use field for loop variable - for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) { - entity = (Entity) this.entityList.get(this.tickPosition); -@@ -1349,7 +1354,9 @@ public abstract class World implements IBlockAccess { - this.methodProfiler.a("tick"); - if (!entity.dead && !(entity instanceof EntityPlayer)) { - try { -+ SpigotTimings.tickEntityTimer.startTiming(); // Spigot - this.g(entity); -+ SpigotTimings.tickEntityTimer.stopTiming(); // Spigot - } catch (Throwable throwable1) { - crashreport1 = CrashReport.a(throwable1, "Ticking entity"); - crashreportsystemdetails1 = crashreport1.a("Entity being ticked"); -@@ -1375,6 +1382,7 @@ public abstract class World implements IBlockAccess { - this.methodProfiler.b(); - } - -+ timings.entityTick.stopTiming(); // Spigot - this.methodProfiler.c("blockEntities"); - this.M = true; - // CraftBukkit start - From below, clean up tile entities before ticking them -@@ -1395,6 +1403,7 @@ public abstract class World implements IBlockAccess { - if (this.isLoaded(blockposition) && this.N.a(blockposition)) { - try { - this.methodProfiler.a(""/*tileentity.getClass().getSimpleName()*/); // CraftBukkit: SPIGOT-1900 -+ tileentity.tickTimer.startTiming(); // Spigot - ((ITickable) tileentity).c(); - this.methodProfiler.b(); - } catch (Throwable throwable2) { -@@ -1403,6 +1412,11 @@ public abstract class World implements IBlockAccess { - tileentity.a(crashreportsystemdetails1); - throw new ReportedException(crashreport1); - } -+ // Spigot start -+ finally { -+ tileentity.tickTimer.stopTiming(); -+ } -+ // Spigot end - } - } - -@@ -1415,6 +1429,8 @@ public abstract class World implements IBlockAccess { - } - } - -+ timings.tileEntityTick.stopTiming(); // Spigot -+ timings.tileEntityPending.startTiming(); // Spigot - this.M = false; - /* CraftBukkit start - Moved up - if (!this.tileEntityListUnload.isEmpty()) { -@@ -1449,6 +1465,7 @@ public abstract class World implements IBlockAccess { - this.b.clear(); - } - -+ timings.tileEntityPending.stopTiming(); // Spigot - this.methodProfiler.b(); - this.methodProfiler.b(); - } -@@ -1492,6 +1509,7 @@ public abstract class World implements IBlockAccess { - // CraftBukkit start - Use neighbor cache instead of looking up - Chunk startingChunk = this.getChunkIfLoaded(i >> 4, j >> 4); - if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { -+ entity.tickTimer.startTiming(); // Spigot - // CraftBukkit end - entity.M = entity.locX; - entity.N = entity.locY; -@@ -1559,6 +1577,7 @@ public abstract class World implements IBlockAccess { - } - } - -+ entity.tickTimer.stopTiming(); // Spigot - } - } - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 2c95e76..9abcc8d 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -219,10 +219,13 @@ public class WorldServer extends World implements IAsyncTaskHandler { - // CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals - long time = this.worldData.getTime(); - if (this.getGameRules().getBoolean("doMobSpawning") && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) { -+ timings.mobSpawn.startTiming(); // Spigot - this.spawnerCreature.a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L); -+ timings.mobSpawn.stopTiming(); // Spigot - // CraftBukkit end - } - -+ timings.doChunkUnload.startTiming(); // Spigot - this.methodProfiler.c("chunkSource"); - this.chunkProvider.unloadChunks(); - int j = this.a(1.0F); -@@ -236,21 +239,36 @@ public class WorldServer extends World implements IAsyncTaskHandler { - this.worldData.setDayTime(this.worldData.getDayTime() + 1L); - } - -+ timings.doChunkUnload.stopTiming(); // Spigot - this.methodProfiler.c("tickPending"); -+ timings.doTickPending.startTiming(); // Spigot - this.a(false); -+ timings.doTickPending.stopTiming(); // Spigot - this.methodProfiler.c("tickBlocks"); -+ timings.doTickTiles.startTiming(); // Spigot - this.j(); -+ timings.doTickTiles.stopTiming(); // Spigot - this.methodProfiler.c("chunkMap"); -+ timings.doChunkMap.startTiming(); // Spigot - this.manager.flush(); -+ timings.doChunkMap.stopTiming(); // Spigot - this.methodProfiler.c("village"); -+ timings.doVillages.startTiming(); // Spigot - this.villages.tick(); - this.siegeManager.a(); -+ timings.doVillages.stopTiming(); // Spigot - this.methodProfiler.c("portalForcer"); -+ timings.doPortalForcer.startTiming(); // Spigot - this.portalTravelAgent.a(this.getTime()); -+ timings.doPortalForcer.stopTiming(); // Spigot - this.methodProfiler.b(); -+ timings.doSounds.startTiming(); // Spigot - this.ao(); -+ timings.doSounds.stopTiming(); // Spigot - -+ timings.doChunkGC.startTiming();// Spigot - this.getWorld().processChunkGC(); // CraftBukkit -+ timings.doChunkGC.stopTiming(); // Spigot - } - - public BiomeBase.BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 91965c0..261b423 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1663,6 +1663,11 @@ 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 dfe58c6..e0e469d 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -274,7 +274,9 @@ public class CraftWorld implements World { - net.minecraft.server.Chunk chunk = world.getChunkProviderServer().chunks.get(LongHash.toLong(x, z)); - - if (chunk == null) { -+ world.timings.syncChunkLoadTimer.startTiming(); // Spigot - chunk = world.getChunkProviderServer().getOrLoadChunkAt(x, z); -+ world.timings.syncChunkLoadTimer.stopTiming(); // Spigot - } - return chunk != null; - } -diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java -new file mode 100644 -index 0000000..558574f ---- /dev/null -+++ b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java -@@ -0,0 +1,170 @@ -+package org.bukkit.craftbukkit; -+ -+import com.google.common.collect.Maps; -+import net.minecraft.server.*; -+import org.bukkit.plugin.java.JavaPluginLoader; -+import org.spigotmc.CustomTimingsHandler; -+import org.bukkit.scheduler.BukkitTask; -+ -+import java.util.HashMap; -+import java.util.Map; -+ -+import org.bukkit.craftbukkit.scheduler.CraftTask; -+ -+public class SpigotTimings { -+ -+ public static final CustomTimingsHandler serverTickTimer = new CustomTimingsHandler("** Full Server Tick"); -+ public static final CustomTimingsHandler playerListTimer = new CustomTimingsHandler("Player List"); -+ public static final CustomTimingsHandler connectionTimer = new CustomTimingsHandler("Connection Handler"); -+ public static final CustomTimingsHandler tickablesTimer = new CustomTimingsHandler("Tickables"); -+ public static final CustomTimingsHandler schedulerTimer = new CustomTimingsHandler("Scheduler"); -+ public static final CustomTimingsHandler chunkIOTickTimer = new CustomTimingsHandler("ChunkIOTick"); -+ public static final CustomTimingsHandler timeUpdateTimer = new CustomTimingsHandler("Time Update"); -+ public static final CustomTimingsHandler serverCommandTimer = new CustomTimingsHandler("Server Command"); -+ public static final CustomTimingsHandler worldSaveTimer = new CustomTimingsHandler("World Save"); -+ -+ public static final CustomTimingsHandler entityMoveTimer = new CustomTimingsHandler("** entityMove"); -+ public static final CustomTimingsHandler tickEntityTimer = new CustomTimingsHandler("** tickEntity"); -+ public static final CustomTimingsHandler activatedEntityTimer = new CustomTimingsHandler("** activatedTickEntity"); -+ public static final CustomTimingsHandler tickTileEntityTimer = new CustomTimingsHandler("** tickTileEntity"); -+ -+ public static final CustomTimingsHandler timerEntityBaseTick = new CustomTimingsHandler("** livingEntityBaseTick"); -+ public static final CustomTimingsHandler timerEntityAI = new CustomTimingsHandler("** livingEntityAI"); -+ public static final CustomTimingsHandler timerEntityAICollision = new CustomTimingsHandler("** livingEntityAICollision"); -+ public static final CustomTimingsHandler timerEntityAIMove = new CustomTimingsHandler("** livingEntityAIMove"); -+ public static final CustomTimingsHandler timerEntityTickRest = new CustomTimingsHandler("** livingEntityTickRest"); -+ -+ public static final CustomTimingsHandler processQueueTimer = new CustomTimingsHandler("processQueue"); -+ public static final CustomTimingsHandler schedulerSyncTimer = new CustomTimingsHandler("** Scheduler - Sync Tasks", JavaPluginLoader.pluginParentTimer); -+ -+ public static final CustomTimingsHandler playerCommandTimer = new CustomTimingsHandler("** playerCommand"); -+ -+ public static final HashMap entityTypeTimingMap = new HashMap(); -+ public static final HashMap tileEntityTypeTimingMap = new HashMap(); -+ public static final HashMap pluginTaskTimingMap = new HashMap(); -+ -+ /** -+ * Gets a timer associated with a plugins tasks. -+ * @param task -+ * @param period -+ * @return -+ */ -+ public static CustomTimingsHandler getPluginTaskTimings(BukkitTask task, long period) { -+ if (!task.isSync()) { -+ return null; -+ } -+ String plugin; -+ final CraftTask ctask = (CraftTask) task; -+ -+ if (task.getOwner() != null) { -+ plugin = task.getOwner().getDescription().getFullName(); -+ } else if (ctask.timingName != null) { -+ plugin = "CraftScheduler"; -+ } else { -+ plugin = "Unknown"; -+ } -+ String taskname = ctask.getTaskName(); -+ -+ String name = "Task: " + plugin + " Runnable: " + taskname; -+ if (period > 0) { -+ name += "(interval:" + period +")"; -+ } else { -+ name += "(Single)"; -+ } -+ CustomTimingsHandler result = pluginTaskTimingMap.get(name); -+ if (result == null) { -+ result = new CustomTimingsHandler(name, SpigotTimings.schedulerSyncTimer); -+ pluginTaskTimingMap.put(name, result); -+ } -+ return result; -+ } -+ -+ /** -+ * Get a named timer for the specified entity type to track type specific timings. -+ * @param entity -+ * @return -+ */ -+ public static CustomTimingsHandler getEntityTimings(Entity entity) { -+ String entityType = entity.getClass().getSimpleName(); -+ CustomTimingsHandler result = entityTypeTimingMap.get(entityType); -+ if (result == null) { -+ result = new CustomTimingsHandler("** tickEntity - " + entityType, activatedEntityTimer); -+ entityTypeTimingMap.put(entityType, result); -+ } -+ return result; -+ } -+ -+ /** -+ * Get a named timer for the specified tile entity type to track type specific timings. -+ * @param entity -+ * @return -+ */ -+ public static CustomTimingsHandler getTileEntityTimings(TileEntity entity) { -+ String entityType = entity.getClass().getSimpleName(); -+ CustomTimingsHandler result = tileEntityTypeTimingMap.get(entityType); -+ if (result == null) { -+ result = new CustomTimingsHandler("** tickTileEntity - " + entityType, tickTileEntityTimer); -+ tileEntityTypeTimingMap.put(entityType, result); -+ } -+ return result; -+ } -+ -+ /** -+ * Set of timers per world, to track world specific timings. -+ */ -+ public static class WorldTimingsHandler { -+ public final CustomTimingsHandler mobSpawn; -+ public final CustomTimingsHandler doChunkUnload; -+ public final CustomTimingsHandler doPortalForcer; -+ public final CustomTimingsHandler doTickPending; -+ public final CustomTimingsHandler doTickTiles; -+ public final CustomTimingsHandler doVillages; -+ public final CustomTimingsHandler doChunkMap; -+ public final CustomTimingsHandler doChunkGC; -+ public final CustomTimingsHandler doSounds; -+ public final CustomTimingsHandler entityTick; -+ public final CustomTimingsHandler tileEntityTick; -+ public final CustomTimingsHandler tileEntityPending; -+ public final CustomTimingsHandler tracker; -+ public final CustomTimingsHandler doTick; -+ public final CustomTimingsHandler tickEntities; -+ -+ public final CustomTimingsHandler syncChunkLoadTimer; -+ public final CustomTimingsHandler syncChunkLoadDataTimer; -+ public final CustomTimingsHandler syncChunkLoadStructuresTimer; -+ public final CustomTimingsHandler syncChunkLoadEntitiesTimer; -+ public final CustomTimingsHandler syncChunkLoadTileEntitiesTimer; -+ public final CustomTimingsHandler syncChunkLoadTileTicksTimer; -+ public final CustomTimingsHandler syncChunkLoadPostTimer; -+ -+ public WorldTimingsHandler(World server) { -+ String name = server.worldData.getName() +" - "; -+ -+ mobSpawn = new CustomTimingsHandler("** " + name + "mobSpawn"); -+ doChunkUnload = new CustomTimingsHandler("** " + name + "doChunkUnload"); -+ doTickPending = new CustomTimingsHandler("** " + name + "doTickPending"); -+ doTickTiles = new CustomTimingsHandler("** " + name + "doTickTiles"); -+ doVillages = new CustomTimingsHandler("** " + name + "doVillages"); -+ doChunkMap = new CustomTimingsHandler("** " + name + "doChunkMap"); -+ doSounds = new CustomTimingsHandler("** " + name + "doSounds"); -+ doChunkGC = new CustomTimingsHandler("** " + name + "doChunkGC"); -+ doPortalForcer = new CustomTimingsHandler("** " + name + "doPortalForcer"); -+ entityTick = new CustomTimingsHandler("** " + name + "entityTick"); -+ tileEntityTick = new CustomTimingsHandler("** " + name + "tileEntityTick"); -+ tileEntityPending = new CustomTimingsHandler("** " + name + "tileEntityPending"); -+ -+ syncChunkLoadTimer = new CustomTimingsHandler("** " + name + "syncChunkLoad"); -+ syncChunkLoadDataTimer = new CustomTimingsHandler("** " + name + "syncChunkLoad - Data"); -+ syncChunkLoadStructuresTimer = new CustomTimingsHandler("** " + name + "chunkLoad - Structures"); -+ syncChunkLoadEntitiesTimer = new CustomTimingsHandler("** " + name + "chunkLoad - Entities"); -+ syncChunkLoadTileEntitiesTimer = new CustomTimingsHandler("** " + name + "chunkLoad - TileEntities"); -+ syncChunkLoadTileTicksTimer = new CustomTimingsHandler("** " + name + "chunkLoad - TileTicks"); -+ syncChunkLoadPostTimer = new CustomTimingsHandler("** " + name + "chunkLoad - Post"); -+ -+ -+ tracker = new CustomTimingsHandler(name + "tracker"); -+ doTick = new CustomTimingsHandler(name + "doTick"); -+ tickEntities = new CustomTimingsHandler(name + "tickEntities"); -+ } -+ } -+} -diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java -index 6dfef44..482af17 100644 ---- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java -+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java -@@ -45,7 +45,9 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider -Date: Fri, 21 Jun 2013 17:29:54 +1000 -Subject: [PATCH] Fix Mob Spawning Relative to View Distance - -Changes the mob spawning algorithm to properly account for view distance and the range around players. - -Needs better documentation. - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 8345e87..e4725b0 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -43,6 +43,7 @@ public class Chunk { - private long v; - private int w; - private ConcurrentLinkedQueue x; -+ protected gnu.trove.map.hash.TObjectIntHashMap entityCount = new gnu.trove.map.hash.TObjectIntHashMap(); // Spigot - - // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking - private int neighbors = 0x1 << 12; -@@ -606,6 +607,22 @@ public class Chunk { - entity.ac = k; - entity.ad = this.locZ; - this.entitySlices[k].add(entity); -+ // Spigot start - increment creature type count -+ // Keep this synced up with World.a(Class) -+ if (entity instanceof EntityInsentient) { -+ EntityInsentient entityinsentient = (EntityInsentient) entity; -+ if (entityinsentient.isTypeNotPersistent() && entityinsentient.isPersistent()) { -+ return; -+ } -+ } -+ for ( EnumCreatureType creatureType : EnumCreatureType.values() ) -+ { -+ if ( creatureType.a().isAssignableFrom( entity.getClass() ) ) -+ { -+ this.entityCount.adjustOrPutValue( creatureType.a(), 1, 1 ); -+ } -+ } -+ // Spigot end - } - - public void b(Entity entity) { -@@ -622,6 +639,22 @@ public class Chunk { - } - - this.entitySlices[i].remove(entity); -+ // Spigot start - decrement creature type count -+ // Keep this synced up with World.a(Class) -+ if (entity instanceof EntityInsentient) { -+ EntityInsentient entityinsentient = (EntityInsentient) entity; -+ if (entityinsentient.isTypeNotPersistent() && entityinsentient.isPersistent()) { -+ return; -+ } -+ } -+ for ( EnumCreatureType creatureType : EnumCreatureType.values() ) -+ { -+ if ( creatureType.a().isAssignableFrom( entity.getClass() ) ) -+ { -+ this.entityCount.adjustValue( creatureType.a(), -1 ); -+ } -+ } -+ // Spigot end - } - - public boolean c(BlockPosition blockposition) { -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index b3cb8bb..9e19dfd 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -17,6 +17,25 @@ public final class SpawnerCreature { - - public SpawnerCreature() {} - -+ // Spigot start - get entity count only from chunks being processed in b -+ private int getEntityCount(WorldServer server, Class oClass) -+ { -+ int i = 0; -+ Iterator it = this.b.iterator(); -+ while ( it.hasNext() ) -+ { -+ Long coord = it.next(); -+ int x = LongHash.msw( coord ); -+ int z = LongHash.lsw( coord ); -+ if ( !((ChunkProviderServer)server.chunkProvider).unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) ) -+ { -+ i += server.getChunkAt( x, z ).entityCount.get( oClass ); -+ } -+ } -+ return i; -+ } -+ // Spigot end -+ - public int a(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2) { - if (!flag && !flag1) { - return 0; -@@ -36,6 +55,11 @@ public final class SpawnerCreature { - - j = MathHelper.floor(entityhuman.locZ / 16.0D); - byte b0 = 8; -+ // Spigot Start -+ b0 = worldserver.spigotConfig.mobSpawnRange; -+ b0 = ( b0 > worldserver.spigotConfig.viewDistance ) ? (byte) worldserver.spigotConfig.viewDistance : b0; -+ b0 = ( b0 > 8 ) ? 8 : b0; -+ // Spigot End - - for (int i1 = -b0; i1 <= b0; ++i1) { - for (k = -b0; k <= b0; ++k) { -@@ -89,18 +113,20 @@ public final class SpawnerCreature { - if (limit == 0) { - continue; - } -+ int mobcnt = 0; // Spigot - // CraftBukkit end - - if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2)) { - k = worldserver.a(enumcreaturetype.a()); - int l1 = limit * i / a; // CraftBukkit - use per-world limits - -- if (k <= l1) { -+ if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / 256) { - BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); - Iterator iterator1 = this.b.iterator(); - -+ int moblimit = (limit * i / 256) - mobcnt + 1; // Spigot - up to 1 more than limit - label120: -- while (iterator1.hasNext()) { -+ while (iterator1.hasNext() && (moblimit > 0)) { // Spigot - while more allowed - // CraftBukkit start = use LongHash and LongObjectHashMap - long key = ((Long) iterator1.next()).longValue(); - BlockPosition blockposition1 = getRandomPosition(worldserver, LongHash.msw(key), LongHash.lsw(key)); -@@ -162,7 +188,10 @@ public final class SpawnerCreature { - entityinsentient.die(); - } - -- if (l2 >= entityinsentient.cJ()) { -+ // Spigot start -+ if ( --moblimit <= 0 ) { -+ // If we're past limit, stop spawn -+ // Spigot end - continue label120; - } - } -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 86300d6..cacb8fc 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -122,4 +122,11 @@ public class SpigotWorldConfig - viewDistance = getInt( "view-distance", Bukkit.getViewDistance() ); - log( "View Distance: " + viewDistance ); - } -+ -+ public byte mobSpawnRange; -+ private void mobSpawnRange() -+ { -+ mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 ); -+ log( "Mob Spawn Range: " + mobSpawnRange ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0012-Handle-Null-Tile-Entities.patch b/CraftBukkit-Patches/0012-Handle-Null-Tile-Entities.patch deleted file mode 100644 index 6a47b86339..0000000000 --- a/CraftBukkit-Patches/0012-Handle-Null-Tile-Entities.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 2a1554b7745d3505ac5bc808320d8a9471ad0b45 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 3 Feb 2013 09:20:19 +1100 -Subject: [PATCH] Handle Null Tile Entities - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7e8092f..59a7163 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1396,6 +1396,13 @@ public abstract class World implements IBlockAccess { - - while (iterator.hasNext()) { - TileEntity tileentity = (TileEntity) iterator.next(); -+ // Spigot start -+ if (tileentity == null) { -+ getServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash"); -+ iterator.remove(); -+ continue; -+ } -+ // Spigot end - - if (!tileentity.x() && tileentity.t()) { - BlockPosition blockposition = tileentity.getPosition(); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0013-Item-Despawn-Rate.patch b/CraftBukkit-Patches/0013-Item-Despawn-Rate.patch deleted file mode 100644 index 9ac3cb66d2..0000000000 --- a/CraftBukkit-Patches/0013-Item-Despawn-Rate.patch +++ /dev/null @@ -1,38 +0,0 @@ -From b991c9bc542ce11cc8d07f7b2c6f9ab2152cc12e Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 22 Sep 2013 19:10:53 +1000 -Subject: [PATCH] Item Despawn Rate - - -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 7ea1150..eb0f8eb 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -109,7 +109,7 @@ public class EntityItem extends Entity { - // Craftbukkit end */ - - this.aj(); -- if (!this.world.isClientSide && this.age >= 6000) { -+ if (!this.world.isClientSide && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot - // CraftBukkit start - fire ItemDespawnEvent - if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { - this.age = 0; -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index cacb8fc..ca888fc 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -129,4 +129,11 @@ public class SpigotWorldConfig - mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 ); - log( "Mob Spawn Range: " + mobSpawnRange ); - } -+ -+ public int itemDespawnRate; -+ private void itemDespawnRate() -+ { -+ itemDespawnRate = getInt( "item-despawn-rate", 6000 ); -+ log( "Item Despawn Rate: " + itemDespawnRate ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0014-Entity-Activation-Range.patch b/CraftBukkit-Patches/0014-Entity-Activation-Range.patch deleted file mode 100644 index 9bbec6ad23..0000000000 --- a/CraftBukkit-Patches/0014-Entity-Activation-Range.patch +++ /dev/null @@ -1,543 +0,0 @@ -From a6fd76ee6c1cba5ed83ed03042318c5f58fc25a6 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 3 Feb 2013 05:10:21 -0500 -Subject: [PATCH] Entity Activation Range - -This feature gives 3 new configurable ranges that if an entity of the matching type is outside of this radius of any player, will tick at 5% of its normal rate. - -This will drastically cut down on tick timings for entities that are not in range of a user to actually be "used". -This change can have dramatic impact on gameplay if configured too low. Balance according to your servers desired gameplay. - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 6e125e7..87a069a 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -107,7 +107,7 @@ public abstract class Entity implements ICommandListener { - public int ticksLived; - public int maxFireTicks; - public int fireTicks; -- public boolean inWater; -+ public boolean inWater; // Spigot - protected -> public // PAIL - public int noDamageTicks; - protected boolean justCreated; - protected boolean fireProof; -@@ -141,6 +141,12 @@ public abstract class Entity implements ICommandListener { - public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only - public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949 - public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot -+ // Spigot start -+ public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); -+ public final boolean defaultActivationState; -+ public long activatedTick = Integer.MIN_VALUE; -+ public void inactiveTick() { } -+ // Spigot end - - public Entity(World world) { - this.id = Entity.entityCount++; -@@ -160,7 +166,12 @@ public abstract class Entity implements ICommandListener { - this.setPosition(0.0D, 0.0D, 0.0D); - if (world != null) { - this.dimension = world.worldProvider.getDimensionManager().getDimensionID(); -+ // Spigot start -+ this.defaultActivationState = org.spigotmc.ActivationRange.initializeEntityActivationState(this, world.spigotConfig); -+ } else { -+ this.defaultActivationState = false; - } -+ // Spigot end - - this.datawatcher = new DataWatcher(this); - this.datawatcher.register(Entity.ax, Byte.valueOf((byte) 0)); -diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java -index e4a02bc..dbede68 100644 ---- a/src/main/java/net/minecraft/server/EntityAgeable.java -+++ b/src/main/java/net/minecraft/server/EntityAgeable.java -@@ -10,6 +10,31 @@ public abstract class EntityAgeable extends EntityCreature { - private float bx; - public boolean ageLocked; // CraftBukkit - -+ // Spigot start -+ @Override -+ public void inactiveTick() -+ { -+ super.inactiveTick(); -+ if ( this.world.isClientSide || this.ageLocked ) -+ { // CraftBukkit -+ this.a( this.isBaby() ); -+ } else -+ { -+ int i = this.getAge(); -+ -+ if ( i < 0 ) -+ { -+ ++i; -+ this.setAgeRaw( i ); -+ } else if ( i > 0 ) -+ { -+ --i; -+ this.setAgeRaw( i ); -+ } -+ } -+ } -+ // Spigot end -+ - public EntityAgeable(World world) { - super(world); - } -diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 1cda4e6..a40f3ec 100644 ---- a/src/main/java/net/minecraft/server/EntityArrow.java -+++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -27,7 +27,7 @@ public abstract class EntityArrow extends Entity implements IProjectile { - private int at; - private Block au; - private int av; -- protected boolean inGround; -+ public boolean inGround; // Spigot - protected -> public - protected int b; - public EntityArrow.PickupStatus fromPlayer; - public int shake; -@@ -37,6 +37,18 @@ public abstract class EntityArrow extends Entity implements IProjectile { - private double damage; - public int knockbackStrength; - -+ // Spigot Start -+ @Override -+ public void inactiveTick() -+ { -+ if ( this.inGround ) -+ { -+ this.aw += 1; // Despawn counter. First int after shooter -+ } -+ super.inactiveTick(); -+ } -+ // Spigot End -+ - public EntityArrow(World world) { - super(world); - this.h = -1; -diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java -index 7454fde..ff44aa4 100644 ---- a/src/main/java/net/minecraft/server/EntityFireworks.java -+++ b/src/main/java/net/minecraft/server/EntityFireworks.java -@@ -13,6 +13,14 @@ public class EntityFireworks extends Entity { - this.setSize(0.25F, 0.25F); - } - -+ // Spigot Start -+ @Override -+ public void inactiveTick() { -+ this.ticksFlown += 1; -+ super.inactiveTick(); -+ } -+ // Spigot End -+ - protected void i() { - this.datawatcher.register(EntityFireworks.FIREWORK_ITEM, Optional.absent()); - } -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index eb0f8eb..39af5d5 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -122,6 +122,28 @@ public class EntityItem extends Entity { - } - } - -+ // Spigot start - copied from above -+ @Override -+ public void inactiveTick() { -+ // CraftBukkit start - Use wall time for pickup and despawn timers -+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick; -+ if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; -+ if (this.age != -32768) this.age += elapsedTicks; -+ this.lastTick = MinecraftServer.currentTick; -+ // CraftBukkit end -+ -+ if (!this.world.isClientSide && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot -+ // CraftBukkit start - fire ItemDespawnEvent -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { -+ this.age = 0; -+ return; -+ } -+ // CraftBukkit end -+ this.die(); -+ } -+ } -+ // Spigot end -+ - private void x() { - // Spigot start - double radius = world.spigotConfig.itemMerge; -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index aca2c60..96a0571 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -104,6 +104,13 @@ public abstract class EntityLiving extends Entity { - ArrayList drops = new ArrayList(); - public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes; - // CraftBukkit end -+ // Spigot start -+ public void inactiveTick() -+ { -+ super.inactiveTick(); -+ ++this.ticksFarFromPlayer; // Above all the floats -+ } -+ // Spigot end - - public void Q() { - this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 73c31a3..559dd75 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1336,6 +1336,7 @@ public abstract class World implements IBlockAccess { - CrashReportSystemDetails crashreportsystemdetails1; - CrashReport crashreport1; - -+ org.spigotmc.ActivationRange.activateEntities(this); // Spigot - timings.entityTick.startTiming(); // Spigot - // CraftBukkit start - Use field for loop variable - for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) { -@@ -1513,9 +1514,11 @@ public abstract class World implements IBlockAccess { - int j = MathHelper.floor(entity.locZ); - byte b0 = 32; - -- // CraftBukkit start - Use neighbor cache instead of looking up -- Chunk startingChunk = this.getChunkIfLoaded(i >> 4, j >> 4); -- if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { -+ // Spigot start -+ if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { -+ entity.ticksLived++; -+ entity.inactiveTick(); -+ } else { - entity.tickTimer.startTiming(); // Spigot - // CraftBukkit end - entity.M = entity.locX; -diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java -index 558574f..41d2d87 100644 ---- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java -+++ b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java -@@ -39,6 +39,9 @@ public class SpigotTimings { - - public static final CustomTimingsHandler playerCommandTimer = new CustomTimingsHandler("** playerCommand"); - -+ public static final CustomTimingsHandler entityActivationCheckTimer = new CustomTimingsHandler("entityActivationCheck"); -+ public static final CustomTimingsHandler checkIfActiveTimer = new CustomTimingsHandler("** checkIfActive"); -+ - public static final HashMap entityTypeTimingMap = new HashMap(); - public static final HashMap tileEntityTypeTimingMap = new HashMap(); - public static final HashMap pluginTaskTimingMap = new HashMap(); -diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -new file mode 100644 -index 0000000..c4364cd ---- /dev/null -+++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -0,0 +1,286 @@ -+package org.spigotmc; -+ -+import java.util.Set; -+import net.minecraft.server.AxisAlignedBB; -+import net.minecraft.server.Chunk; -+import net.minecraft.server.Entity; -+import net.minecraft.server.EntityAmbient; -+import net.minecraft.server.EntityAnimal; -+import net.minecraft.server.EntityArrow; -+import net.minecraft.server.EntityComplexPart; -+import net.minecraft.server.EntityCreature; -+import net.minecraft.server.EntityCreeper; -+import net.minecraft.server.EntityEnderCrystal; -+import net.minecraft.server.EntityEnderDragon; -+import net.minecraft.server.EntityFireball; -+import net.minecraft.server.EntityFireworks; -+import net.minecraft.server.EntityHuman; -+import net.minecraft.server.EntityLiving; -+import net.minecraft.server.EntityMonster; -+import net.minecraft.server.EntityProjectile; -+import net.minecraft.server.EntitySheep; -+import net.minecraft.server.EntitySlice; -+import net.minecraft.server.EntitySlime; -+import net.minecraft.server.EntityTNTPrimed; -+import net.minecraft.server.EntityVillager; -+import net.minecraft.server.EntityWeather; -+import net.minecraft.server.EntityWither; -+import net.minecraft.server.MathHelper; -+import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.World; -+import org.bukkit.craftbukkit.SpigotTimings; -+ -+public class ActivationRange -+{ -+ -+ static AxisAlignedBB maxBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); -+ static AxisAlignedBB miscBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); -+ static AxisAlignedBB animalBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); -+ static AxisAlignedBB monsterBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); -+ -+ /** -+ * Initializes an entities type on construction to specify what group this -+ * entity is in for activation ranges. -+ * -+ * @param entity -+ * @return group id -+ */ -+ public static byte initializeEntityActivationType(Entity entity) -+ { -+ if ( entity instanceof EntityMonster || entity instanceof EntitySlime ) -+ { -+ return 1; // Monster -+ } else if ( entity instanceof EntityCreature || entity instanceof EntityAmbient ) -+ { -+ return 2; // Animal -+ } else -+ { -+ return 3; // Misc -+ } -+ } -+ -+ /** -+ * These entities are excluded from Activation range checks. -+ * -+ * @param entity -+ * @param world -+ * @return boolean If it should always tick. -+ */ -+ public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) -+ { -+ if ( ( entity.activationType == 3 && config.miscActivationRange == 0 ) -+ || ( entity.activationType == 2 && config.animalActivationRange == 0 ) -+ || ( entity.activationType == 1 && config.monsterActivationRange == 0 ) -+ || entity instanceof EntityHuman -+ || entity instanceof EntityProjectile -+ || entity instanceof EntityEnderDragon -+ || entity instanceof EntityComplexPart -+ || entity instanceof EntityWither -+ || entity instanceof EntityFireball -+ || entity instanceof EntityWeather -+ || entity instanceof EntityTNTPrimed -+ || entity instanceof EntityEnderCrystal -+ || entity instanceof EntityFireworks ) -+ { -+ return true; -+ } -+ -+ return false; -+ } -+ -+ /** -+ * Find what entities are in range of the players in the world and set -+ * active if in range. -+ * -+ * @param world -+ */ -+ public static void activateEntities(World world) -+ { -+ SpigotTimings.entityActivationCheckTimer.startTiming(); -+ final int miscActivationRange = world.spigotConfig.miscActivationRange; -+ final int animalActivationRange = world.spigotConfig.animalActivationRange; -+ final int monsterActivationRange = world.spigotConfig.monsterActivationRange; -+ -+ int maxRange = Math.max( monsterActivationRange, animalActivationRange ); -+ maxRange = Math.max( maxRange, miscActivationRange ); -+ maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange ); -+ -+ for ( EntityHuman player : world.players ) -+ { -+ -+ player.activatedTick = MinecraftServer.currentTick; -+ maxBB = player.getBoundingBox().grow( maxRange, 256, maxRange ); -+ miscBB = player.getBoundingBox().grow( miscActivationRange, 256, miscActivationRange ); -+ animalBB = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange ); -+ monsterBB = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange ); -+ -+ int i = MathHelper.floor( maxBB.a / 16.0D ); -+ int j = MathHelper.floor( maxBB.d / 16.0D ); -+ int k = MathHelper.floor( maxBB.c / 16.0D ); -+ int l = MathHelper.floor( maxBB.f / 16.0D ); -+ -+ for ( int i1 = i; i1 <= j; ++i1 ) -+ { -+ for ( int j1 = k; j1 <= l; ++j1 ) -+ { -+ if ( world.getWorld().isChunkLoaded( i1, j1 ) ) -+ { -+ activateChunkEntities( world.getChunkAt( i1, j1 ) ); -+ } -+ } -+ } -+ } -+ SpigotTimings.entityActivationCheckTimer.stopTiming(); -+ } -+ -+ /** -+ * Checks for the activation state of all entities in this chunk. -+ * -+ * @param chunk -+ */ -+ private static void activateChunkEntities(Chunk chunk) -+ { -+ for ( EntitySlice slice : chunk.entitySlices ) -+ { -+ for ( Entity entity : (Set) slice ) -+ { -+ if ( MinecraftServer.currentTick > entity.activatedTick ) -+ { -+ if ( entity.defaultActivationState ) -+ { -+ entity.activatedTick = MinecraftServer.currentTick; -+ continue; -+ } -+ switch ( entity.activationType ) -+ { -+ case 1: -+ if ( monsterBB.b( entity.getBoundingBox() ) ) -+ { -+ entity.activatedTick = MinecraftServer.currentTick; -+ } -+ break; -+ case 2: -+ if ( animalBB.b( entity.getBoundingBox() ) ) -+ { -+ entity.activatedTick = MinecraftServer.currentTick; -+ } -+ break; -+ case 3: -+ default: -+ if ( miscBB.b( entity.getBoundingBox() ) ) -+ { -+ entity.activatedTick = MinecraftServer.currentTick; -+ } -+ } -+ } -+ } -+ } -+ } -+ -+ /** -+ * If an entity is not in range, do some more checks to see if we should -+ * give it a shot. -+ * -+ * @param entity -+ * @return -+ */ -+ public static boolean checkEntityImmunities(Entity entity) -+ { -+ // quick checks. -+ if ( entity.inWater || entity.fireTicks > 0 ) -+ { -+ return true; -+ } -+ if ( !( entity instanceof EntityArrow ) ) -+ { -+ if ( !entity.onGround || !entity.passengers.isEmpty() || entity.isPassenger() ) -+ { -+ return true; -+ } -+ } else if ( !( (EntityArrow) entity ).inGround ) -+ { -+ return true; -+ } -+ // special cases. -+ if ( entity instanceof EntityLiving ) -+ { -+ EntityLiving living = (EntityLiving) entity; -+ if ( /*TODO: Missed mapping? living.attackTicks > 0 || */ living.hurtTicks > 0 || living.effects.size() > 0 ) -+ { -+ return true; -+ } -+ if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).getGoalTarget() != null ) -+ { -+ return true; -+ } -+ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).da() /* Getter for first boolean */ ) -+ { -+ return true; -+ } -+ if ( entity instanceof EntityAnimal ) -+ { -+ EntityAnimal animal = (EntityAnimal) entity; -+ if ( animal.isBaby() || animal.isInLove() ) -+ { -+ return true; -+ } -+ if ( entity instanceof EntitySheep && ( (EntitySheep) entity ).isSheared() ) -+ { -+ return true; -+ } -+ } -+ if (entity instanceof EntityCreeper && ((EntityCreeper) entity).isIgnited()) { // isExplosive -+ return true; -+ } -+ } -+ return false; -+ } -+ -+ /** -+ * Checks if the entity is active for this tick. -+ * -+ * @param entity -+ * @return -+ */ -+ public static boolean checkIfActive(Entity entity) -+ { -+ SpigotTimings.checkIfActiveTimer.startTiming(); -+ // Never safe to skip fireworks or entities not yet added to chunk -+ // PAIL: inChunk -+ if ( !entity.aa || entity instanceof EntityFireworks ) { -+ SpigotTimings.checkIfActiveTimer.stopTiming(); -+ return true; -+ } -+ -+ boolean isActive = entity.activatedTick >= MinecraftServer.currentTick || entity.defaultActivationState; -+ -+ // Should this entity tick? -+ if ( !isActive ) -+ { -+ if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 ) -+ { -+ // Check immunities every 20 ticks. -+ if ( checkEntityImmunities( entity ) ) -+ { -+ // Triggered some sort of immunity, give 20 full ticks before we check again. -+ entity.activatedTick = MinecraftServer.currentTick + 20; -+ } -+ isActive = true; -+ } -+ // Add a little performance juice to active entities. Skip 1/4 if not immune. -+ } else if ( !entity.defaultActivationState && entity.ticksLived % 4 == 0 && !checkEntityImmunities( entity ) ) -+ { -+ isActive = false; -+ } -+ int x = MathHelper.floor( entity.locX ); -+ int z = MathHelper.floor( entity.locZ ); -+ // Make sure not on edge of unloaded chunk -+ Chunk chunk = entity.world.getChunkIfLoaded( x >> 4, z >> 4 ); -+ if ( isActive && !( chunk != null && chunk.areNeighborsLoaded( 1 ) ) ) -+ { -+ isActive = false; -+ } -+ SpigotTimings.checkIfActiveTimer.stopTiming(); -+ return isActive; -+ } -+} -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index ca888fc..92dbe54 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -136,4 +136,15 @@ public class SpigotWorldConfig - itemDespawnRate = getInt( "item-despawn-rate", 6000 ); - log( "Item Despawn Rate: " + itemDespawnRate ); - } -+ -+ public int animalActivationRange = 32; -+ public int monsterActivationRange = 32; -+ public int miscActivationRange = 16; -+ private void activationRange() -+ { -+ animalActivationRange = getInt( "entity-activation-range.animals", animalActivationRange ); -+ monsterActivationRange = getInt( "entity-activation-range.monsters", monsterActivationRange ); -+ miscActivationRange = getInt( "entity-activation-range.misc", miscActivationRange ); -+ log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Mi " + miscActivationRange ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0015-Metrics.patch b/CraftBukkit-Patches/0015-Metrics.patch deleted file mode 100644 index 2b5c6567bf..0000000000 --- a/CraftBukkit-Patches/0015-Metrics.patch +++ /dev/null @@ -1,691 +0,0 @@ -From 00a824f87f74ff3b2f2e1689d79dc143c481d0b5 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 23 Feb 2013 08:58:35 +1100 -Subject: [PATCH] Metrics - - -diff --git a/src/main/java/org/spigotmc/Metrics.java b/src/main/java/org/spigotmc/Metrics.java -new file mode 100644 -index 0000000..a5fd59d ---- /dev/null -+++ b/src/main/java/org/spigotmc/Metrics.java -@@ -0,0 +1,645 @@ -+/* -+ * Copyright 2011-2013 Tyler Blair. All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without modification, are -+ * permitted provided that the following conditions are met: -+ * -+ * 1. Redistributions of source code must retain the above copyright notice, this list of -+ * conditions and the following disclaimer. -+ * -+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list -+ * of conditions and the following disclaimer in the documentation and/or other materials -+ * provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * The views and conclusions contained in the software and documentation are those of the -+ * authors and contributors and should not be interpreted as representing official policies, -+ * either expressed or implied, of anybody else. -+ */ -+package org.spigotmc; -+ -+import org.bukkit.Bukkit; -+import org.bukkit.configuration.file.YamlConfiguration; -+import org.bukkit.configuration.InvalidConfigurationException; -+import org.bukkit.plugin.Plugin; -+import org.bukkit.plugin.PluginDescriptionFile; -+import org.bukkit.scheduler.BukkitTask; -+ -+import java.io.BufferedReader; -+import java.io.File; -+import java.io.IOException; -+import java.io.InputStreamReader; -+import java.io.OutputStreamWriter; -+import java.io.UnsupportedEncodingException; -+import java.net.Proxy; -+import java.net.URL; -+import java.net.URLConnection; -+import java.net.URLEncoder; -+import java.util.Collections; -+import java.util.HashSet; -+import java.util.Iterator; -+import java.util.LinkedHashSet; -+import java.util.Set; -+import java.util.Timer; -+import java.util.TimerTask; -+import java.util.UUID; -+import java.util.concurrent.TimeUnit; -+import java.util.logging.Level; -+import net.minecraft.server.MinecraftServer; -+ -+/** -+ *

The metrics class obtains data about a plugin and submits statistics about it to the metrics backend.

-+ * Public methods provided by this class:

-+ * -+ * Graph createGraph(String name);
-+ * void addCustomData(BukkitMetrics.Plotter plotter);
-+ * void start();
-+ *
-+ */ -+public class Metrics { -+ -+ /** -+ * The current revision number -+ */ -+ private final static int REVISION = 6; -+ /** -+ * The base url of the metrics domain -+ */ -+ private static final String BASE_URL = "http://mcstats.org"; -+ /** -+ * The url used to report a server's status -+ */ -+ private static final String REPORT_URL = "/report/%s"; -+ /** -+ * The separator to use for custom data. This MUST NOT change unless you are hosting your own version of metrics and -+ * want to change it. -+ */ -+ private static final String CUSTOM_DATA_SEPARATOR = "~~"; -+ /** -+ * Interval of time to ping (in minutes) -+ */ -+ private static final int PING_INTERVAL = 10; -+ /** -+ * All of the custom graphs to submit to metrics -+ */ -+ private final Set graphs = Collections.synchronizedSet(new HashSet()); -+ /** -+ * The default graph, used for addCustomData when you don't want a specific graph -+ */ -+ private final Graph defaultGraph = new Graph("Default"); -+ /** -+ * The plugin configuration file -+ */ -+ private final YamlConfiguration configuration; -+ /** -+ * The plugin configuration file -+ */ -+ private final File configurationFile; -+ /** -+ * Unique server id -+ */ -+ private final String guid; -+ /** -+ * Debug mode -+ */ -+ private final boolean debug; -+ /** -+ * Lock for synchronization -+ */ -+ private final Object optOutLock = new Object(); -+ /** -+ * The scheduled task -+ */ -+ private volatile Timer task = null; -+ -+ public Metrics() throws IOException { -+ // load the config -+ configurationFile = getConfigFile(); -+ configuration = YamlConfiguration.loadConfiguration(configurationFile); -+ -+ // add some defaults -+ configuration.addDefault("opt-out", false); -+ configuration.addDefault("guid", UUID.randomUUID().toString()); -+ configuration.addDefault("debug", false); -+ -+ // Do we need to create the file? -+ if (configuration.get("guid", null) == null) { -+ configuration.options().header("http://mcstats.org").copyDefaults(true); -+ configuration.save(configurationFile); -+ } -+ -+ // Load the guid then -+ guid = configuration.getString("guid"); -+ debug = configuration.getBoolean("debug", false); -+ } -+ -+ /** -+ * Construct and create a Graph that can be used to separate specific plotters to their own graphs on the metrics -+ * website. Plotters can be added to the graph object returned. -+ * -+ * @param name The name of the graph -+ * @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given -+ */ -+ public Graph createGraph(final String name) { -+ if (name == null) { -+ throw new IllegalArgumentException("Graph name cannot be null"); -+ } -+ -+ // Construct the graph object -+ final Graph graph = new Graph(name); -+ -+ // Now we can add our graph -+ graphs.add(graph); -+ -+ // and return back -+ return graph; -+ } -+ -+ /** -+ * Add a Graph object to BukkitMetrics that represents data for the plugin that should be sent to the backend -+ * -+ * @param graph The name of the graph -+ */ -+ public void addGraph(final Graph graph) { -+ if (graph == null) { -+ throw new IllegalArgumentException("Graph cannot be null"); -+ } -+ -+ graphs.add(graph); -+ } -+ -+ /** -+ * Adds a custom data plotter to the default graph -+ * -+ * @param plotter The plotter to use to plot custom data -+ */ -+ public void addCustomData(final Plotter plotter) { -+ if (plotter == null) { -+ throw new IllegalArgumentException("Plotter cannot be null"); -+ } -+ -+ // Add the plotter to the graph o/ -+ defaultGraph.addPlotter(plotter); -+ -+ // Ensure the default graph is included in the submitted graphs -+ graphs.add(defaultGraph); -+ } -+ -+ /** -+ * Start measuring statistics. This will immediately create an async repeating task as the plugin and send the -+ * initial data to the metrics backend, and then after that it will post in increments of PING_INTERVAL * 1200 -+ * ticks. -+ * -+ * @return True if statistics measuring is running, otherwise false. -+ */ -+ public boolean start() { -+ synchronized (optOutLock) { -+ // Did we opt out? -+ if (isOptOut()) { -+ return false; -+ } -+ -+ // Is metrics already running? -+ if (task != null) { -+ return true; -+ } -+ -+ // Begin hitting the server with glorious data -+ task = new Timer("Spigot Metrics Thread", true); -+ -+ task.scheduleAtFixedRate(new TimerTask() { -+ private boolean firstPost = true; -+ -+ public void run() { -+ try { -+ // This has to be synchronized or it can collide with the disable method. -+ synchronized (optOutLock) { -+ // Disable Task, if it is running and the server owner decided to opt-out -+ if (isOptOut() && task != null) { -+ task.cancel(); -+ task = null; -+ // Tell all plotters to stop gathering information. -+ for (Graph graph : graphs) { -+ graph.onOptOut(); -+ } -+ } -+ } -+ -+ // We use the inverse of firstPost because if it is the first time we are posting, -+ // it is not a interval ping, so it evaluates to FALSE -+ // Each time thereafter it will evaluate to TRUE, i.e PING! -+ postPlugin(!firstPost); -+ -+ // After the first post we set firstPost to false -+ // Each post thereafter will be a ping -+ firstPost = false; -+ } catch (IOException e) { -+ if (debug) { -+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage()); -+ } -+ } -+ } -+ }, 0, TimeUnit.MINUTES.toMillis(PING_INTERVAL)); -+ -+ return true; -+ } -+ } -+ -+ /** -+ * Has the server owner denied plugin metrics? -+ * -+ * @return true if metrics should be opted out of it -+ */ -+ public boolean isOptOut() { -+ synchronized (optOutLock) { -+ try { -+ // Reload the metrics file -+ configuration.load(getConfigFile()); -+ } catch (IOException ex) { -+ if (debug) { -+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); -+ } -+ return true; -+ } catch (InvalidConfigurationException ex) { -+ if (debug) { -+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); -+ } -+ return true; -+ } -+ return configuration.getBoolean("opt-out", false); -+ } -+ } -+ -+ /** -+ * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task. -+ * -+ * @throws java.io.IOException -+ */ -+ public void enable() throws IOException { -+ // This has to be synchronized or it can collide with the check in the task. -+ synchronized (optOutLock) { -+ // Check if the server owner has already set opt-out, if not, set it. -+ if (isOptOut()) { -+ configuration.set("opt-out", false); -+ configuration.save(configurationFile); -+ } -+ -+ // Enable Task, if it is not running -+ if (task == null) { -+ start(); -+ } -+ } -+ } -+ -+ /** -+ * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task. -+ * -+ * @throws java.io.IOException -+ */ -+ public void disable() throws IOException { -+ // This has to be synchronized or it can collide with the check in the task. -+ synchronized (optOutLock) { -+ // Check if the server owner has already set opt-out, if not, set it. -+ if (!isOptOut()) { -+ configuration.set("opt-out", true); -+ configuration.save(configurationFile); -+ } -+ -+ // Disable Task, if it is running -+ if (task != null) { -+ task.cancel(); -+ task = null; -+ } -+ } -+ } -+ -+ /** -+ * Gets the File object of the config file that should be used to store data such as the GUID and opt-out status -+ * -+ * @return the File object for the config file -+ */ -+ public File getConfigFile() { -+ // I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use -+ // is to abuse the plugin object we already have -+ // plugin.getDataFolder() => base/plugins/PluginA/ -+ // pluginsFolder => base/plugins/ -+ // The base is not necessarily relative to the startup directory. -+ // File pluginsFolder = plugin.getDataFolder().getParentFile(); -+ -+ // return => base/plugins/PluginMetrics/config.yml -+ return new File(new File((File) MinecraftServer.getServer().options.valueOf("plugins"), "PluginMetrics"), "config.yml"); -+ } -+ -+ /** -+ * Generic method that posts a plugin to the metrics website -+ */ -+ private void postPlugin(final boolean isPing) throws IOException { -+ // Server software specific section -+ String pluginName = "Spigot"; -+ boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled -+ String pluginVersion = (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown"; -+ String serverVersion = Bukkit.getVersion(); -+ int playersOnline = Bukkit.getServer().getOnlinePlayers().size(); -+ -+ // END server software specific section -- all code below does not use any code outside of this class / Java -+ -+ // Construct the post data -+ final StringBuilder data = new StringBuilder(); -+ -+ // The plugin's description file containg all of the plugin data such as name, version, author, etc -+ data.append(encode("guid")).append('=').append(encode(guid)); -+ encodeDataPair(data, "version", pluginVersion); -+ encodeDataPair(data, "server", serverVersion); -+ encodeDataPair(data, "players", Integer.toString(playersOnline)); -+ encodeDataPair(data, "revision", String.valueOf(REVISION)); -+ -+ // New data as of R6 -+ String osname = System.getProperty("os.name"); -+ String osarch = System.getProperty("os.arch"); -+ String osversion = System.getProperty("os.version"); -+ String java_version = System.getProperty("java.version"); -+ int coreCount = Runtime.getRuntime().availableProcessors(); -+ -+ // normalize os arch .. amd64 -> x86_64 -+ if (osarch.equals("amd64")) { -+ osarch = "x86_64"; -+ } -+ -+ encodeDataPair(data, "osname", osname); -+ encodeDataPair(data, "osarch", osarch); -+ encodeDataPair(data, "osversion", osversion); -+ encodeDataPair(data, "cores", Integer.toString(coreCount)); -+ encodeDataPair(data, "online-mode", Boolean.toString(onlineMode)); -+ encodeDataPair(data, "java_version", java_version); -+ -+ // If we're pinging, append it -+ if (isPing) { -+ encodeDataPair(data, "ping", "true"); -+ } -+ -+ // Acquire a lock on the graphs, which lets us make the assumption we also lock everything -+ // inside of the graph (e.g plotters) -+ synchronized (graphs) { -+ final Iterator iter = graphs.iterator(); -+ -+ while (iter.hasNext()) { -+ final Graph graph = iter.next(); -+ -+ for (Plotter plotter : graph.getPlotters()) { -+ // The key name to send to the metrics server -+ // The format is C-GRAPHNAME-PLOTTERNAME where separator - is defined at the top -+ // Legacy (R4) submitters use the format Custom%s, or CustomPLOTTERNAME -+ final String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(), CUSTOM_DATA_SEPARATOR, plotter.getColumnName()); -+ -+ // The value to send, which for the foreseeable future is just the string -+ // value of plotter.getValue() -+ final String value = Integer.toString(plotter.getValue()); -+ -+ // Add it to the http post data :) -+ encodeDataPair(data, key, value); -+ } -+ } -+ } -+ -+ // Create the url -+ URL url = new URL(BASE_URL + String.format(REPORT_URL, encode(pluginName))); -+ -+ // Connect to the website -+ URLConnection connection; -+ -+ // Mineshafter creates a socks proxy, so we can safely bypass it -+ // It does not reroute POST requests so we need to go around it -+ if (isMineshafterPresent()) { -+ connection = url.openConnection(Proxy.NO_PROXY); -+ } else { -+ connection = url.openConnection(); -+ } -+ -+ connection.setDoOutput(true); -+ -+ // Write the data -+ final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); -+ writer.write(data.toString()); -+ writer.flush(); -+ -+ // Now read the response -+ final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); -+ final String response = reader.readLine(); -+ -+ // close resources -+ writer.close(); -+ reader.close(); -+ -+ if (response == null || response.startsWith("ERR")) { -+ throw new IOException(response); //Throw the exception -+ } else { -+ // Is this the first update this hour? -+ if (response.contains("OK This is your first update this hour")) { -+ synchronized (graphs) { -+ final Iterator iter = graphs.iterator(); -+ -+ while (iter.hasNext()) { -+ final Graph graph = iter.next(); -+ -+ for (Plotter plotter : graph.getPlotters()) { -+ plotter.reset(); -+ } -+ } -+ } -+ } -+ } -+ } -+ -+ /** -+ * Check if mineshafter is present. If it is, we need to bypass it to send POST requests -+ * -+ * @return true if mineshafter is installed on the server -+ */ -+ private boolean isMineshafterPresent() { -+ try { -+ Class.forName("mineshafter.MineServer"); -+ return true; -+ } catch (Exception e) { -+ return false; -+ } -+ } -+ -+ /** -+ *

Encode a key/value data pair to be used in a HTTP post request. This INCLUDES a & so the first key/value pair -+ * MUST be included manually, e.g:

-+ * -+ * StringBuffer data = new StringBuffer(); -+ * data.append(encode("guid")).append('=').append(encode(guid)); -+ * encodeDataPair(data, "version", description.getVersion()); -+ * -+ * -+ * @param buffer the stringbuilder to append the data pair onto -+ * @param key the key value -+ * @param value the value -+ */ -+ private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException { -+ buffer.append('&').append(encode(key)).append('=').append(encode(value)); -+ } -+ -+ /** -+ * Encode text as UTF-8 -+ * -+ * @param text the text to encode -+ * @return the encoded text, as UTF-8 -+ */ -+ private static String encode(final String text) throws UnsupportedEncodingException { -+ return URLEncoder.encode(text, "UTF-8"); -+ } -+ -+ /** -+ * Represents a custom graph on the website -+ */ -+ public static class Graph { -+ -+ /** -+ * The graph's name, alphanumeric and spaces only :) If it does not comply to the above when submitted, it is -+ * rejected -+ */ -+ private final String name; -+ /** -+ * The set of plotters that are contained within this graph -+ */ -+ private final Set plotters = new LinkedHashSet(); -+ -+ private Graph(final String name) { -+ this.name = name; -+ } -+ -+ /** -+ * Gets the graph's name -+ * -+ * @return the Graph's name -+ */ -+ public String getName() { -+ return name; -+ } -+ -+ /** -+ * Add a plotter to the graph, which will be used to plot entries -+ * -+ * @param plotter the plotter to add to the graph -+ */ -+ public void addPlotter(final Plotter plotter) { -+ plotters.add(plotter); -+ } -+ -+ /** -+ * Remove a plotter from the graph -+ * -+ * @param plotter the plotter to remove from the graph -+ */ -+ public void removePlotter(final Plotter plotter) { -+ plotters.remove(plotter); -+ } -+ -+ /** -+ * Gets an unmodifiable set of the plotter objects in the graph -+ * -+ * @return an unmodifiable {@link java.util.Set} of the plotter objects -+ */ -+ public Set getPlotters() { -+ return Collections.unmodifiableSet(plotters); -+ } -+ -+ @Override -+ public int hashCode() { -+ return name.hashCode(); -+ } -+ -+ @Override -+ public boolean equals(final Object object) { -+ if (!(object instanceof Graph)) { -+ return false; -+ } -+ -+ final Graph graph = (Graph) object; -+ return graph.name.equals(name); -+ } -+ -+ /** -+ * Called when the server owner decides to opt-out of BukkitMetrics while the server is running. -+ */ -+ protected void onOptOut() { -+ } -+ } -+ -+ /** -+ * Interface used to collect custom data for a plugin -+ */ -+ public static abstract class Plotter { -+ -+ /** -+ * The plot's name -+ */ -+ private final String name; -+ -+ /** -+ * Construct a plotter with the default plot name -+ */ -+ public Plotter() { -+ this("Default"); -+ } -+ -+ /** -+ * Construct a plotter with a specific plot name -+ * -+ * @param name the name of the plotter to use, which will show up on the website -+ */ -+ public Plotter(final String name) { -+ this.name = name; -+ } -+ -+ /** -+ * Get the current value for the plotted point. Since this function defers to an external function it may or may -+ * not return immediately thus cannot be guaranteed to be thread friendly or safe. This function can be called -+ * from any thread so care should be taken when accessing resources that need to be synchronized. -+ * -+ * @return the current value for the point to be plotted. -+ */ -+ public abstract int getValue(); -+ -+ /** -+ * Get the column name for the plotted point -+ * -+ * @return the plotted point's column name -+ */ -+ public String getColumnName() { -+ return name; -+ } -+ -+ /** -+ * Called after the website graphs have been updated -+ */ -+ public void reset() { -+ } -+ -+ @Override -+ public int hashCode() { -+ return getColumnName().hashCode(); -+ } -+ -+ @Override -+ public boolean equals(final Object object) { -+ if (!(object instanceof Plotter)) { -+ return false; -+ } -+ -+ final Plotter plotter = (Plotter) object; -+ return plotter.name.equals(name) && plotter.getValue() == getValue(); -+ } -+ } -+} -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index cb88089..dcca493 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -36,6 +36,7 @@ public class SpigotConfig - static int version; - static Map commands; - /*========================================================================*/ -+ private static Metrics metrics; - - public static void init(File configFile) - { -@@ -68,6 +69,18 @@ public class SpigotConfig - { - MinecraftServer.getServer().server.getCommandMap().register( entry.getKey(), "Spigot", entry.getValue() ); - } -+ -+ if ( metrics == null ) -+ { -+ try -+ { -+ metrics = new Metrics(); -+ metrics.start(); -+ } catch ( IOException ex ) -+ { -+ Bukkit.getServer().getLogger().log( Level.SEVERE, "Could not start metrics service", ex ); -+ } -+ } - } - - static void readConfig(Class clazz, Object instance) --- -2.5.0 - diff --git a/CraftBukkit-Patches/0016-PlayerItemDamageEvent.patch b/CraftBukkit-Patches/0016-PlayerItemDamageEvent.patch deleted file mode 100644 index 1a2e8bcd0f..0000000000 --- a/CraftBukkit-Patches/0016-PlayerItemDamageEvent.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 9f79aedb7c74ac76bbc9360b8a63b4fa0122313f Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 4 Mar 2013 18:45:52 +1100 -Subject: [PATCH] PlayerItemDamageEvent - - -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index e659ac5..782ca57 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -338,6 +338,11 @@ public final class ItemStack { - } - - public boolean isDamaged(int i, Random random) { -+ return isDamaged(i, random, null); -+ } -+ -+ public boolean isDamaged(int i, Random random, EntityLiving entityliving) { -+ // Spigot end - if (!this.e()) { - return false; - } else { -@@ -352,7 +357,16 @@ public final class ItemStack { - } - - i -= k; -- if (i <= 0) { -+ // Spigot start -+ if (entityliving instanceof EntityPlayer) { -+ org.bukkit.craftbukkit.inventory.CraftItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this); -+ org.bukkit.event.player.PlayerItemDamageEvent event = new org.bukkit.event.player.PlayerItemDamageEvent((org.bukkit.entity.Player) entityliving.getBukkitEntity(), item, i); -+ org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event); -+ if (event.isCancelled()) return false; -+ i = event.getDamage(); -+ } -+ // Spigot end -+ if (i <= 0 ) { - return false; - } - } -@@ -365,7 +379,7 @@ public final class ItemStack { - public void damage(int i, EntityLiving entityliving) { - if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) { - if (this.e()) { -- if (this.isDamaged(i, entityliving.getRandom())) { -+ if (this.isDamaged(i, entityliving.getRandom(), entityliving)) { // Spigot - entityliving.b(this); - --this.count; - if (entityliving instanceof EntityHuman) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0017-Prevent-NPE-in-CraftSign.patch b/CraftBukkit-Patches/0017-Prevent-NPE-in-CraftSign.patch deleted file mode 100644 index e5ac59e92d..0000000000 --- a/CraftBukkit-Patches/0017-Prevent-NPE-in-CraftSign.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 8ab16d84c2c2527ca6d12c3f2ecee24d46e9facb Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 18 Mar 2013 20:01:44 +1100 -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 42a6f9a..43adfcc 100644 ---- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -@@ -18,6 +18,12 @@ public class CraftSign extends CraftBlockState implements Sign { - - CraftWorld world = (CraftWorld) block.getWorld(); - sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ()); -+ // Spigot start -+ if (sign == null) { -+ lines = new String[]{"", "", "", ""}; -+ return; -+ } -+ // Spigot end - lines = new String[sign.lines.length]; - System.arraycopy(revertComponents(sign.lines), 0, lines, 0, lines.length); - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0018-Entity-Tracking-Ranges.patch b/CraftBukkit-Patches/0018-Entity-Tracking-Ranges.patch deleted file mode 100644 index bcf82f8afe..0000000000 --- a/CraftBukkit-Patches/0018-Entity-Tracking-Ranges.patch +++ /dev/null @@ -1,109 +0,0 @@ -From f7020dc8e3f83b179a9ae3e8df654c1498dafc06 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 20 Feb 2013 11:58:47 -0500 -Subject: [PATCH] Entity Tracking Ranges - -This will let you configure how far to track entities in range from players, so that the entity does not render on the client if out of this range. -This has multiple benefits: - -1) Less bandwidth. Not sending update packets for entities that are not even close to a player, or even close enough to clearly see. -2) Less lag by maps in item frames - Default range is 160 blocks... Many players can track that item frame and cause lag and not even see it. -3) Less lag in general - Less work for the server to do -4) Less client lag - Not trying to render distant item frames and paintings and entities will reduce entity count on the client, which is major for shop/town worlds which may use tons of item frames. - -diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java -index 0c19e5a..3773bb1 100644 ---- a/src/main/java/net/minecraft/server/EntityTracker.java -+++ b/src/main/java/net/minecraft/server/EntityTracker.java -@@ -103,6 +103,7 @@ public class EntityTracker { - - public void addEntity(Entity entity, int i, final int j, boolean flag) { - org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot -+ i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, i); // Spigot - try { - if (this.trackedEntities.b(entity.getId())) { - throw new IllegalStateException("Entity is already tracked!"); -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 92dbe54..1369657 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -147,4 +147,19 @@ public class SpigotWorldConfig - miscActivationRange = getInt( "entity-activation-range.misc", miscActivationRange ); - log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Mi " + miscActivationRange ); - } -+ -+ public int playerTrackingRange = 48; -+ public int animalTrackingRange = 48; -+ public int monsterTrackingRange = 48; -+ public int miscTrackingRange = 32; -+ public int otherTrackingRange = 64; -+ private void trackingRange() -+ { -+ playerTrackingRange = getInt( "entity-tracking-range.players", playerTrackingRange ); -+ animalTrackingRange = getInt( "entity-tracking-range.animals", animalTrackingRange ); -+ monsterTrackingRange = getInt( "entity-tracking-range.monsters", monsterTrackingRange ); -+ miscTrackingRange = getInt( "entity-tracking-range.misc", miscTrackingRange ); -+ otherTrackingRange = getInt( "entity-tracking-range.other", otherTrackingRange ); -+ log( "Entity Tracking Range: Pl " + playerTrackingRange + " / An " + animalTrackingRange + " / Mo " + monsterTrackingRange + " / Mi " + miscTrackingRange + " / Other " + otherTrackingRange ); -+ } - } -diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java -new file mode 100644 -index 0000000..4bf4d2a ---- /dev/null -+++ b/src/main/java/org/spigotmc/TrackingRange.java -@@ -0,0 +1,51 @@ -+package org.spigotmc; -+ -+import net.minecraft.server.Entity; -+import net.minecraft.server.EntityExperienceOrb; -+import net.minecraft.server.EntityGhast; -+import net.minecraft.server.EntityItem; -+import net.minecraft.server.EntityItemFrame; -+import net.minecraft.server.EntityPainting; -+import net.minecraft.server.EntityPlayer; -+ -+public class TrackingRange -+{ -+ -+ /** -+ * Gets the range an entity should be 'tracked' by players and visible in -+ * the client. -+ * -+ * @param entity -+ * @param defaultRange Default range defined by Mojang -+ * @return -+ */ -+ public static int getEntityTrackingRange(Entity entity, int defaultRange) -+ { -+ SpigotWorldConfig config = entity.world.spigotConfig; -+ if ( entity instanceof EntityPlayer ) -+ { -+ return config.playerTrackingRange; -+ } else if ( entity.activationType == 1 ) -+ { -+ return config.monsterTrackingRange; -+ } else if ( entity instanceof EntityGhast ) -+ { -+ if ( config.monsterTrackingRange > config.monsterActivationRange ) -+ { -+ return config.monsterTrackingRange; -+ } else -+ { -+ return config.monsterActivationRange; -+ } -+ } else if ( entity.activationType == 2 ) -+ { -+ return config.animalTrackingRange; -+ } else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityExperienceOrb ) -+ { -+ return config.miscTrackingRange; -+ } else -+ { -+ return config.otherTrackingRange; -+ } -+ } -+} --- -2.5.0 - diff --git a/CraftBukkit-Patches/0019-Thread-Naming-and-Tweaks.patch b/CraftBukkit-Patches/0019-Thread-Naming-and-Tweaks.patch deleted file mode 100644 index 9143348809..0000000000 --- a/CraftBukkit-Patches/0019-Thread-Naming-and-Tweaks.patch +++ /dev/null @@ -1,23 +0,0 @@ -From c80bcc2152798c930886951e4a7dadec80af2623 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 23 Apr 2013 11:50:27 +1000 -Subject: [PATCH] Thread Naming and Tweaks - -Removes the sleep forever thread and adds useful names for debugging to all staged thread files. - -diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 8442ecb..93d8d42 100644 ---- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -@@ -72,7 +72,7 @@ public class CraftScheduler implements BukkitScheduler { - */ - private final ConcurrentHashMap runners = new ConcurrentHashMap(); - private volatile int currentTick = -1; -- private final Executor executor = Executors.newCachedThreadPool(); -+ private final Executor executor = Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %1$d").build()); // Spigot - private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {@Override StringBuilder debugTo(StringBuilder string) {return string;}}; - private CraftAsyncDebugger debugTail = debugHead; - private static final int RECENT_TICKS; --- -2.5.0 - diff --git a/CraftBukkit-Patches/0020-Close-Unloaded-Save-Files.patch b/CraftBukkit-Patches/0020-Close-Unloaded-Save-Files.patch deleted file mode 100644 index dbc3aaa9de..0000000000 --- a/CraftBukkit-Patches/0020-Close-Unloaded-Save-Files.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 1fdbeff9746f4351c28d219906ba0827c4e042c3 Mon Sep 17 00:00:00 2001 -From: Antony Riley -Date: Wed, 27 Mar 2013 01:41:54 +0200 -Subject: [PATCH] Close Unloaded Save Files - - -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index b07e7d5..5528019 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -10,7 +10,7 @@ import java.util.Map; - - public class RegionFileCache { - -- private static final Map a = Maps.newHashMap(); -+ public static final Map a = Maps.newHashMap(); // Spigot - private -> public - - public static synchronized RegionFile a(File file, int i, int j) { - File file1 = new File(file, "region"); -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 261b423..f906f60 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -966,6 +966,31 @@ public final class CraftServer implements Server { - - worlds.remove(world.getName().toLowerCase()); - console.worlds.remove(console.worlds.indexOf(handle)); -+ -+ File parentFolder = world.getWorldFolder().getAbsoluteFile(); -+ -+ // Synchronized because access to RegionFileCache.a is guarded by this lock. -+ synchronized (RegionFileCache.class) { -+ // RegionFileCache.a should be RegionFileCache.cache -+ Iterator> i = RegionFileCache.a.entrySet().iterator(); -+ while(i.hasNext()) { -+ Map.Entry entry = i.next(); -+ File child = entry.getKey().getAbsoluteFile(); -+ while (child != null) { -+ if (child.equals(parentFolder)) { -+ i.remove(); -+ try { -+ entry.getValue().c(); // Should be RegionFile.close(); -+ } catch (IOException ex) { -+ getLogger().log(Level.SEVERE, null, ex); -+ } -+ break; -+ } -+ child = child.getParentFile(); -+ } -+ } -+ } -+ - return true; - } - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0021-Remove-o-Option.patch b/CraftBukkit-Patches/0021-Remove-o-Option.patch deleted file mode 100644 index 490e898349..0000000000 --- a/CraftBukkit-Patches/0021-Remove-o-Option.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 4f8eb5a098a2303e0aa999424b5a425d6e20640a Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 19 May 2013 18:29:48 +1000 -Subject: [PATCH] Remove -o Option - -Serves no purpose other than to confuse users. - -diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java -index 8ee534b..80ec702 100644 ---- a/src/main/java/net/minecraft/server/PropertyManager.java -+++ b/src/main/java/net/minecraft/server/PropertyManager.java -@@ -54,7 +54,7 @@ public class PropertyManager { - } - - private T getOverride(String name, T value) { -- if ((this.options != null) && (this.options.has(name))) { -+ if ((this.options != null) && (this.options.has(name)) && !name.equals( "online-mode")) { // Spigot - return (T) this.options.valueOf(name); - } - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0022-Recipe-Deconstruction.patch b/CraftBukkit-Patches/0022-Recipe-Deconstruction.patch deleted file mode 100644 index 0220c95788..0000000000 --- a/CraftBukkit-Patches/0022-Recipe-Deconstruction.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 2eb971b8ea7c38519d0acaa6dbae6e74bf2cb457 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 1 Jun 2013 16:34:38 +1000 -Subject: [PATCH] Recipe Deconstruction - -Some non API methods contributed by Asphodan to allow recipe deconstruction. - -diff --git a/src/main/java/net/minecraft/server/IRecipe.java b/src/main/java/net/minecraft/server/IRecipe.java -index f963104..ffc65a2 100644 ---- a/src/main/java/net/minecraft/server/IRecipe.java -+++ b/src/main/java/net/minecraft/server/IRecipe.java -@@ -13,4 +13,6 @@ public interface IRecipe { - ItemStack[] b(InventoryCrafting inventorycrafting); - - org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit -+ -+ java.util.List getIngredients(); // Spigot - } -diff --git a/src/main/java/net/minecraft/server/ShapedRecipes.java b/src/main/java/net/minecraft/server/ShapedRecipes.java -index 28adcdb..cac2e78 100644 ---- a/src/main/java/net/minecraft/server/ShapedRecipes.java -+++ b/src/main/java/net/minecraft/server/ShapedRecipes.java -@@ -10,7 +10,7 @@ public class ShapedRecipes implements IRecipe { - private final int width; - private final int height; - private final ItemStack[] items; -- private final ItemStack result; -+ public ItemStack result; // Spigot - private boolean e; - - public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) { -@@ -165,4 +165,11 @@ public class ShapedRecipes implements IRecipe { - public int a() { - return this.width * this.height; - } -+ -+ // Spigot start -+ public java.util.List getIngredients() -+ { -+ return java.util.Arrays.asList( items ); -+ } -+ // Spigot end - } -diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java -index 8570889..e9934f9 100644 ---- a/src/main/java/net/minecraft/server/ShapelessRecipes.java -+++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java -@@ -12,7 +12,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe; - - public class ShapelessRecipes implements IRecipe { - -- private final ItemStack result; -+ public final ItemStack result; // Spigot - private final List ingredients; - - public ShapelessRecipes(ItemStack itemstack, List list) { -@@ -90,4 +90,11 @@ public class ShapelessRecipes implements IRecipe { - public int a() { - return this.ingredients.size(); - } -+ -+ // Spigot start -+ public java.util.List getIngredients() -+ { -+ return java.util.Collections.unmodifiableList( ingredients ); -+ } -+ // Spigot end - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0023-Implement-Arrow-API.patch b/CraftBukkit-Patches/0023-Implement-Arrow-API.patch deleted file mode 100644 index 8082a5c669..0000000000 --- a/CraftBukkit-Patches/0023-Implement-Arrow-API.patch +++ /dev/null @@ -1,31 +0,0 @@ -From d468b6a997fe3765682774a037d9fe7208e77647 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 2 Jun 2013 15:16:05 +1000 -Subject: [PATCH] Implement Arrow API - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java -index bf48e6e..2a3482c 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java -@@ -75,6 +75,17 @@ public class CraftArrow extends AbstractProjectile implements Arrow { - // Spigot start - private final Arrow.Spigot spigot = new Arrow.Spigot() - { -+ @Override -+ public double getDamage() -+ { -+ return getHandle().k(); -+ } -+ -+ @Override -+ public void setDamage(double damage) -+ { -+ getHandle().c( damage ); -+ } - }; - - public Arrow.Spigot spigot() --- -2.5.0 - diff --git a/CraftBukkit-Patches/0024-Hopper-Customisations.patch b/CraftBukkit-Patches/0024-Hopper-Customisations.patch deleted file mode 100644 index 6aa09ea4fc..0000000000 --- a/CraftBukkit-Patches/0024-Hopper-Customisations.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 6b0ebbee8cf70d21d0eb858d3fb1728ac1ae46f4 Mon Sep 17 00:00:00 2001 -From: erocs -Date: Sun, 8 Sep 2013 12:06:15 -0700 -Subject: [PATCH] Hopper Customisations - -Allows editing hopper cooldowns and amount transferred per tick. - -diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index 7b00f6a..c01acb9 100644 ---- a/src/main/java/net/minecraft/server/TileEntityHopper.java -+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -174,12 +174,11 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - } - - if (flag) { -- this.setCooldown(8); -+ this.setCooldown(world.spigotConfig.hopperTransfer); // Spigot - this.update(); - return true; - } - } -- - return false; - } else { - return false; -@@ -233,7 +232,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - // ItemStack itemstack1 = addItem(iinventory, this.splitStack(i, 1), enumdirection); - - // CraftBukkit start - Call event when pushing items into other inventories -- CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, 1)); -+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, world.spigotConfig.hopperAmount)); // Spigot - - Inventory destinationInventory; - // Have to special case large chests as they work oddly -@@ -247,9 +246,10 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - this.getWorld().getServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { - this.setItem(i, itemstack); -- this.setCooldown(8); // Delay hopper checks -+ this.setCooldown(world.spigotConfig.hopperTransfer); // Spigot - return false; - } -+ int origCount = event.getItem().getAmount(); // Spigot - ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection); - - if (itemstack1 == null || itemstack1.count == 0) { -@@ -261,7 +261,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - // CraftBukkit end - return true; - } -- -+ itemstack.count -= origCount - itemstack1.count; // Spigot - this.setItem(i, itemstack); - } - } -@@ -371,7 +371,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - ItemStack itemstack1 = itemstack.cloneItemStack(); - // ItemStack itemstack2 = addItem(ihopper, iinventory.splitStack(i, 1), (EnumDirection) null); - // CraftBukkit start - Call event on collection of items from inventories into the hopper -- CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, 1)); -+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, ihopper.getWorld().spigotConfig.hopperAmount)); // Spigot - - Inventory sourceInventory; - // Have to special case large chests as they work oddly -@@ -388,13 +388,13 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - iinventory.setItem(i, itemstack1); - - if (ihopper instanceof TileEntityHopper) { -- ((TileEntityHopper) ihopper).setCooldown(8); // Delay hopper checks -+ ((TileEntityHopper) ihopper).setCooldown(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot - } else if (ihopper instanceof EntityMinecartHopper) { -- ((EntityMinecartHopper) ihopper).setCooldown(4); // Delay hopper minecart checks -+ ((EntityMinecartHopper) ihopper).setCooldown(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot - } -- - return false; - } -+ int origCount = event.getItem().getAmount(); // Spigot - ItemStack itemstack2 = addItem(ihopper, CraftItemStack.asNMSCopy(event.getItem()), null); - - if (itemstack2 == null || itemstack2.count == 0) { -@@ -406,6 +406,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - // CraftBukkit end - return true; - } -+ itemstack1.count -= origCount - itemstack2.count; // Spigot - - iinventory.setItem(i, itemstack1); - } -@@ -495,7 +496,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - TileEntityHopper tileentityhopper = (TileEntityHopper) iinventory; - - if (tileentityhopper.p()) { -- tileentityhopper.setCooldown(8); -+ tileentityhopper.setCooldown(tileentityhopper.world.spigotConfig.hopperTransfer); // Spigot - } - - iinventory.update(); -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 1369657..4de0a98 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -162,4 +162,19 @@ public class SpigotWorldConfig - otherTrackingRange = getInt( "entity-tracking-range.other", otherTrackingRange ); - log( "Entity Tracking Range: Pl " + playerTrackingRange + " / An " + animalTrackingRange + " / Mo " + monsterTrackingRange + " / Mi " + miscTrackingRange + " / Other " + otherTrackingRange ); - } -+ -+ public int hopperTransfer; -+ public int hopperCheck; -+ public int hopperAmount; -+ private void hoppers() -+ { -+ // Set the tick delay between hopper item movements -+ hopperTransfer = getInt( "ticks-per.hopper-transfer", 8 ); -+ // Set the tick delay between checking for items after the associated -+ // container is empty. Default to the hopperTransfer value to prevent -+ // hopper sorting machines from becoming out of sync. -+ hopperCheck = getInt( "ticks-per.hopper-check", hopperTransfer ); -+ hopperAmount = getInt( "hopper-amount", 1 ); -+ log( "Hopper Transfer: " + hopperTransfer + " Hopper Check: " + hopperCheck + " Hopper Amount: " + hopperAmount ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0025-Firework-Meta-Crash-Fix.patch b/CraftBukkit-Patches/0025-Firework-Meta-Crash-Fix.patch deleted file mode 100644 index 594b761b2e..0000000000 --- a/CraftBukkit-Patches/0025-Firework-Meta-Crash-Fix.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 12c21abb5f5c7728ff6312b73ca738cf2910085a Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 15 Jun 2013 21:34:48 +1000 -Subject: [PATCH] Firework Meta Crash Fix - - -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java -index 0f7da6b..5a409ae 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java -@@ -145,7 +145,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { - case BURST: - return 4; - default: -- throw new AssertionError(type); -+ throw new IllegalStateException(type.toString()); // Spigot - } - } - -@@ -162,7 +162,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { - case 4: - return Type.BURST; - default: -- throw new AssertionError(nbt); -+ throw new IllegalStateException(Integer.toString(nbt)); // Spigot - } - } - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0026-Allow-Disabling-of-Command-Logging.patch b/CraftBukkit-Patches/0026-Allow-Disabling-of-Command-Logging.patch deleted file mode 100644 index 0f7f8a9cf0..0000000000 --- a/CraftBukkit-Patches/0026-Allow-Disabling-of-Command-Logging.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 2467f472fd780075961558c3f14cd3cde2f51dcb Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 21 Jun 2013 18:01:29 +1000 -Subject: [PATCH] Allow Disabling of Command Logging - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 76cbb21..7d98d67 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1284,6 +1284,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - private void handleCommand(String s) { - org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot - // CraftBukkit start - whole method -+ if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot - this.LOGGER.info(this.player.getName() + " issued server command: " + s); - - CraftPlayer player = this.getPlayer(); -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index dcca493..3999f5b 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -149,4 +149,10 @@ public class SpigotConfig - config.addDefault( path, def ); - return config.getDouble( path, config.getDouble( path ) ); - } -+ -+ public static boolean logCommands; -+ private static void logCommands() -+ { -+ logCommands = getBoolean( "commands.log", true ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0027-Allow-Disabling-of-Command-TabComplete.patch b/CraftBukkit-Patches/0027-Allow-Disabling-of-Command-TabComplete.patch deleted file mode 100644 index fddf482e99..0000000000 --- a/CraftBukkit-Patches/0027-Allow-Disabling-of-Command-TabComplete.patch +++ /dev/null @@ -1,53 +0,0 @@ -From b4675b950f4c405e96367011a77fb16fda3cd5aa Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 21 Jun 2013 18:05:54 +1000 -Subject: [PATCH] Allow Disabling of Command TabComplete - - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f906f60..fa21527 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1572,6 +1572,13 @@ public final class CraftServer implements Server { - } - - public List tabCompleteCommand(Player player, String message) { -+ // Spigot Start -+ if ( (org.spigotmc.SpigotConfig.tabComplete < 0 || message.length() <= org.spigotmc.SpigotConfig.tabComplete) && !message.contains( " " ) ) -+ { -+ return ImmutableList.of(); -+ } -+ // Spigot End -+ - List completions = null; - try { - completions = getCommandMap().tabComplete(player, message.substring(1)); -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 3999f5b..ca001e9 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -155,4 +155,21 @@ public class SpigotConfig - { - logCommands = getBoolean( "commands.log", true ); - } -+ -+ public static int tabComplete; -+ private static void tabComplete() -+ { -+ if ( version < 6 ) -+ { -+ boolean oldValue = getBoolean( "commands.tab-complete", true ); -+ if ( oldValue ) -+ { -+ set( "commands.tab-complete", 0 ); -+ } else -+ { -+ set( "commands.tab-complete", -1 ); -+ } -+ } -+ tabComplete = getInt( "commands.tab-complete", 0 ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0028-Configurable-Messages.patch b/CraftBukkit-Patches/0028-Configurable-Messages.patch deleted file mode 100644 index c2eb945071..0000000000 --- a/CraftBukkit-Patches/0028-Configurable-Messages.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 0988b9fd0a9e454f00ff512887f0030433d98cc9 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 21 Jun 2013 19:21:58 +1000 -Subject: [PATCH] Configurable Messages - - -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 37c13c5..ee987b9 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -62,11 +62,11 @@ public class HandshakeListener implements PacketHandshakingInListener { - // CraftBukkit end - - if (packethandshakinginsetprotocol.b() > 107) { -- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.9"); -+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), "1.9" ) ); // Spigot - this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext)); - this.b.close(chatcomponenttext); - } else if (packethandshakinginsetprotocol.b() < 107) { -- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.9"); -+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), "1.9" ) ); // Spigot - this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext)); - this.b.close(chatcomponenttext); - } else { -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 2095242..b21a5b7 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -466,7 +466,7 @@ public abstract class PlayerList { - event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s); - } else if (!this.isWhitelisted(gameprofile)) { - // return "You are not white-listed on this server!"; -- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!"); -+ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot - } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) { - IpBanEntry ipbanentry = this.l.get(socketaddress); - -@@ -480,7 +480,7 @@ public abstract class PlayerList { - } else { - // return this.players.size() >= this.maxPlayers && !this.f(gameprofile) ? "The server is full!" : null; - if (this.players.size() >= this.maxPlayers && !this.f(gameprofile)) { -- event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full"); -+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot - } - } - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index fa21527..7cdba38 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -627,11 +627,7 @@ public final class CraftServer implements Server { - return true; - } - -- if (sender instanceof Player) { -- sender.sendMessage("Unknown command. Type \"/help\" for help."); -- } else { -- sender.sendMessage("Unknown command. Type \"help\" for help."); -- } -+ sender.sendMessage(org.spigotmc.SpigotConfig.unknownCommandMessage); - - return false; - } -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index ca001e9..3726ea5 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -12,6 +12,7 @@ import java.util.Map; - import java.util.logging.Level; - import net.minecraft.server.MinecraftServer; - import org.bukkit.Bukkit; -+import org.bukkit.ChatColor; - import org.bukkit.command.Command; - import org.bukkit.configuration.InvalidConfigurationException; - import org.bukkit.configuration.file.YamlConfiguration; -@@ -172,4 +173,28 @@ public class SpigotConfig - } - tabComplete = getInt( "commands.tab-complete", 0 ); - } -+ -+ public static String whitelistMessage; -+ public static String unknownCommandMessage; -+ public static String serverFullMessage; -+ public static String outdatedClientMessage = "Outdated client! Please use {0}"; -+ public static String outdatedServerMessage = "Outdated server! I\'m still on {0}"; -+ private static String transform(String s) -+ { -+ return ChatColor.translateAlternateColorCodes( '&', s ).replaceAll( "\\n", "\n" ); -+ } -+ private static void messages() -+ { -+ if (version < 8) -+ { -+ set( "messages.outdated-client", outdatedClientMessage ); -+ set( "messages.outdated-server", outdatedServerMessage ); -+ } -+ -+ whitelistMessage = transform( getString( "messages.whitelist", "You are not whitelisted on this server!" ) ); -+ unknownCommandMessage = transform( getString( "messages.unknown-command", "Unknown command. Type \"/help\" for help." ) ); -+ serverFullMessage = transform( getString( "messages.server-full", "The server is full!" ) ); -+ outdatedClientMessage = transform( getString( "messages.outdated-client", outdatedClientMessage ) ); -+ outdatedServerMessage = transform( getString( "messages.outdated-server", outdatedServerMessage ) ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0029-Allow-Disabling-of-Random-Lighting-Updates.patch b/CraftBukkit-Patches/0029-Allow-Disabling-of-Random-Lighting-Updates.patch deleted file mode 100644 index 9d2f82ccd6..0000000000 --- a/CraftBukkit-Patches/0029-Allow-Disabling-of-Random-Lighting-Updates.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 71cd35a1527593f3c82c7461ce9552af19e3018a Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 22 Jun 2013 16:12:02 +1000 -Subject: [PATCH] Allow Disabling of Random Lighting Updates - - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index e4725b0..20b945c 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -967,7 +967,7 @@ public class Chunk { - } - - this.q = true; -- if (!this.lit && this.done) { -+ if (!this.lit && this.done && this.world.spigotConfig.randomLightUpdates) { // Spigot - also use random light updates setting to determine if we should relight - this.o(); - } - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index ca04f24..ffbb05d 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -374,7 +374,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { - - protected void i() { - this.methodProfiler.a("playerCheckLight"); -- if (!this.players.isEmpty()) { -+ if (spigotConfig.randomLightUpdates && !this.players.isEmpty()) { // Spigot - int i = this.random.nextInt(this.players.size()); - EntityHuman entityhuman = (EntityHuman) this.players.get(i); - int j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5; -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 4de0a98..c2452d6 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -177,4 +177,11 @@ public class SpigotWorldConfig - hopperAmount = getInt( "hopper-amount", 1 ); - log( "Hopper Transfer: " + hopperTransfer + " Hopper Check: " + hopperCheck + " Hopper Amount: " + hopperAmount ); - } -+ -+ public boolean randomLightUpdates; -+ private void lightUpdates() -+ { -+ randomLightUpdates = getBoolean( "random-light-updates", false ); -+ log( "Random Lighting Updates: " + randomLightUpdates ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0030-Properly-Close-Inventories.patch b/CraftBukkit-Patches/0030-Properly-Close-Inventories.patch deleted file mode 100644 index 609e9a259b..0000000000 --- a/CraftBukkit-Patches/0030-Properly-Close-Inventories.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 2dd0071691dbc596290019977fa9665463e7870b Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 27 Jun 2013 17:26:09 +1000 -Subject: [PATCH] Properly Close Inventories - -Properly close inventories when unloading and switching worlds. - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 20b945c..f68abb4 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -761,6 +761,18 @@ public class Chunk { - - while (iterator.hasNext()) { - TileEntity tileentity = (TileEntity) iterator.next(); -+ // Spigot Start -+ if ( tileentity instanceof IInventory ) -+ { -+ for ( org.bukkit.entity.HumanEntity h : Lists.newArrayList((List) ( (IInventory) tileentity ).getViewers() ) ) -+ { -+ if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity ) -+ { -+ ( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory(); -+ } -+ } -+ } -+ // Spigot End - - this.world.b(tileentity); - } -@@ -771,6 +783,18 @@ public class Chunk { - java.util.Iterator iter = newList.iterator(); - while (iter.hasNext()) { - Entity entity = iter.next(); -+ // Spigot Start -+ if ( entity instanceof IInventory ) -+ { -+ for ( org.bukkit.entity.HumanEntity h : Lists.newArrayList( (List) ( (IInventory) entity ).getViewers() ) ) -+ { -+ if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity ) -+ { -+ ( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory(); -+ } -+ } -+ } -+ // Spigot End - - // Do not pass along players, as doing so can get them stuck outside of time. - // (which for example disables inventory icon updates and prevents block breaking) --- -2.5.0 - diff --git a/CraftBukkit-Patches/0031-Disallow-Interaction-With-Self.patch b/CraftBukkit-Patches/0031-Disallow-Interaction-With-Self.patch deleted file mode 100644 index d829130854..0000000000 --- a/CraftBukkit-Patches/0031-Disallow-Interaction-With-Self.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 4a1495e9ec2458f8e2d62580d5fdc501fa00226f Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 28 Jun 2013 19:52:54 +1000 -Subject: [PATCH] Disallow Interaction With Self - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 7d98d67..61bde4e 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1445,6 +1445,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - if (this.player.dead) return; // CraftBukkit - WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); - Entity entity = packetplayinuseentity.a((World) worldserver); -+ // Spigot Start -+ if ( entity == player && !player.isSpectator() ) -+ { -+ disconnect( "Cannot interact with self!" ); -+ return; -+ } -+ // Spigot End - - this.player.resetIdleTimer(); - if (entity != null) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0032-Entity-Mount-and-Dismount-Events.patch b/CraftBukkit-Patches/0032-Entity-Mount-and-Dismount-Events.patch deleted file mode 100644 index 682045e88c..0000000000 --- a/CraftBukkit-Patches/0032-Entity-Mount-and-Dismount-Events.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 10154dcc951a95851fbbcf02976a9fc6eca2643b Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 27 Feb 2016 10:07:58 +1100 -Subject: [PATCH] Entity Mount and Dismount Events - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 280ceb8..1104a04 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1681,6 +1681,13 @@ public abstract class Entity implements ICommandListener { - } - } - // CraftBukkit end -+ // Spigot start -+ org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent(entity.getBukkitEntity(), this.getBukkitEntity()); -+ Bukkit.getPluginManager().callEvent(event); -+ if (event.isCancelled()) { -+ return; -+ } -+ // Spigot end - if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bt() instanceof EntityHuman)) { - this.passengers.add(0, entity); - } else { -@@ -1710,6 +1717,7 @@ public abstract class Entity implements ICommandListener { - } - } - // CraftBukkit end -+ Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity())); // Spigot - this.passengers.remove(entity); - entity.j = 60; - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0033-Prevent-Ghost-Players-Caused-by-Plugins.patch b/CraftBukkit-Patches/0033-Prevent-Ghost-Players-Caused-by-Plugins.patch deleted file mode 100644 index 0ccc18f5bd..0000000000 --- a/CraftBukkit-Patches/0033-Prevent-Ghost-Players-Caused-by-Plugins.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 01836118052d7480962601f48cb275e7e512f223 Mon Sep 17 00:00:00 2001 -From: Alex Ciuba -Date: Tue, 11 Jun 2013 15:23:03 -0400 -Subject: [PATCH] Prevent Ghost Players Caused by Plugins - -Check if the player is still connected after firing event. Fixes BUKKIT-4327 - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index e10e80d..0f56aee 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -606,6 +606,11 @@ public abstract class PlayerList { - Player respawnPlayer = cserver.getPlayer(entityplayer1); - PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn); - cserver.getPluginManager().callEvent(respawnEvent); -+ // Spigot Start -+ if (entityplayer.playerConnection.isDisconnected()) { -+ return entityplayer; -+ } -+ // Spigot End - - location = respawnEvent.getRespawnLocation(); - entityplayer.reset(); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0034-Plug-World-Unload-Memory-Leak.patch b/CraftBukkit-Patches/0034-Plug-World-Unload-Memory-Leak.patch deleted file mode 100644 index 7e52231029..0000000000 --- a/CraftBukkit-Patches/0034-Plug-World-Unload-Memory-Leak.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 63ae188a51ad00dc2f9530ae65fa062e1332271e Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 3 Aug 2013 19:02:59 +1000 -Subject: [PATCH] Plug World Unload Memory Leak - - -diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java -index c6c0ab2..b4d1741 100644 ---- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java -+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java -@@ -10,7 +10,7 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit - - public class BlockRedstoneTorch extends BlockTorch { - -- private static Map> g = Maps.newHashMap(); -+ private static Map> g = new java.util.WeakHashMap(); // Spigot - private final boolean isOn; - - private boolean a(World world, BlockPosition blockposition, boolean flag) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0035-Player-Collision-API.patch b/CraftBukkit-Patches/0035-Player-Collision-API.patch deleted file mode 100644 index 942ad80925..0000000000 --- a/CraftBukkit-Patches/0035-Player-Collision-API.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 5cb4c77361fa3df82d795a16680348b0b7a0b10d Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 3 Aug 2013 19:27:07 +1000 -Subject: [PATCH] Player Collision API - - -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 74bf367..45c4ef3 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -377,6 +377,7 @@ public abstract class EntityHuman extends EntityLiving { - - List list = this.world.getEntities(this, axisalignedbb); - -+ if (this.isCollidable()) { // Spigot: Add isCollidable() condition (second !this.isDead near bottom of EntityLiving) - for (int i = 0; i < list.size(); ++i) { - Entity entity = (Entity) list.get(i); - -@@ -384,6 +385,7 @@ public abstract class EntityHuman extends EntityLiving { - this.c(entity); - } - } -+ } // Spigot - } - - } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 6fabefa..0cf1b90 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1974,7 +1974,7 @@ public abstract class EntityLiving extends Entity { - protected void cn() { - List list = this.world.a((Entity) this, this.getBoundingBox(), IEntitySelector.a(this)); - -- if (!list.isEmpty()) { -+ if (this.isInteractable() && !list.isEmpty()) { // Spigot: Add isInteractable() condition - for (int i = 0; i < list.size(); ++i) { - Entity entity = (Entity) list.get(i); - // TODO better check now? -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 4e34d45..688b359 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -65,6 +65,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - public double maxHealthCache; - public boolean joining = true; - // CraftBukkit end -+ // Spigot start -+ public boolean collidesWithEntities = true; -+ -+ @Override -+ public boolean isInteractable() -+ { -+ return this.collidesWithEntities && super.isInteractable(); // (first !this.isDead near bottom of EntityLiving) -+ } -+ -+ @Override -+ public boolean isCollidable() -+ { -+ return this.collidesWithEntities && super.isCollidable(); // (second !this.isDead near bottom of EntityLiving) -+ } -+ // Spigot end - - public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super(worldserver, gameprofile); -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e93cedb..cdabd78 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1407,6 +1407,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - // Spigot start - private final Player.Spigot spigot = new Player.Spigot() - { -+ -+ @Override -+ public boolean getCollidesWithEntities() -+ { -+ return getHandle().collidesWithEntities; -+ } -+ -+ @Override -+ public void setCollidesWithEntities(boolean collides) -+ { -+ getHandle().collidesWithEntities = collides; -+ getHandle().i = collides; // First boolean of Entity -+ } - }; - - public Player.Spigot spigot() --- -2.5.0 - diff --git a/CraftBukkit-Patches/0036-Fully-Disable-Snooper-When-Not-Required.patch b/CraftBukkit-Patches/0036-Fully-Disable-Snooper-When-Not-Required.patch deleted file mode 100644 index 4826e7c9a0..0000000000 --- a/CraftBukkit-Patches/0036-Fully-Disable-Snooper-When-Not-Required.patch +++ /dev/null @@ -1,27 +0,0 @@ -From fb58dd6254e350724b17e19abd41c951c684fb41 Mon Sep 17 00:00:00 2001 -From: agentk20 -Date: Sat, 3 Aug 2013 19:28:48 +1000 -Subject: [PATCH] Fully Disable Snooper When Not Required - - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d754d0d..28c3a72 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -662,11 +662,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - this.h[this.ticks % 100] = System.nanoTime() - i; - this.methodProfiler.b(); - this.methodProfiler.a("snooper"); -- if (!this.m.d() && this.ticks > 100) { -+ if (getSnooperEnabled() && !this.m.d() && this.ticks > 100) { // Spigot - this.m.a(); - } - -- if (this.ticks % 6000 == 0) { -+ if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot - this.m.b(); - } - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0037-Add-Getter-for-Entity-Invulnerability.patch b/CraftBukkit-Patches/0037-Add-Getter-for-Entity-Invulnerability.patch deleted file mode 100644 index 7ba2de14f3..0000000000 --- a/CraftBukkit-Patches/0037-Add-Getter-for-Entity-Invulnerability.patch +++ /dev/null @@ -1,25 +0,0 @@ -From acfe9bfa8054fcc76549ec2c963fdf7ccdfbea77 Mon Sep 17 00:00:00 2001 -From: DerFlash -Date: Sat, 3 Aug 2013 19:53:48 +1000 -Subject: [PATCH] Add Getter for Entity Invulnerability - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index cc88297..0fc57de 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -567,6 +567,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { - // Spigot start - private final Spigot spigot = new Spigot() - { -+ @Override -+ public boolean isInvulnerable() -+ { -+ return getHandle().isInvulnerable(net.minecraft.server.DamageSource.GENERIC); -+ } - }; - - public Spigot spigot() --- -2.5.0 - diff --git a/CraftBukkit-Patches/0038-Cap-Minimum-Player-Speed.patch b/CraftBukkit-Patches/0038-Cap-Minimum-Player-Speed.patch deleted file mode 100644 index 40d466feaf..0000000000 --- a/CraftBukkit-Patches/0038-Cap-Minimum-Player-Speed.patch +++ /dev/null @@ -1,31 +0,0 @@ -From b07dbc551cf636d98d6d7d99a0fa371f57b614ef Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 5 Aug 2013 20:17:20 +1000 -Subject: [PATCH] Cap Minimum Player Speed - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index eea3951..f7e6c07 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1175,7 +1175,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - public void setFlySpeed(float value) { - validateSpeed(value); - EntityPlayer player = getHandle(); -- player.abilities.flySpeed = value / 2f; -+ player.abilities.flySpeed = Math.max( value, 0.0001f ) / 2f; // Spigot - player.updateAbilities(); - - } -@@ -1184,7 +1184,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - public void setWalkSpeed(float value) { - validateSpeed(value); - EntityPlayer player = getHandle(); -- player.abilities.walkSpeed = value / 2f; -+ player.abilities.walkSpeed = Math.max( value, 0.0001f ) / 2f; // Spigot - player.updateAbilities(); - } - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0039-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch b/CraftBukkit-Patches/0039-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch deleted file mode 100644 index 9b8394bc01..0000000000 --- a/CraftBukkit-Patches/0039-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From c345c700f58a271f1638e3a683c8c28c287be1f4 Mon Sep 17 00:00:00 2001 -From: BlackHole -Date: Tue, 16 Jul 2013 22:34:50 +0200 -Subject: [PATCH] Call EntityChangeBlockEvent for Fire Arrows hitting TNT - -Adds BUKKIT-4355 - -diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java -index 54140f7..f794167 100644 ---- a/src/main/java/net/minecraft/server/BlockTNT.java -+++ b/src/main/java/net/minecraft/server/BlockTNT.java -@@ -73,6 +73,11 @@ public class BlockTNT extends Block { - EntityArrow entityarrow = (EntityArrow) entity; - - if (entityarrow.isBurning()) { -+ // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityarrow, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) { -+ return; -+ } -+ // CraftBukkit end - this.a(world, blockposition, world.getType(blockposition).set(BlockTNT.EXPLODE, Boolean.valueOf(true)), entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null); - world.setAir(blockposition); - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0040-Allow-Disabling-of-1.6.3-Structure-Saving.patch b/CraftBukkit-Patches/0040-Allow-Disabling-of-1.6.3-Structure-Saving.patch deleted file mode 100644 index 5fe115dc22..0000000000 --- a/CraftBukkit-Patches/0040-Allow-Disabling-of-1.6.3-Structure-Saving.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 338d1a0473ae949f6236f6eee08a016391f8d976 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 21 Sep 2013 12:33:09 +1000 -Subject: [PATCH] Allow Disabling of 1.6.3 Structure Saving - - -diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index dacba33..4a4d2af 100644 ---- a/src/main/java/net/minecraft/server/StructureGenerator.java -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -197,7 +197,13 @@ public abstract class StructureGenerator extends WorldGenBase { - - protected void a(World world) { - if (this.a == null) { -- this.a = (PersistentStructure) world.a(PersistentStructure.class, this.a()); -+ // Spigot Start -+ if (world.spigotConfig.saveStructureInfo) { -+ this.a = (PersistentStructure) world.a(PersistentStructure.class, this.a()); -+ } else { -+ this.a = new PersistentStructure(this.a()); -+ } -+ // Spigot End - if (this.a == null) { - this.a = new PersistentStructure(this.a()); - world.a(this.a(), (PersistentBase) this.a); -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index c2452d6..89f9bc3 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -184,4 +184,16 @@ public class SpigotWorldConfig - randomLightUpdates = getBoolean( "random-light-updates", false ); - log( "Random Lighting Updates: " + randomLightUpdates ); - } -+ -+ public boolean saveStructureInfo; -+ private void structureInfo() -+ { -+ saveStructureInfo = getBoolean( "save-structure-info", true ); -+ log( "Structure Info Saving: " + saveStructureInfo ); -+ if ( !saveStructureInfo ) -+ { -+ log( "*** WARNING *** You have selected to NOT save structure info. This may cause structures such as fortresses to not spawn mobs!" ); -+ log( "*** WARNING *** Please use this option with caution, SpigotMC is not responsible for any issues this option may cause in the future!" ); -+ } -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0041-Don-t-Special-Case-X-Move-Value.patch b/CraftBukkit-Patches/0041-Don-t-Special-Case-X-Move-Value.patch deleted file mode 100644 index 837b565ba9..0000000000 --- a/CraftBukkit-Patches/0041-Don-t-Special-Case-X-Move-Value.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 5a0bea3e4562f09095e7b46f6787aa903f52d3a6 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 6 Oct 2013 17:36:28 +1100 -Subject: [PATCH] Don't Special Case X Move Value - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 61bde4e..24c2a88 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -126,6 +126,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - private float lastPitch = Float.MAX_VALUE; - private float lastYaw = Float.MAX_VALUE; - private boolean justTeleported = false; -+ private boolean hasMoved; // Spigot - - public CraftPlayer getPlayer() { - return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity(); -@@ -353,6 +354,18 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - - // CraftBukkit start - fire PlayerMoveEvent - Player player = this.getPlayer(); -+ // Spigot Start -+ if ( !hasMoved ) -+ { -+ Location curPos = player.getLocation(); -+ lastPosX = curPos.getX(); -+ lastPosY = curPos.getY(); -+ lastPosZ = curPos.getZ(); -+ lastYaw = curPos.getYaw(); -+ lastPitch = curPos.getPitch(); -+ hasMoved = true; -+ } -+ // Spigot End - Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. - Location to = player.getLocation().clone(); // Start off the To location as the Players current location. - -@@ -378,7 +391,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - this.lastPitch = to.getPitch(); - - // Skip the first time we do this -- if (from.getX() != Double.MAX_VALUE) { -+ if (true) { // Spigot - don't skip any move events - Location oldTo = to.clone(); - PlayerMoveEvent event = new PlayerMoveEvent(player, from, to); - this.server.getPluginManager().callEvent(event); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0042-Implement-respawn-API.patch b/CraftBukkit-Patches/0042-Implement-respawn-API.patch deleted file mode 100644 index 2a34927e6f..0000000000 --- a/CraftBukkit-Patches/0042-Implement-respawn-API.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ece598b449d1a8fe3073de1e90068246dd1cbf75 Mon Sep 17 00:00:00 2001 -From: ninja- -Date: Tue, 8 Oct 2013 14:34:49 +0200 -Subject: [PATCH] Implement respawn API. - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f7e6c07..d245755 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1420,6 +1420,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - getHandle().collidesWithEntities = collides; - getHandle().i = collides; // First boolean of Entity - } -+ -+ @Override -+ public void respawn() -+ { -+ if ( getHealth() <= 0 && isOnline() ) -+ { -+ server.getServer().getPlayerList().moveToWorld( getHandle(), 0, false ); -+ } -+ } - }; - - public Player.Spigot spigot() --- -2.5.0 - diff --git a/CraftBukkit-Patches/0043-Arrow-Despawn-Rate.patch b/CraftBukkit-Patches/0043-Arrow-Despawn-Rate.patch deleted file mode 100644 index 3fb532d4ff..0000000000 --- a/CraftBukkit-Patches/0043-Arrow-Despawn-Rate.patch +++ /dev/null @@ -1,38 +0,0 @@ -From a812d6abf9d591b6f9681f6e31af6bd8e176bafb Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 14 Oct 2013 19:20:10 +1100 -Subject: [PATCH] Arrow Despawn Rate - - -diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index a40f3ec..e40642f 100644 ---- a/src/main/java/net/minecraft/server/EntityArrow.java -+++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -144,7 +144,7 @@ public abstract class EntityArrow extends Entity implements IProjectile { - - if (block == this.au && i == this.av) { - ++this.aw; -- if (this.aw >= 1200) { -+ if (this.aw >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter - this.die(); - } - } else { -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 89f9bc3..28643c5 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -196,4 +196,11 @@ public class SpigotWorldConfig - log( "*** WARNING *** Please use this option with caution, SpigotMC is not responsible for any issues this option may cause in the future!" ); - } - } -+ -+ public int arrowDespawnRate; -+ private void arrowDespawnRate() -+ { -+ arrowDespawnRate = getInt( "arrow-despawn-rate", 1200 ); -+ log( "Arrow Despawn Rate: " + arrowDespawnRate ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0044-Watchdog-Thread.patch b/CraftBukkit-Patches/0044-Watchdog-Thread.patch deleted file mode 100644 index a5e20c3a81..0000000000 --- a/CraftBukkit-Patches/0044-Watchdog-Thread.patch +++ /dev/null @@ -1,334 +0,0 @@ -From 4301af27dac931f8831bf87c1c285c0b7237a5d3 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 5 Aug 2014 17:20:19 +0100 -Subject: [PATCH] Watchdog Thread. - - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 1361b06..e5c0ed9 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -276,7 +276,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - } - // CraftBukkit end - -- if (this.aP() > 0L) { -+ if (false && this.aP() > 0L) { // Spigot - disable - Thread thread1 = new Thread(new ThreadWatchdog(this)); - - thread1.setName("Server Watchdog"); -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 28c3a72..bc9ac2b 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -568,6 +568,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - this.a(crashreport); - } finally { - try { -+ org.spigotmc.WatchdogThread.doStop(); - this.isStopped = true; - this.stop(); - } catch (Throwable throwable1) { -@@ -672,6 +673,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - - this.methodProfiler.b(); - this.methodProfiler.b(); -+ org.spigotmc.WatchdogThread.tick(); // Spigot - SpigotTimings.serverTickTimer.stopTiming(); // Spigot - org.spigotmc.CustomTimingsHandler.tick(); // Spigot - } -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7cdba38..72e1e2f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1696,6 +1696,11 @@ public final class CraftServer implements Server { - { - return org.spigotmc.SpigotConfig.config; - } -+ -+ @Override -+ public void restart() { -+ org.spigotmc.RestartCommand.restart(); -+ } - }; - - public Spigot spigot() -diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java -new file mode 100644 -index 0000000..429c258 ---- /dev/null -+++ b/src/main/java/org/spigotmc/RestartCommand.java -@@ -0,0 +1,124 @@ -+package org.spigotmc; -+ -+import java.io.File; -+import java.util.List; -+import net.minecraft.server.EntityPlayer; -+import net.minecraft.server.MinecraftServer; -+import org.bukkit.command.Command; -+import org.bukkit.command.CommandSender; -+ -+public class RestartCommand extends Command -+{ -+ -+ public RestartCommand(String name) -+ { -+ super( name ); -+ this.description = "Restarts the server"; -+ this.usageMessage = "/restart"; -+ this.setPermission( "bukkit.command.restart" ); -+ } -+ -+ @Override -+ public boolean execute(CommandSender sender, String currentAlias, String[] args) -+ { -+ if ( testPermission( sender ) ) -+ { -+ MinecraftServer.getServer().processQueue.add( new Runnable() -+ { -+ @Override -+ public void run() -+ { -+ restart(); -+ } -+ } ); -+ } -+ return true; -+ } -+ -+ public static void restart() -+ { -+ restart( new File( SpigotConfig.restartScript ) ); -+ } -+ -+ public static void restart(final File script) -+ { -+ AsyncCatcher.enabled = false; // Disable async catcher incase it interferes with us -+ try -+ { -+ if ( script.isFile() ) -+ { -+ System.out.println( "Attempting to restart with " + SpigotConfig.restartScript ); -+ -+ // Disable Watchdog -+ WatchdogThread.doStop(); -+ -+ // Kick all players -+ for ( EntityPlayer p : (List< EntityPlayer>) MinecraftServer.getServer().getPlayerList().players ) -+ { -+ p.playerConnection.disconnect(SpigotConfig.restartMessage); -+ } -+ // Give the socket a chance to send the packets -+ try -+ { -+ Thread.sleep( 100 ); -+ } catch ( InterruptedException ex ) -+ { -+ } -+ // Close the socket so we can rebind with the new process -+ MinecraftServer.getServer().getServerConnection().b(); -+ -+ // Give time for it to kick in -+ try -+ { -+ Thread.sleep( 100 ); -+ } catch ( InterruptedException ex ) -+ { -+ } -+ -+ // Actually shutdown -+ try -+ { -+ MinecraftServer.getServer().stop(); -+ } catch ( Throwable t ) -+ { -+ } -+ -+ // This will be done AFTER the server has completely halted -+ Thread shutdownHook = new Thread() -+ { -+ @Override -+ public void run() -+ { -+ try -+ { -+ String os = System.getProperty( "os.name" ).toLowerCase(); -+ if ( os.contains( "win" ) ) -+ { -+ Runtime.getRuntime().exec( "cmd /c start " + script.getPath() ); -+ } else -+ { -+ Runtime.getRuntime().exec( new String[] -+ { -+ "sh", script.getPath() -+ } ); -+ } -+ } catch ( Exception e ) -+ { -+ e.printStackTrace(); -+ } -+ } -+ }; -+ -+ shutdownHook.setDaemon( true ); -+ Runtime.getRuntime().addShutdownHook( shutdownHook ); -+ } else -+ { -+ System.out.println( "Startup script '" + SpigotConfig.restartScript + "' does not exist! Stopping server." ); -+ } -+ System.exit( 0 ); -+ } catch ( Exception ex ) -+ { -+ ex.printStackTrace(); -+ } -+ } -+} -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 3726ea5..34def7b 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -197,4 +197,18 @@ public class SpigotConfig - outdatedClientMessage = transform( getString( "messages.outdated-client", outdatedClientMessage ) ); - outdatedServerMessage = transform( getString( "messages.outdated-server", outdatedServerMessage ) ); - } -+ -+ public static int timeoutTime = 60; -+ public static boolean restartOnCrash = true; -+ public static String restartScript = "./start.sh"; -+ public static String restartMessage; -+ private static void watchdog() -+ { -+ timeoutTime = getInt( "settings.timeout-time", timeoutTime ); -+ restartOnCrash = getBoolean( "settings.restart-on-crash", restartOnCrash ); -+ restartScript = getString( "settings.restart-script", restartScript ); -+ restartMessage = transform( getString( "messages.restart", "Server is restarting" ) ); -+ commands.put( "restart", new RestartCommand( "restart" ) ); -+ WatchdogThread.doStart( timeoutTime, restartOnCrash ); -+ } - } -diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -new file mode 100644 -index 0000000..de08ad6 ---- /dev/null -+++ b/src/main/java/org/spigotmc/WatchdogThread.java -@@ -0,0 +1,117 @@ -+package org.spigotmc; -+ -+import java.lang.management.ManagementFactory; -+import java.lang.management.MonitorInfo; -+import java.lang.management.ThreadInfo; -+import java.util.logging.Level; -+import java.util.logging.Logger; -+import net.minecraft.server.MinecraftServer; -+import org.bukkit.Bukkit; -+ -+public class WatchdogThread extends Thread -+{ -+ -+ private static WatchdogThread instance; -+ private final long timeoutTime; -+ private final boolean restart; -+ private volatile long lastTick; -+ private volatile boolean stopping; -+ -+ private WatchdogThread(long timeoutTime, boolean restart) -+ { -+ super( "Spigot Watchdog Thread" ); -+ this.timeoutTime = timeoutTime; -+ this.restart = restart; -+ } -+ -+ public static void doStart(int timeoutTime, boolean restart) -+ { -+ if ( instance == null ) -+ { -+ instance = new WatchdogThread( timeoutTime * 1000L, restart ); -+ instance.start(); -+ } -+ } -+ -+ public static void tick() -+ { -+ instance.lastTick = System.currentTimeMillis(); -+ } -+ -+ public static void doStop() -+ { -+ if ( instance != null ) -+ { -+ instance.stopping = true; -+ } -+ } -+ -+ @Override -+ public void run() -+ { -+ while ( !stopping ) -+ { -+ // -+ if ( lastTick != 0 && System.currentTimeMillis() > lastTick + timeoutTime ) -+ { -+ Logger log = Bukkit.getServer().getLogger(); -+ log.log( Level.SEVERE, "The server has stopped responding!" ); -+ log.log( Level.SEVERE, "Please report this to http://www.spigotmc.org/" ); -+ log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" ); -+ log.log( Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion() ); -+ // -+ log.log( Level.SEVERE, "------------------------------" ); -+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Spigot!):" ); -+ dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log ); -+ log.log( Level.SEVERE, "------------------------------" ); -+ // -+ log.log( Level.SEVERE, "Entire Thread Dump:" ); -+ ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads( true, true ); -+ for ( ThreadInfo thread : threads ) -+ { -+ dumpThread( thread, log ); -+ } -+ log.log( Level.SEVERE, "------------------------------" ); -+ -+ if ( restart ) -+ { -+ RestartCommand.restart(); -+ } -+ break; -+ } -+ -+ try -+ { -+ sleep( 10000 ); -+ } catch ( InterruptedException ex ) -+ { -+ interrupt(); -+ } -+ } -+ } -+ -+ private static void dumpThread(ThreadInfo thread, Logger log) -+ { -+ log.log( Level.SEVERE, "------------------------------" ); -+ // -+ log.log( Level.SEVERE, "Current Thread: " + thread.getThreadName() ); -+ log.log( Level.SEVERE, "\tPID: " + thread.getThreadId() -+ + " | Suspended: " + thread.isSuspended() -+ + " | Native: " + thread.isInNative() -+ + " | State: " + thread.getThreadState() ); -+ if ( thread.getLockedMonitors().length != 0 ) -+ { -+ log.log( Level.SEVERE, "\tThread is waiting on monitor(s):" ); -+ for ( MonitorInfo monitor : thread.getLockedMonitors() ) -+ { -+ log.log( Level.SEVERE, "\t\tLocked on:" + monitor.getLockedStackFrame() ); -+ } -+ } -+ log.log( Level.SEVERE, "\tStack:" ); -+ // -+ for ( StackTraceElement stack : thread.getStackTrace() ) -+ { -+ log.log( Level.SEVERE, "\t\t" + stack ); -+ } -+ } -+} --- -2.5.0 - diff --git a/CraftBukkit-Patches/0045-Fix-some-chunks-not-being-sent-to-the-client.patch b/CraftBukkit-Patches/0045-Fix-some-chunks-not-being-sent-to-the-client.patch deleted file mode 100644 index a8a5baad33..0000000000 --- a/CraftBukkit-Patches/0045-Fix-some-chunks-not-being-sent-to-the-client.patch +++ /dev/null @@ -1,30 +0,0 @@ -From a192d0fe60f91c9924690fc9a9566390b91c591c Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Mon, 2 Dec 2013 23:42:09 +0000 -Subject: [PATCH] Fix some chunks not being sent to the client - - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index f68abb4..47ef0db 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -1009,7 +1009,15 @@ public class Chunk { - } - - public boolean isReady() { -- return this.q && this.done && this.lit; -+ // Spigot Start -+ /* -+ * As of 1.7, Mojang added a check to make sure that only chunks which have been lit are sent to the client. -+ * Unfortunately this interferes with our modified chunk ticking algorithm, which will only tick chunks distant from the player on a very infrequent basis. -+ * We cannot unfortunately do this lighting stage during chunk gen as it appears to put a lot more noticeable load on the server, than when it is done at play time. -+ * For now at least we will simply send all chunks, in accordance with pre 1.7 behaviour. -+ */ -+ return true; -+ // Spigot End - } - - public boolean j() { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0046-Fix-Broken-Async-Chat.patch b/CraftBukkit-Patches/0046-Fix-Broken-Async-Chat.patch deleted file mode 100644 index e83d590d9e..0000000000 --- a/CraftBukkit-Patches/0046-Fix-Broken-Async-Chat.patch +++ /dev/null @@ -1,39 +0,0 @@ -From ae1236a4a4a148d9eb2e7be52b04eeef85ee54fc Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 5 Dec 2013 13:55:53 +1100 -Subject: [PATCH] Fix Broken Async Chat - - -diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main/java/net/minecraft/server/PacketPlayInChat.java -index 0ab90f3..18358b4 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java -@@ -24,7 +24,24 @@ public class PacketPlayInChat implements Packet { - packetdataserializer.a(this.a); - } - -- public void a(PacketListenerPlayIn packetlistenerplayin) { -+ // Spigot Start -+ private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool( -+ new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon( true ).setNameFormat( "Async Chat Thread - #%d" ).build() ); -+ public void a(final PacketListenerPlayIn packetlistenerplayin) { -+ if ( !a.startsWith("/") ) -+ { -+ executors.submit( new Runnable() -+ { -+ -+ @Override -+ public void run() -+ { -+ packetlistenerplayin.a( PacketPlayInChat.this ); -+ } -+ } ); -+ return; -+ } -+ // Spigot End - packetlistenerplayin.a(this); - } - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0047-Fire-PreLogin-Events-in-Offline-Mode.patch b/CraftBukkit-Patches/0047-Fire-PreLogin-Events-in-Offline-Mode.patch deleted file mode 100644 index 2cd652377d..0000000000 --- a/CraftBukkit-Patches/0047-Fire-PreLogin-Events-in-Offline-Mode.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 375f19d5b86d8c2498918195a67c992259ffa5f6 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 18 Dec 2013 13:32:10 +1100 -Subject: [PATCH] Fire PreLogin Events in Offline Mode - - -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 3cca9ff..71d24b2 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -13,6 +13,7 @@ import java.util.Arrays; - import java.util.Random; - import java.util.UUID; - import java.util.concurrent.atomic.AtomicInteger; -+import java.util.logging.Level; - import javax.crypto.SecretKey; - import org.apache.commons.lang3.Validate; - import org.apache.logging.log4j.LogManager; -@@ -80,10 +81,23 @@ public class LoginListener implements PacketLoginInListener, ITickable { - - } - -+ // Spigot start -+ public void initUUID() -+ { -+ UUID uuid = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + this.i.getName() ).getBytes( Charsets.UTF_8 ) ); -+ -+ this.i = new GameProfile( uuid, this.i.getName() ); -+ } -+ // Spigot end -+ - public void b() { -+ // Spigot start - Moved to initUUID -+ /* - if (!this.i.isComplete()) { - this.i = this.a(this.i); - } -+ */ -+ // Spigot end - - // CraftBukkit start - fire PlayerLoginEvent - EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, hostname); -@@ -133,7 +147,22 @@ public class LoginListener implements PacketLoginInListener, ITickable { - this.g = LoginListener.EnumProtocolState.KEY; - this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin(this.j, this.server.O().getPublic(), this.e)); - } else { -- this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; -+ // Spigot start -+ new Thread("User Authenticator #" + LoginListener.b.incrementAndGet()) { -+ -+ @Override -+ public void run() { -+ try { -+ initUUID(); -+ new LoginHandler().fireEvents(); -+ LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; -+ } catch (Exception ex) { -+ disconnect("Failed to verify username!"); -+ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex); -+ } -+ } -+ }.start(); -+ // Spigot end - } - - } -@@ -162,6 +191,39 @@ public class LoginListener implements PacketLoginInListener, ITickable { - return; - } - -+ new LoginHandler().fireEvents(); -+ } else if (LoginListener.this.server.R()) { -+ LoginListener.c.warn("Failed to verify username but will let them in anyway!"); -+ LoginListener.this.i = LoginListener.this.a(gameprofile); -+ LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; -+ } else { -+ LoginListener.this.disconnect("Failed to verify username!"); -+ LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer -+ } -+ } catch (AuthenticationUnavailableException authenticationunavailableexception) { -+ if (LoginListener.this.server.R()) { -+ LoginListener.c.warn("Authentication servers are down but will let them in anyway!"); -+ LoginListener.this.i = LoginListener.this.a(gameprofile); -+ LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; -+ } else { -+ LoginListener.this.disconnect("Authentication servers are down. Please try again later, sorry!"); -+ LoginListener.c.error("Couldn\'t verify username because servers are unavailable"); -+ } -+ // CraftBukkit start - catch all exceptions -+ } catch (Exception exception) { -+ disconnect("Failed to verify username!"); -+ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception); -+ // CraftBukkit end -+ } -+ } -+ }).start(); -+ } -+ } -+ -+ // Spigot start -+ public class LoginHandler { -+ -+ public void fireEvents() throws Exception { - String playerName = i.getName(); - java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress(); - java.util.UUID uniqueId = i.getId(); -@@ -196,34 +258,9 @@ public class LoginListener implements PacketLoginInListener, ITickable { - // CraftBukkit end - LoginListener.c.info("UUID of player " + LoginListener.this.i.getName() + " is " + LoginListener.this.i.getId()); - LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; -- } else if (LoginListener.this.server.R()) { -- LoginListener.c.warn("Failed to verify username but will let them in anyway!"); -- LoginListener.this.i = LoginListener.this.a(gameprofile); -- LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; -- } else { -- LoginListener.this.disconnect("Failed to verify username!"); -- LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer -- } -- } catch (AuthenticationUnavailableException authenticationunavailableexception) { -- if (LoginListener.this.server.R()) { -- LoginListener.c.warn("Authentication servers are down but will let them in anyway!"); -- LoginListener.this.i = LoginListener.this.a(gameprofile); -- LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; -- } else { -- LoginListener.this.disconnect("Authentication servers are down. Please try again later, sorry!"); -- LoginListener.c.error("Couldn\'t verify username because servers are unavailable"); -- } -- // CraftBukkit start - catch all exceptions -- } catch (Exception exception) { -- disconnect("Failed to verify username!"); -- server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception); -- // CraftBukkit end -- } -- - } -- }).start(); - } -- } -+ // Spigot end - - protected GameProfile a(GameProfile gameprofile) { - UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + gameprofile.getName()).getBytes(Charsets.UTF_8)); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0048-BungeeCord-Support.patch b/CraftBukkit-Patches/0048-BungeeCord-Support.patch deleted file mode 100644 index 88712116fc..0000000000 --- a/CraftBukkit-Patches/0048-BungeeCord-Support.patch +++ /dev/null @@ -1,189 +0,0 @@ -From abc10e573e1f4f0c7d755ef8d96a1e4aa1381c17 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 1 Dec 2013 18:18:41 +1100 -Subject: [PATCH] BungeeCord Support - -Provides support for IP forwarding via BungeeCord. - -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index ee987b9..ed20034 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -7,6 +7,7 @@ import java.util.HashMap; - - public class HandshakeListener implements PacketHandshakingInListener { - -+ private static final com.google.gson.Gson gson = new com.google.gson.Gson(); // Spigot - // CraftBukkit start - add fields - private static final HashMap throttleTracker = new HashMap(); - private static int throttleCounter = 0; -@@ -71,6 +72,26 @@ public class HandshakeListener implements PacketHandshakingInListener { - this.b.close(chatcomponenttext); - } else { - this.b.setPacketListener(new LoginListener(this.a, this.b)); -+ // Spigot Start -+ if (org.spigotmc.SpigotConfig.bungee) { -+ String[] split = packethandshakinginsetprotocol.hostname.split("\00"); -+ if ( split.length == 3 || split.length == 4 ) { -+ packethandshakinginsetprotocol.hostname = split[0]; -+ b.l = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort()); -+ b.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] ); -+ } else -+ { -+ chatcomponenttext = new ChatComponentText("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!"); -+ this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext)); -+ this.b.close(chatcomponenttext); -+ return; -+ } -+ if ( split.length == 4 ) -+ { -+ b.spoofedProfile = gson.fromJson(split[3], com.mojang.authlib.properties.Property[].class); -+ } -+ } -+ // Spigot End - ((LoginListener) this.b.i()).hostname = packethandshakinginsetprotocol.hostname + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname - } - break; -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 71d24b2..efa785f 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -84,9 +84,24 @@ public class LoginListener implements PacketLoginInListener, ITickable { - // Spigot start - public void initUUID() - { -- UUID uuid = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + this.i.getName() ).getBytes( Charsets.UTF_8 ) ); -+ UUID uuid; -+ if ( networkManager.spoofedUUID != null ) -+ { -+ uuid = networkManager.spoofedUUID; -+ } else -+ { -+ uuid = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + this.i.getName() ).getBytes( Charsets.UTF_8 ) ); -+ } - - this.i = new GameProfile( uuid, this.i.getName() ); -+ -+ if (networkManager.spoofedProfile != null) -+ { -+ for ( com.mojang.authlib.properties.Property property : networkManager.spoofedProfile ) -+ { -+ this.i.getProperties().put( property.getName(), property ); -+ } -+ } - } - // Spigot end - -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 5ed2c96..c3ff6c2 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -64,7 +64,11 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - private final Queue i = Queues.newConcurrentLinkedQueue(); - private final ReentrantReadWriteLock j = new ReentrantReadWriteLock(); - public Channel channel; -- private SocketAddress l; -+ // Spigot Start // PAIL -+ public SocketAddress l; -+ public java.util.UUID spoofedUUID; -+ public com.mojang.authlib.properties.Property[] spoofedProfile; -+ // Spigot End - private PacketListener m; - private IChatBaseComponent n; - private boolean o; -@@ -323,4 +327,11 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - this.b = agenericfuturelistener; - } - } -+ -+ // Spigot Start -+ public SocketAddress getRawAddress() -+ { -+ return this.channel.remoteAddress(); -+ } -+ // Spigot End - } -diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -index 86f1be7..e6ab607 100644 ---- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -+++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -@@ -13,7 +13,7 @@ public class PacketHandshakingInSetProtocol implements Packet -Date: Thu, 12 Dec 2013 18:05:03 -0600 -Subject: [PATCH] Allow Disabling Zombie Villager Aggression - -Ability to configure if Zombies will be aggressive towards Villagers. - -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index d5f508b..ba2f12f 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -46,7 +46,7 @@ public class EntityZombie extends EntityMonster { - this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false)); - this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityPigZombie.class})); - this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true)); -- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); -+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); // Spigot - this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true)); - } - -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 28643c5..6df2186 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -203,4 +203,11 @@ public class SpigotWorldConfig - arrowDespawnRate = getInt( "arrow-despawn-rate", 1200 ); - log( "Arrow Despawn Rate: " + arrowDespawnRate ); - } -+ -+ public boolean zombieAggressiveTowardsVillager; -+ private void zombieAggressiveTowardsVillager() -+ { -+ zombieAggressiveTowardsVillager = getBoolean( "zombie-aggressive-towards-villager", true ); -+ log( "Zombie Aggressive Towards Villager: " + zombieAggressiveTowardsVillager ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0050-Configurable-Amount-of-Netty-Threads.patch b/CraftBukkit-Patches/0050-Configurable-Amount-of-Netty-Threads.patch deleted file mode 100644 index dd3dfdfc46..0000000000 --- a/CraftBukkit-Patches/0050-Configurable-Amount-of-Netty-Threads.patch +++ /dev/null @@ -1,57 +0,0 @@ -From edc862d79d59ff2cc77a068e722a11c3bfcd9abe Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 13 Dec 2013 11:58:58 +1100 -Subject: [PATCH] Configurable Amount of Netty Threads - -This brings back the option that the Spigot version of netty saw. By default Netty will try and use cores*2 threads, however if running multiple servers on the same machine, this can be too many threads. Additionally some people have 16 core servers. If 32 Netty threads are allowed in this setup, then the lock contention, and thus blocking between threads becomes much greater, leading to decreased performance. - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bc9ac2b..d616c4f 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -57,7 +57,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - private final List o = Lists.newArrayList(); - protected final ICommandHandler b; - public final MethodProfiler methodProfiler = new MethodProfiler(); -- private final ServerConnection p; -+ private ServerConnection p; // Spigot - private final ServerPing q = new ServerPing(); - private final Random r = new Random(); - private final DataConverterManager dataConverterManager; -@@ -122,7 +122,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - this.W = gameprofilerepository; - this.X = usercache; - // this.universe = file; // CraftBukkit -- this.p = new ServerConnection(this); -+ // this.p = new ServerConnection(this); // Spigot - this.b = this.i(); - // this.convertable = new WorldLoaderServer(file); // CraftBukkit - moved to DedicatedServer.init - this.dataConverterManager = dataconvertermanager; -@@ -1303,7 +1303,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - } - // Spigot End - public ServerConnection am() { -- return this.p; -+ return this.p == null ? this.p = new ServerConnection(this) : this.p; // Spigot - } - - public boolean ao() { -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 824ba7a..a306266 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -221,4 +221,11 @@ public class SpigotConfig - } - bungee = getBoolean( "settings.bungeecord", false ); - } -+ -+ private static void nettyThreads() -+ { -+ int count = getInt( "settings.netty-threads", 4 ); -+ System.setProperty( "io.netty.eventLoopThreads", Integer.toString( count ) ); -+ Bukkit.getLogger().log( Level.INFO, "Using {0} threads for Netty based IO", count ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0051-Prevent-Mineshaft-Saving.patch b/CraftBukkit-Patches/0051-Prevent-Mineshaft-Saving.patch deleted file mode 100644 index 8aff048f44..0000000000 --- a/CraftBukkit-Patches/0051-Prevent-Mineshaft-Saving.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 27435da7261f44e7b09a250d0f30068eb7d7ea37 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 13 Dec 2013 15:21:02 +1100 -Subject: [PATCH] Prevent Mineshaft Saving - - -diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index 4a4d2af..22d96e9 100644 ---- a/src/main/java/net/minecraft/server/StructureGenerator.java -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -198,7 +198,7 @@ public abstract class StructureGenerator extends WorldGenBase { - protected void a(World world) { - if (this.a == null) { - // Spigot Start -- if (world.spigotConfig.saveStructureInfo) { -+ if (world.spigotConfig.saveStructureInfo && !this.a().equals( "Mineshaft" )) { - this.a = (PersistentStructure) world.a(PersistentStructure.class, this.a()); - } else { - this.a = new PersistentStructure(this.a()); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0052-Log-Cause-of-Unexpected-Exceptions.patch b/CraftBukkit-Patches/0052-Log-Cause-of-Unexpected-Exceptions.patch deleted file mode 100644 index 6fc01e06e5..0000000000 --- a/CraftBukkit-Patches/0052-Log-Cause-of-Unexpected-Exceptions.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 9aa16093b9bdf922f4ac04d87c5eaeb9e5fa377a Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 18 Dec 2013 13:39:14 +1100 -Subject: [PATCH] Log Cause of Unexpected Exceptions - - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d616c4f..05a63cb 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -549,6 +549,12 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - } - } catch (Throwable throwable) { - MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable); -+ // Spigot Start -+ if ( throwable.getCause() != null ) -+ { -+ MinecraftServer.LOGGER.error( "\tCause of unexpected exception was", throwable.getCause() ); -+ } -+ // Spigot End - CrashReport crashreport = null; - - if (throwable instanceof ReportedException) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0053-Particle-API.patch b/CraftBukkit-Patches/0053-Particle-API.patch deleted file mode 100644 index 2437d19fb3..0000000000 --- a/CraftBukkit-Patches/0053-Particle-API.patch +++ /dev/null @@ -1,215 +0,0 @@ -From f7d1c59ee398f6740c96349acd5b41723c29c6a0 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Fri, 20 Dec 2013 21:36:06 +0000 -Subject: [PATCH] Particle API - - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java -index 7de0de5..13f9e9d 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java -@@ -55,6 +55,9 @@ public class CraftEffect { - Validate.isTrue(((Material) data).isBlock(), "Material is not a block!"); - datavalue = ((Material) data).getId(); - break; -+ case ITEM_BREAK: -+ datavalue = ((Material) data).getId(); -+ break; - default: - datavalue = 0; - } -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d132f1a..8f2ec20 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -864,28 +864,18 @@ public class CraftWorld implements World { - Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!"); - } - -- int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data); -- playEffect(loc, effect, datavalue, radius); -+ if (data != null && data.getClass().equals( org.bukkit.material.MaterialData.class )) { -+ org.bukkit.material.MaterialData materialData = (org.bukkit.material.MaterialData) data; -+ Validate.isTrue( materialData.getItemType().isBlock(), "Material must be block" ); -+ spigot().playEffect( loc, effect, materialData.getItemType().getId(), materialData.getData(), 0, 0, 0, 1, 1, radius ); -+ } else { -+ int dataValue = data == null ? 0 : CraftEffect.getDataValue( effect, data ); -+ playEffect( loc, effect, dataValue, radius ); -+ } - } - - public void playEffect(Location location, Effect effect, int data, int radius) { -- Validate.notNull(location, "Location cannot be null"); -- Validate.notNull(effect, "Effect cannot be null"); -- Validate.notNull(location.getWorld(), "World cannot be null"); -- int packetData = effect.getId(); -- PacketPlayOutWorldEvent packet = new PacketPlayOutWorldEvent(packetData, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), data, false); -- int distance; -- radius *= radius; -- -- for (Player player : getPlayers()) { -- if (((CraftPlayer) player).getHandle().playerConnection == null) continue; -- if (!location.getWorld().equals(player.getWorld())) continue; -- -- distance = (int) player.getLocation().distanceSquared(location); -- if (distance <= radius) { -- ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); -- } -- } -+ spigot().playEffect( location, effect, data, 0, 0, 0, 0, 1, 1, radius ); - } - - public T spawn(Location location, Class clazz) throws IllegalArgumentException { -@@ -1516,6 +1506,70 @@ public class CraftWorld implements World { - // Spigot start - private final Spigot spigot = new Spigot() - { -+ @Override -+ public void playEffect( Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius ) -+ { -+ Validate.notNull( location, "Location cannot be null" ); -+ Validate.notNull( effect, "Effect cannot be null" ); -+ Validate.notNull( location.getWorld(), "World cannot be null" ); -+ Packet packet; -+ if ( effect.getType() != Effect.Type.PARTICLE ) -+ { -+ int packetData = effect.getId(); -+ packet = new PacketPlayOutWorldEvent( packetData, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ() ), id, false ); -+ } else -+ { -+ net.minecraft.server.EnumParticle particle = null; -+ int[] extra = null; -+ for ( net.minecraft.server.EnumParticle p : net.minecraft.server.EnumParticle.values() ) -+ { -+ if ( effect.getName().startsWith( p.b().replace("_", "") ) ) -+ { -+ particle = p; -+ if ( effect.getData() != null ) -+ { -+ if ( effect.getData().equals( org.bukkit.Material.class ) ) -+ { -+ extra = new int[]{ id }; -+ } else -+ { -+ extra = new int[]{ (data << 12) | (id & 0xFFF) }; -+ } -+ } -+ break; -+ } -+ } -+ if ( extra == null ) -+ { -+ extra = new int[0]; -+ } -+ packet = new PacketPlayOutWorldParticles( particle, true, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount, extra ); -+ } -+ int distance; -+ radius *= radius; -+ for ( Player player : getPlayers() ) -+ { -+ if ( ( (CraftPlayer) player ).getHandle().playerConnection == null ) -+ { -+ continue; -+ } -+ if ( !location.getWorld().equals( player.getWorld() ) ) -+ { -+ continue; -+ } -+ distance = (int) player.getLocation().distanceSquared( location ); -+ if ( distance <= radius ) -+ { -+ ( (CraftPlayer) player ).getHandle().playerConnection.sendPacket( packet ); -+ } -+ } -+ } -+ -+ @Override -+ public void playEffect( Location location, Effect effect ) -+ { -+ CraftWorld.this.playEffect( location, effect, 0 ); -+ } - }; - - public Spigot spigot() -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a90de6a..9ef1fc4 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -315,9 +315,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - public void playEffect(Location loc, Effect effect, int data) { - if (getHandle().playerConnection == null) return; - -- int packetData = effect.getId(); -- PacketPlayOutWorldEvent packet = new PacketPlayOutWorldEvent(packetData, new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), data, false); -- getHandle().playerConnection.sendPacket(packet); -+ spigot().playEffect(loc, effect, data, 0, 0, 0, 0, 1, 1, 64); // Spigot - } - - @Override -@@ -1435,6 +1433,63 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - server.getServer().getPlayerList().moveToWorld( getHandle(), 0, false ); - } - } -+ -+ @Override -+ public void playEffect( Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius ) -+ { -+ Validate.notNull( location, "Location cannot be null" ); -+ Validate.notNull( effect, "Effect cannot be null" ); -+ Validate.notNull( location.getWorld(), "World cannot be null" ); -+ Packet packet; -+ if ( effect.getType() != Effect.Type.PARTICLE ) -+ { -+ int packetData = effect.getId(); -+ packet = new PacketPlayOutWorldEvent( packetData, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ() ), id, false ); -+ } else -+ { -+ net.minecraft.server.EnumParticle particle = null; -+ int[] extra = null; -+ for ( net.minecraft.server.EnumParticle p : net.minecraft.server.EnumParticle.values() ) -+ { -+ if ( effect.getName().startsWith( p.b().replace("_", "") ) ) -+ { -+ particle = p; -+ if ( effect.getData() != null ) -+ { -+ if ( effect.getData().equals( org.bukkit.Material.class ) ) -+ { -+ extra = new int[]{ id }; -+ } else -+ { -+ extra = new int[]{ (data << 12) | (id & 0xFFF) }; -+ } -+ } -+ break; -+ } -+ } -+ if ( extra == null ) -+ { -+ extra = new int[0]; -+ } -+ packet = new PacketPlayOutWorldParticles( particle, true, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount, extra ); -+ } -+ int distance; -+ radius *= radius; -+ if ( getHandle().playerConnection == null ) -+ { -+ return; -+ } -+ if ( !location.getWorld().equals( getWorld() ) ) -+ { -+ return; -+ } -+ -+ distance = (int) getLocation().distanceSquared( location ); -+ if ( distance <= radius ) -+ { -+ getHandle().playerConnection.sendPacket( packet ); -+ } -+ } - }; - - public Player.Spigot spigot() --- -2.5.0 - diff --git a/CraftBukkit-Patches/0054-Save-ticks-lived-to-nbttag.patch b/CraftBukkit-Patches/0054-Save-ticks-lived-to-nbttag.patch deleted file mode 100644 index bcd0025fe0..0000000000 --- a/CraftBukkit-Patches/0054-Save-ticks-lived-to-nbttag.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 3226bf418d193d5aaa5075792cba7291f0d00350 Mon Sep 17 00:00:00 2001 -From: DerFlash -Date: Tue, 9 Jul 2013 00:11:12 +0200 -Subject: [PATCH] Save ticks lived to nbttag - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 1eec160..5955732 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1292,6 +1292,7 @@ public abstract class Entity implements ICommandListener { - nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits()); - nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits()); - nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL); -+ nbttagcompound.setInt("Spigot.ticksLived", this.ticksLived); - // CraftBukkit end - if (this.getCustomName() != null && !this.getCustomName().isEmpty()) { - nbttagcompound.setString("CustomName", this.getCustomName()); -@@ -1428,6 +1429,8 @@ public abstract class Entity implements ICommandListener { - if (this instanceof EntityLiving) { - EntityLiving entity = (EntityLiving) this; - -+ this.ticksLived = nbttagcompound.getInt("Spigot.ticksLived"); -+ - // Reset the persistence for tamed animals - if (entity instanceof EntityTameableAnimal && !isLevelAtLeast(nbttagcompound, 2) && !nbttagcompound.getBoolean("PersistenceRequired")) { - EntityInsentient entityinsentient = (EntityInsentient) entity; --- -2.5.0 - diff --git a/CraftBukkit-Patches/0055-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch b/CraftBukkit-Patches/0055-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch deleted file mode 100644 index 3b36f7784e..0000000000 --- a/CraftBukkit-Patches/0055-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 2a39802f8d846864a587def7c0d3cf2e3da8449a Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 2 Feb 2014 16:55:46 +0000 -Subject: [PATCH] Add Option to Nerf Mobs from Spawner's - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 1045aa2..f1d7dc5 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -145,6 +145,7 @@ public abstract class Entity implements ICommandListener { - public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); - public final boolean defaultActivationState; - public long activatedTick = Integer.MIN_VALUE; -+ public boolean fromMobSpawner; - public void inactiveTick() { } - // Spigot end - -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 8351aa5..16444b6 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -619,6 +619,12 @@ public abstract class EntityInsentient extends EntityLiving { - this.world.methodProfiler.a("checkDespawn"); - this.L(); - this.world.methodProfiler.b(); -+ // Spigot Start -+ if ( this.fromMobSpawner ) -+ { -+ return; -+ } -+ // Spigot End - this.world.methodProfiler.a("sensing"); - this.bu.a(); - this.world.methodProfiler.b(); -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 01cbd71..efe792b 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -94,7 +94,12 @@ public abstract class MobSpawnerAbstract { - if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) { - ((EntityInsentient) entity).prepare(world.D(new BlockPosition(entity)), (GroupDataEntity) null); - } -- -+ // Spigot Start -+ if ( entity.world.spigotConfig.nerfSpawnerMobs ) -+ { -+ entity.fromMobSpawner = true; -+ } -+ // Spigot End - ChunkRegionLoader.a(entity, world, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit - world.triggerEffect(2004, blockposition, 0); - if (entityinsentient != null) { -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 6df2186..3854195 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -210,4 +210,11 @@ public class SpigotWorldConfig - zombieAggressiveTowardsVillager = getBoolean( "zombie-aggressive-towards-villager", true ); - log( "Zombie Aggressive Towards Villager: " + zombieAggressiveTowardsVillager ); - } -+ -+ public boolean nerfSpawnerMobs; -+ private void nerfSpawnerMobs() -+ { -+ nerfSpawnerMobs = getBoolean( "nerf-spawner-mobs", false ); -+ log( "Nerfing mobs spawned from spawners: " + nerfSpawnerMobs ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0056-Warn-if-PermGen-may-be-insufficient.patch b/CraftBukkit-Patches/0056-Warn-if-PermGen-may-be-insufficient.patch deleted file mode 100644 index de8386c1eb..0000000000 --- a/CraftBukkit-Patches/0056-Warn-if-PermGen-may-be-insufficient.patch +++ /dev/null @@ -1,36 +0,0 @@ -From d4f504fab98a9308994aabf88621723d5fdc6651 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 23 Dec 2013 14:07:41 +1100 -Subject: [PATCH] Warn if PermGen may be insufficient - - -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index aca0d97..337aa29 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -173,6 +173,22 @@ public class Main { - useConsole = false; - } - -+ // Spigot Start -+ int maxPermGen = 0; // In kb -+ for ( String s : java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments() ) -+ { -+ if ( s.startsWith( "-XX:MaxPermSize" ) ) -+ { -+ maxPermGen = Integer.parseInt( s.replaceAll( "[^\\d]", "" ) ); -+ maxPermGen <<= 10 * ("kmg".indexOf( Character.toLowerCase( s.charAt( s.length() - 1 ) ) ) ); -+ } -+ } -+ if ( Float.parseFloat( System.getProperty( "java.class.version" ) ) < 52 && maxPermGen < ( 128 << 10 ) ) // 128mb -+ { -+ System.out.println( "Warning, your max perm gen size is not set or less than 128mb. It is recommended you restart Java with the following argument: -XX:MaxPermSize=128M" ); -+ System.out.println( "Please see http://www.spigotmc.org/wiki/changing-permgen-size/ for more details and more in-depth instructions." ); -+ } -+ // Spigot End - System.out.println("Loading libraries, please wait..."); - MinecraftServer.main(options); - } catch (Throwable t) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0057-Disable-Connected-Check-on-setScoreboard.patch b/CraftBukkit-Patches/0057-Disable-Connected-Check-on-setScoreboard.patch deleted file mode 100644 index 68cce23258..0000000000 --- a/CraftBukkit-Patches/0057-Disable-Connected-Check-on-setScoreboard.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 20018eca9a63874370634de3f0550b33be542448 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 23 Dec 2013 15:57:57 +1100 -Subject: [PATCH] Disable Connected Check on setScoreboard - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e3ecd4d..28fc6e6 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1234,7 +1234,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - throw new IllegalStateException("Cannot set scoreboard yet"); - } - if (playerConnection.isDisconnected()) { -- throw new IllegalStateException("Cannot set scoreboard for invalid CraftPlayer"); -+ // throw new IllegalStateException("Cannot set scoreboard for invalid CraftPlayer"); // Spigot - remove this as Mojang's semi asynchronous Netty implementation can lead to races - } - - this.server.getScoreboardManager().setPlayerBoard(this, scoreboard); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0058-Add-Late-Bind-Option.patch b/CraftBukkit-Patches/0058-Add-Late-Bind-Option.patch deleted file mode 100644 index cf07a53e5e..0000000000 --- a/CraftBukkit-Patches/0058-Add-Late-Bind-Option.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 7aeea7d6a4332b15cc56691df077db4d28303407 Mon Sep 17 00:00:00 2001 -From: slide23 -Date: Fri, 20 Dec 2013 20:15:33 -0600 -Subject: [PATCH] Add Late Bind Option - -Add late-bind config option to delay binding until loading is done. - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index e5c0ed9..d6a01a9 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -176,6 +176,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - this.a(MinecraftEncryption.b()); - DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().isEmpty() ? "*" : this.getServerIp()) + ":" + this.P()); - -+ if (!org.spigotmc.SpigotConfig.lateBind) { - try { - this.am().a(inetaddress, this.P()); - } catch (IOException ioexception) { -@@ -184,6 +185,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?"); - return false; - } -+ } - - // Spigot Start - Move DedicatedPlayerList up and bring plugin loading from CraftServer to here - // this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit -@@ -276,6 +278,17 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - } - // CraftBukkit end - -+ if (org.spigotmc.SpigotConfig.lateBind) { -+ try { -+ this.am().a(inetaddress, this.P()); -+ } catch (IOException ioexception) { -+ DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!"); -+ DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()}); -+ DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?"); -+ return false; -+ } -+ } -+ - if (false && this.aP() > 0L) { // Spigot - disable - Thread thread1 = new Thread(new ThreadWatchdog(this)); - -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index a306266..4edc6af 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -228,4 +228,9 @@ public class SpigotConfig - System.setProperty( "io.netty.eventLoopThreads", Integer.toString( count ) ); - Bukkit.getLogger().log( Level.INFO, "Using {0} threads for Netty based IO", count ); - } -+ -+ public static boolean lateBind; -+ private static void lateBind() { -+ lateBind = getBoolean( "settings.late-bind", false ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0059-Allow-statistics-to-be-disabled-forced.patch b/CraftBukkit-Patches/0059-Allow-statistics-to-be-disabled-forced.patch deleted file mode 100644 index c9070e151e..0000000000 --- a/CraftBukkit-Patches/0059-Allow-statistics-to-be-disabled-forced.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 20ba002dde049a8fad1402b4e976e38304e4018e Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Tue, 7 Jan 2014 15:56:26 +0000 -Subject: [PATCH] Allow statistics to be disabled/forced - - -diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java -index 76bd9c1..a08eb77 100644 ---- a/src/main/java/net/minecraft/server/ServerStatisticManager.java -+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java -@@ -31,6 +31,14 @@ public class ServerStatisticManager extends StatisticManager { - public ServerStatisticManager(MinecraftServer minecraftserver, File file) { - this.c = minecraftserver; - this.d = file; -+ // Spigot start -+ for ( String name : org.spigotmc.SpigotConfig.forcedStats.keySet() ) -+ { -+ StatisticWrapper wrapper = new StatisticWrapper(); -+ wrapper.a( org.spigotmc.SpigotConfig.forcedStats.get( name ) ); -+ a.put( StatisticList.getStatistic( name ), wrapper ); -+ } -+ // Spigot end - } - - public void a() { -@@ -48,6 +56,7 @@ public class ServerStatisticManager extends StatisticManager { - } - - public void b() { -+ if ( org.spigotmc.SpigotConfig.disableStatSaving ) return; // Spigot - try { - FileUtils.writeStringToFile(this.d, a(this.a)); - } catch (IOException ioexception) { -@@ -57,6 +66,7 @@ public class ServerStatisticManager extends StatisticManager { - } - - public void setStatistic(EntityHuman entityhuman, Statistic statistic, int i) { -+ if ( org.spigotmc.SpigotConfig.disableStatSaving ) return; // Spigot - int j = statistic.d() ? this.getStatisticValue(statistic) : 0; - - super.setStatistic(entityhuman, statistic, i); -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 4edc6af..a2be9df 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -10,10 +10,12 @@ import java.util.HashMap; - import java.util.List; - import java.util.Map; - import java.util.logging.Level; -+import gnu.trove.map.hash.TObjectIntHashMap; - import net.minecraft.server.MinecraftServer; - import org.bukkit.Bukkit; - import org.bukkit.ChatColor; - import org.bukkit.command.Command; -+import org.bukkit.configuration.ConfigurationSection; - import org.bukkit.configuration.InvalidConfigurationException; - import org.bukkit.configuration.file.YamlConfiguration; - -@@ -233,4 +235,31 @@ public class SpigotConfig - private static void lateBind() { - lateBind = getBoolean( "settings.late-bind", false ); - } -+ -+ public static boolean disableStatSaving; -+ public static TObjectIntHashMap forcedStats = new TObjectIntHashMap(); -+ private static void stats() -+ { -+ disableStatSaving = getBoolean( "stats.disable-saving", false ); -+ -+ if ( !config.contains( "stats.forced-stats" ) ) { -+ config.createSection( "stats.forced-stats" ); -+ } -+ -+ ConfigurationSection section = config.getConfigurationSection( "stats.forced-stats" ); -+ for ( String name : section.getKeys( true ) ) -+ { -+ if ( section.isInt( name ) ) -+ { -+ forcedStats.put( name, section.getInt( name ) ); -+ } -+ } -+ -+ if ( disableStatSaving && section.getInt( "achievement.openInventory", 0 ) < 1 ) -+ { -+ Bukkit.getLogger().warning( "*** WARNING *** stats.disable-saving is true but stats.forced-stats.achievement.openInventory" + -+ " isn't set to 1. Disabling stat saving without forcing the achievement may cause it to get stuck on the player's " + -+ "screen." ); -+ } -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0060-Fix-ItemStack-Unbreakable-Code.patch b/CraftBukkit-Patches/0060-Fix-ItemStack-Unbreakable-Code.patch deleted file mode 100644 index 523b099c29..0000000000 --- a/CraftBukkit-Patches/0060-Fix-ItemStack-Unbreakable-Code.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 61c54a8a1c06464bdb8bd07b5a0936157ab39813 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 10 Jan 2014 15:15:50 +1100 -Subject: [PATCH] Fix ItemStack Unbreakable Code - - -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 782ca57..4a43208 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -286,7 +286,13 @@ public final class ItemStack { - } - - public boolean e() { -- return this.item == null ? false : (this.item.getMaxDurability() <= 0 ? false : !this.hasTag() || !this.getTag().getBoolean("Unbreakable")); -+ // Spigot Start -+ if ( this.item.getMaxDurability() <= 0 ) -+ { -+ return false; -+ } -+ return ( !hasTag() ) || ( !getTag().getBoolean( "Unbreakable" ) ); -+ // Spigot End - } - - public boolean usesData() { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0061-Try-and-Debug-Crash-Reports-Crashing.patch b/CraftBukkit-Patches/0061-Try-and-Debug-Crash-Reports-Crashing.patch deleted file mode 100644 index 67b0ad847e..0000000000 --- a/CraftBukkit-Patches/0061-Try-and-Debug-Crash-Reports-Crashing.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 91ccf3dfcb0fe90e0fdd2392b0f6951f8bee8f1a Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 12 Jan 2014 20:56:41 +1100 -Subject: [PATCH] Try and Debug Crash Reports Crashing - - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 05a63cb..dfe3305 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -748,7 +748,13 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - worldserver.doTick(); - worldserver.timings.doTick.stopTiming(); // Spigot - } catch (Throwable throwable) { -+ // Spigot Start -+ try { - crashreport = CrashReport.a(throwable, "Exception ticking world"); -+ } catch (Throwable t){ -+ throw new RuntimeException("Error generating crash report", t); -+ } -+ // Spigot End - worldserver.a(crashreport); - throw new ReportedException(crashreport); - } -@@ -758,7 +764,13 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - worldserver.tickEntities(); - worldserver.timings.tickEntities.stopTiming(); // Spigot - } catch (Throwable throwable1) { -+ // Spigot Start -+ try { - crashreport = CrashReport.a(throwable1, "Exception ticking world entities"); -+ } catch (Throwable t){ -+ throw new RuntimeException("Error generating crash report", t); -+ } -+ // Spigot End - worldserver.a(crashreport); - throw new ReportedException(crashreport); - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0062-Improve-AutoSave-Mechanism.patch b/CraftBukkit-Patches/0062-Improve-AutoSave-Mechanism.patch deleted file mode 100644 index d1e3fd698a..0000000000 --- a/CraftBukkit-Patches/0062-Improve-AutoSave-Mechanism.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 5cf8af27e4ce431e97368d6443355adb429c059f Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 12 Jan 2014 21:07:18 +1100 -Subject: [PATCH] Improve AutoSave Mechanism - -The problem here is that MinecraftServer.save(..), will attempt to sleep whilst all pending chunks are written to disk. -however due to various and complicated bugs, it will wait for an incorrect amount of chunks, which may cause it to sleep for an overly long amount of time. - -Instead we will mimic the save-all command in its behaviour, which is both safe and performant. - -Also, only save modified chunks, or chunks with entities after 4 auto save passes - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index a7006b8..a4bf29a 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -875,7 +875,7 @@ public class Chunk { - if (this.s && this.world.getTime() != this.lastSaved || this.r) { - return true; - } -- } else if (this.s && this.world.getTime() >= this.lastSaved + 600L) { -+ } else if (this.s && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod * 4) { // Spigot - Only save if we've passed 2 auto save intervals without modification - return true; - } - -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 162613b..83857a6 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -263,7 +263,7 @@ public class ChunkProviderServer implements IChunkProvider { - this.saveChunk(chunk); - chunk.f(false); - ++i; -- if (i == 24 && !flag) { -+ if (i == 24 && !flag && false) { // Spigot - return false; - } - } -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index dfe3305..bd2837c 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -660,7 +660,17 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - SpigotTimings.worldSaveTimer.startTiming(); // Spigot - this.methodProfiler.a("save"); - this.v.savePlayers(); -- this.saveChunks(true); -+ // Spigot Start -+ // We replace this with saving each individual world as this.saveChunks(...) is broken, -+ // and causes the main thread to sleep for random amounts of time depending on chunk activity -+ // Also pass flag to only save modified chunks -+ server.playerCommandState = true; -+ for (World world : worlds) { -+ world.getWorld().save(false); -+ } -+ server.playerCommandState = false; -+ // this.saveChunks(true); -+ // Spigot End - this.methodProfiler.b(); - SpigotTimings.worldSaveTimer.stopTiming(); // Spigot - } -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 8f2ec20..bb0268e 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -768,12 +768,17 @@ public class CraftWorld implements World { - } - - public void save() { -+ // Spigot start -+ save(true); -+ } -+ public void save(boolean forceSave) { -+ // Spigot end - this.server.checkSaveState(); - try { - boolean oldSave = world.savingDisabled; - - world.savingDisabled = false; -- world.save(true, null); -+ world.save(forceSave, null); // Spigot - - world.savingDisabled = oldSave; - } catch (ExceptionWorldConflict ex) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0063-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch b/CraftBukkit-Patches/0063-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch deleted file mode 100644 index 4c22fe9a02..0000000000 --- a/CraftBukkit-Patches/0063-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 9ac4a3b1609dd19bb6f8b14f37172207bf9ec6c0 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 20 Jan 2014 13:44:07 +1100 -Subject: [PATCH] Catch stalling on corrupted map data / NBT arrays. - - -diff --git a/src/main/java/net/minecraft/server/NBTTagByteArray.java b/src/main/java/net/minecraft/server/NBTTagByteArray.java -index c6b5f70..13e9d0b 100644 ---- a/src/main/java/net/minecraft/server/NBTTagByteArray.java -+++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java -@@ -23,6 +23,7 @@ public class NBTTagByteArray extends NBTBase { - void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { - nbtreadlimiter.a(192L); - int j = datainput.readInt(); -+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24); - - nbtreadlimiter.a((long) (8 * j)); - this.data = new byte[j]; -diff --git a/src/main/java/net/minecraft/server/NBTTagIntArray.java b/src/main/java/net/minecraft/server/NBTTagIntArray.java -index 5f17034..e206e50 100644 ---- a/src/main/java/net/minecraft/server/NBTTagIntArray.java -+++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java -@@ -27,6 +27,7 @@ public class NBTTagIntArray extends NBTBase { - void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { - nbtreadlimiter.a(192L); - int j = datainput.readInt(); -+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24); - - nbtreadlimiter.a((long) (32 * j)); - this.data = new int[j]; --- -2.5.0 - diff --git a/CraftBukkit-Patches/0064-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch b/CraftBukkit-Patches/0064-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch deleted file mode 100644 index 4af4bec460..0000000000 --- a/CraftBukkit-Patches/0064-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 293c8c84dca0a789d28c3dcdefa8c9b46f77467a Mon Sep 17 00:00:00 2001 -From: Dmck2b -Date: Mon, 20 Jan 2014 20:18:23 +0000 -Subject: [PATCH] Allow toggling of ZombiePigmen spawning in portal blocks - - -diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java -index 05f0719..d85335b 100644 ---- a/src/main/java/net/minecraft/server/BlockPortal.java -+++ b/src/main/java/net/minecraft/server/BlockPortal.java -@@ -35,7 +35,7 @@ public class BlockPortal extends BlockHalfTransparent { - - public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - super.b(world, blockposition, iblockdata, random); -- if (world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.getDifficulty().a()) { -+ if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.getDifficulty().a()) { // Spigot - int i = blockposition.getY(); - - BlockPosition blockposition1; -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 3854195..4cca76a 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -217,4 +217,11 @@ public class SpigotWorldConfig - nerfSpawnerMobs = getBoolean( "nerf-spawner-mobs", false ); - log( "Nerfing mobs spawned from spawners: " + nerfSpawnerMobs ); - } -+ -+ public boolean enableZombiePigmenPortalSpawns; -+ private void enableZombiePigmenPortalSpawns() -+ { -+ enableZombiePigmenPortalSpawns = getBoolean( "enable-zombie-pigmen-portal-spawns", true ); -+ log( "Allow Zombie Pigmen to spawn from portal blocks: " + enableZombiePigmenPortalSpawns ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0065-Highly-Optimized-Tick-Loop.patch b/CraftBukkit-Patches/0065-Highly-Optimized-Tick-Loop.patch deleted file mode 100644 index 858e8a73f3..0000000000 --- a/CraftBukkit-Patches/0065-Highly-Optimized-Tick-Loop.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 8ae40e4b57d9b0750319f013dbe1d818b9bc43be Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 25 Jan 2014 14:08:35 +1100 -Subject: [PATCH] Highly Optimized Tick Loop - - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bd2837c..49e5aac 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -114,6 +114,12 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - public java.util.Queue processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); - public int autosavePeriod; - // CraftBukkit end -+ // Spigot start -+ private static final int TPS = 20; -+ private static final int TICK_TIME = 1000000000 / TPS; -+ private static final int SAMPLE_INTERVAL = 100; -+ public final double[] recentTps = new double[ 3 ]; -+ // Spigot end - - public MinecraftServer(OptionSet options, Proxy proxy, DataConverterManager dataconvertermanager, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) { - this.e = proxy; -@@ -502,6 +508,13 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - this.isRunning = false; - } - -+ // Spigot Start -+ private static double calcTps(double avg, double exp, double tps) -+ { -+ return ( avg * exp ) + ( tps * ( 1 - exp ) ); -+ } -+ // Spigot End -+ - public void run() { - try { - if (this.init()) { -@@ -512,38 +525,34 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - this.q.setServerInfo(new ServerPing.ServerData("1.9", 107)); - this.a(this.q); - -+ // Spigot start -+ Arrays.fill( recentTps, 20 ); -+ long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; - while (this.isRunning) { -- long j = av(); -- long k = j - this.aa; -- -- if (k > 2000L && this.aa - this.Q >= 15000L) { -- if (server.getWarnOnOverload()) // CraftBukkit -- MinecraftServer.LOGGER.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(k), Long.valueOf(k / 50L)}); -- k = 2000L; -- this.Q = this.aa; -- } -- -- if (k < 0L) { -- MinecraftServer.LOGGER.warn("Time ran backwards! Did the system time change?"); -- k = 0L; -+ curTime = System.nanoTime(); -+ wait = TICK_TIME - (curTime - lastTick) - catchupTime; -+ if (wait > 0) { -+ Thread.sleep(wait / 1000000); -+ catchupTime = 0; -+ continue; -+ } else { -+ catchupTime = Math.min(1000000000, Math.abs(wait)); - } - -- i += k; -- this.aa = j; -- if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit -- this.C(); -- i = 0L; -- } else { -- while (i > 50L) { -- MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit -- i -= 50L; -- this.C(); -- } -+ if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 ) -+ { -+ double currentTps = 1E9 / ( curTime - tickSection ) * SAMPLE_INTERVAL; -+ recentTps[0] = calcTps( recentTps[0], 0.92, currentTps ); // 1/exp(5sec/1min) -+ recentTps[1] = calcTps( recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min) -+ recentTps[2] = calcTps( recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min) -+ tickSection = curTime; - } -+ lastTick = curTime; - -- Thread.sleep(Math.max(1L, 50L - i)); -+ this.C(); - this.P = true; - } -+ // Spigot end - } else { - this.a((CrashReport) null); - } -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index a2be9df..e1cc2e0 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -262,4 +262,9 @@ public class SpigotConfig - "screen." ); - } - } -+ -+ private static void tpsCommand() -+ { -+ commands.put( "tps", new TicksPerSecondCommand( "tps" ) ); -+ } - } -diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java -new file mode 100644 -index 0000000..be2e31d ---- /dev/null -+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java -@@ -0,0 +1,45 @@ -+package org.spigotmc; -+ -+import com.google.common.base.Joiner; -+import net.minecraft.server.MinecraftServer; -+import com.google.common.collect.Iterables; -+import org.bukkit.ChatColor; -+import org.bukkit.command.Command; -+import org.bukkit.command.CommandSender; -+ -+public class TicksPerSecondCommand extends Command -+{ -+ -+ public TicksPerSecondCommand(String name) -+ { -+ super( name ); -+ this.description = "Gets the current ticks per second for the server"; -+ this.usageMessage = "/tps"; -+ this.setPermission( "bukkit.command.tps" ); -+ } -+ -+ @Override -+ public boolean execute(CommandSender sender, String currentAlias, String[] args) -+ { -+ if ( !testPermission( sender ) ) -+ { -+ return true; -+ } -+ -+ StringBuilder sb = new StringBuilder( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " ); -+ for ( double tps : MinecraftServer.getServer().recentTps ) -+ { -+ sb.append( format( tps ) ); -+ sb.append( ", " ); -+ } -+ sender.sendMessage( sb.substring( 0, sb.length() - 2 ) ); -+ -+ return true; -+ } -+ -+ private String format(double tps) -+ { -+ return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString() -+ + ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); -+ } -+} --- -2.5.0 - diff --git a/CraftBukkit-Patches/0066-Configurable-Ping-Sample-Size.patch b/CraftBukkit-Patches/0066-Configurable-Ping-Sample-Size.patch deleted file mode 100644 index 676fed5f5d..0000000000 --- a/CraftBukkit-Patches/0066-Configurable-Ping-Sample-Size.patch +++ /dev/null @@ -1,43 +0,0 @@ -From dbfad51762956d4bc6c5c5d72cbf0f3a2badde7d Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 26 Jan 2014 21:48:34 +1100 -Subject: [PATCH] Configurable Ping Sample Size - - -diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java -index 519a380..08b14ec 100644 ---- a/src/main/java/net/minecraft/server/PacketStatusListener.java -+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java -@@ -108,6 +108,13 @@ public class PacketStatusListener implements PacketStatusInListener { - } - - ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size()); -+ // Spigot Start -+ if ( !profiles.isEmpty() ) -+ { -+ java.util.Collections.shuffle( profiles ); // This sucks, its inefficient but we have no simple way of doing it differently -+ profiles = profiles.subList( 0, Math.min( profiles.size(), org.spigotmc.SpigotConfig.playerSample ) ); // Cap the sample to n (or less) displayed players, ie: Vanilla behaviour -+ } -+ // Spigot End - playerSample.a(profiles.toArray(new GameProfile[profiles.size()])); - - ServerPing ping = new ServerPing(); -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index e1cc2e0..936c860 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -267,4 +267,11 @@ public class SpigotConfig - { - commands.put( "tps", new TicksPerSecondCommand( "tps" ) ); - } -+ -+ public static int playerSample; -+ private static void playerSample() -+ { -+ playerSample = getInt( "settings.sample-count", 12 ); -+ System.out.println( "Server Ping Player Sample Count: " + playerSample ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0067-Add-Optional-Tick-Shuffling.patch b/CraftBukkit-Patches/0067-Add-Optional-Tick-Shuffling.patch deleted file mode 100644 index 5377a84207..0000000000 --- a/CraftBukkit-Patches/0067-Add-Optional-Tick-Shuffling.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 61113aa5f7710ecae31ddc374322342efc928f17 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 27 Jan 2014 08:39:26 +1100 -Subject: [PATCH] Add Optional Tick Shuffling - -This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order. - -diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java -index 968a1b7..827bfaf 100644 ---- a/src/main/java/net/minecraft/server/ServerConnection.java -+++ b/src/main/java/net/minecraft/server/ServerConnection.java -@@ -123,6 +123,13 @@ public class ServerConnection { - List list = this.h; - - synchronized (this.h) { -+ // Spigot Start -+ // This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order -+ if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 ) -+ { -+ Collections.shuffle( this.h ); -+ } -+ // Spigot End - Iterator iterator = this.h.iterator(); - - while (iterator.hasNext()) { -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 936c860..83e575f 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -274,4 +274,10 @@ public class SpigotConfig - playerSample = getInt( "settings.sample-count", 12 ); - System.out.println( "Server Ping Player Sample Count: " + playerSample ); - } -+ -+ public static int playerShuffle; -+ private static void playerShuffle() -+ { -+ playerShuffle = getInt( "settings.player-shuffle", 0 ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0068-Implement-Locale-Getter-for-Players.patch b/CraftBukkit-Patches/0068-Implement-Locale-Getter-for-Players.patch deleted file mode 100644 index 66ebb0ede6..0000000000 --- a/CraftBukkit-Patches/0068-Implement-Locale-Getter-for-Players.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 91de49dc685e28082f2060813a712900d00ef634 Mon Sep 17 00:00:00 2001 -From: Smove -Date: Sat, 1 Feb 2014 18:12:16 +1100 -Subject: [PATCH] Implement Locale Getter for Players - - -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 91b5e2e..7df4d87 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -25,7 +25,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; - public class EntityPlayer extends EntityHuman implements ICrafting { - - private static final Logger bQ = LogManager.getLogger(); -- private String locale = "en_US"; -+ public String locale = "en_US"; // Spigot private -> public - public PlayerConnection playerConnection; - public final MinecraftServer server; - public final PlayerInteractManager playerInteractManager; -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 28fc6e6..8307458 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1490,6 +1490,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - getHandle().playerConnection.sendPacket( packet ); - } - } -+ -+ @Override -+ public String getLocale() -+ { -+ return getHandle().locale; -+ } - }; - - public Player.Spigot spigot() --- -2.5.0 - diff --git a/CraftBukkit-Patches/0069-Cap-Entity-Collisions.patch b/CraftBukkit-Patches/0069-Cap-Entity-Collisions.patch deleted file mode 100644 index b365c9e5d1..0000000000 --- a/CraftBukkit-Patches/0069-Cap-Entity-Collisions.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 65b40359420e0895ba245c0a7645e1fccdef63e0 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 31 Jan 2014 11:18:34 -0500 -Subject: [PATCH] Cap Entity Collisions - -Limit a single entity to colliding a max of configurable times per tick. -This will alleviate issues where living entities are hoarded in 1x1 pens. - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index b723b9b..0b0ff64 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -147,6 +147,7 @@ public abstract class Entity implements ICommandListener { - public long activatedTick = Integer.MIN_VALUE; - public boolean fromMobSpawner; - public void inactiveTick() { } -+ protected int numCollisions = 0; - // Spigot end - - public Entity(World world) { -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0cf1b90..8122cae 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1975,7 +1975,8 @@ public abstract class EntityLiving extends Entity { - List list = this.world.a((Entity) this, this.getBoundingBox(), IEntitySelector.a(this)); - - if (this.isInteractable() && !list.isEmpty()) { // Spigot: Add isInteractable() condition -- for (int i = 0; i < list.size(); ++i) { -+ numCollisions = Math.max(0, numCollisions - world.spigotConfig.maxCollisionsPerEntity); // Spigot -+ for (int i = 0; i < list.size() && numCollisions < world.spigotConfig.maxCollisionsPerEntity; ++i) { - Entity entity = (Entity) list.get(i); - // TODO better check now? - // CraftBukkit start - Only handle mob (non-player) collisions every other tick -@@ -1984,7 +1985,8 @@ public abstract class EntityLiving extends Entity { - } - // CraftBukkit end - -- -+ entity.numCollisions++; // Spigot -+ numCollisions++; // Spigot - this.C(entity); - } - } -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 4cca76a..19525eb 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -224,4 +224,11 @@ public class SpigotWorldConfig - enableZombiePigmenPortalSpawns = getBoolean( "enable-zombie-pigmen-portal-spawns", true ); - log( "Allow Zombie Pigmen to spawn from portal blocks: " + enableZombiePigmenPortalSpawns ); - } -+ -+ public int maxCollisionsPerEntity; -+ private void maxEntityCollision() -+ { -+ maxCollisionsPerEntity = getInt( "max-entity-collisions", 8 ); -+ log( "Max Entity Collisions: " + maxCollisionsPerEntity ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0070-Fix-dispensing-bone-meal-not-having-the-correct-data.patch b/CraftBukkit-Patches/0070-Fix-dispensing-bone-meal-not-having-the-correct-data.patch deleted file mode 100644 index 6be251dce2..0000000000 --- a/CraftBukkit-Patches/0070-Fix-dispensing-bone-meal-not-having-the-correct-data.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 3fec87491b69ba4cc3faaad819eb9c2fb9546836 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Thu, 6 Feb 2014 21:59:20 +0000 -Subject: [PATCH] Fix dispensing bone meal not having the correct data value - - -diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java -index f2dc326..d7bea3d 100644 ---- a/src/main/java/net/minecraft/server/DispenserRegistry.java -+++ b/src/main/java/net/minecraft/server/DispenserRegistry.java -@@ -442,7 +442,7 @@ public class DispenserRegistry { - - // CraftBukkit start - org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -- CraftItemStack craftItem = CraftItemStack.asNewCraftStack(itemstack.getItem()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); // Spigot - - BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); - if (!BlockDispenser.eventFired) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0071-Spam-Filter-Exclusions.patch b/CraftBukkit-Patches/0071-Spam-Filter-Exclusions.patch deleted file mode 100644 index a3ec1270f7..0000000000 --- a/CraftBukkit-Patches/0071-Spam-Filter-Exclusions.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c49550fac45c61befb2d68423285985a6884018f Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 8 Feb 2014 08:13:40 +0000 -Subject: [PATCH] Spam Filter Exclusions - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 24c2a88..a107029 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1190,9 +1190,20 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - this.minecraftServer.getPlayerList().sendMessage(chatmessage1, false); - } - -+ // Spigot start - spam exclusions -+ boolean counted = true; -+ for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions ) -+ { -+ if ( exclude != null && s.startsWith( exclude ) ) -+ { -+ counted = false; -+ break; -+ } -+ } -+ // Spigot end - // CraftBukkit start - replaced with thread safe throttle - // this.chatThrottle += 20; -- if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { -+ if (counted && chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { // Spigot - if (!isSync) { - Waitable waitable = new Waitable() { - @Override -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 83e575f..a0a59bb 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -6,6 +6,7 @@ import java.io.IOException; - import java.lang.reflect.InvocationTargetException; - import java.lang.reflect.Method; - import java.lang.reflect.Modifier; -+import java.util.Arrays; - import java.util.HashMap; - import java.util.List; - import java.util.Map; -@@ -280,4 +281,13 @@ public class SpigotConfig - { - playerShuffle = getInt( "settings.player-shuffle", 0 ); - } -+ -+ public static List spamExclusions; -+ private static void spamExclusions() -+ { -+ spamExclusions = getList( "commands.spam-exclusions", Arrays.asList( new String[] -+ { -+ "/skill" -+ } ) ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0072-Add-Option-to-Silence-CommandBlock-Console.patch b/CraftBukkit-Patches/0072-Add-Option-to-Silence-CommandBlock-Console.patch deleted file mode 100644 index 4603f82926..0000000000 --- a/CraftBukkit-Patches/0072-Add-Option-to-Silence-CommandBlock-Console.patch +++ /dev/null @@ -1,37 +0,0 @@ -From fac5dc144febec9c664316b79aa4799592888a93 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 9 Feb 2014 14:39:01 +1100 -Subject: [PATCH] Add Option to Silence CommandBlock Console - - -diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java -index 3e4a31b..0304aa0 100644 ---- a/src/main/java/net/minecraft/server/CommandDispatcher.java -+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java -@@ -103,7 +103,7 @@ public class CommandDispatcher extends CommandHandler implements ICommandDispatc - } - } - -- if (icommandlistener != minecraftserver && minecraftserver.worldServer[0].getGameRules().getBoolean("logAdminCommands")) { -+ if (icommandlistener != minecraftserver && minecraftserver.worldServer[0].getGameRules().getBoolean("logAdminCommands") && !org.spigotmc.SpigotConfig.silentCommandBlocks) { // Spigot - minecraftserver.sendMessage(chatmessage); - } - -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index a0a59bb..039777a 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -290,4 +290,10 @@ public class SpigotConfig - "/skill" - } ) ); - } -+ -+ public static boolean silentCommandBlocks; -+ private static void silentCommandBlocks() -+ { -+ silentCommandBlocks = getBoolean( "commands.silent-commandblock-console", false ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0073-Add-support-for-fetching-hidden-players.patch b/CraftBukkit-Patches/0073-Add-support-for-fetching-hidden-players.patch deleted file mode 100644 index 5532b4de61..0000000000 --- a/CraftBukkit-Patches/0073-Add-support-for-fetching-hidden-players.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 42830031dfc5b195e41d63fc7a07b36a0805af2a Mon Sep 17 00:00:00 2001 -From: Tux -Date: Sun, 9 Feb 2014 14:03:03 -0500 -Subject: [PATCH] Add support for fetching hidden players - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 8307458..a725cf6 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1496,6 +1496,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - { - return getHandle().locale; - } -+ -+ @Override -+ public Set getHiddenPlayers() -+ { -+ Set ret = new HashSet(); -+ for ( UUID u : hiddenPlayers ) -+ { -+ ret.add( getServer().getPlayer( u ) ); -+ } -+ -+ return java.util.Collections.unmodifiableSet( ret ); -+ } - }; - - public Player.Spigot spigot() --- -2.5.0 - diff --git a/CraftBukkit-Patches/0074-Allow-Disabling-Creative-Item-Filter.patch b/CraftBukkit-Patches/0074-Allow-Disabling-Creative-Item-Filter.patch deleted file mode 100644 index d3fcfd1a6b..0000000000 --- a/CraftBukkit-Patches/0074-Allow-Disabling-Creative-Item-Filter.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 45f4fa5d08d2d7709d73c12d3a6a89ab82e6ce04 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 12 Feb 2014 18:18:01 +1100 -Subject: [PATCH] Allow Disabling Creative Item Filter - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index a107029..2515ee7 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1952,7 +1952,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - - boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45; - // CraftBukkit - Add invalidItems check -- boolean flag2 = itemstack == null || itemstack.getItem() != null && !invalidItems.contains(Item.getId(itemstack.getItem())); -+ boolean flag2 = itemstack == null || itemstack.getItem() != null && (!invalidItems.contains(Item.getId(itemstack.getItem())) || !org.spigotmc.SpigotConfig.filterCreativeItems); // Spigot - boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0; - // CraftBukkit start - Call click event - if (flag || (flag1 && !ItemStack.matches(this.player.defaultContainer.getSlot(packetplayinsetcreativeslot.a()).getItem(), packetplayinsetcreativeslot.getItemStack()))) { // Insist on valid slot -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 039777a..686b8bd 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -296,4 +296,10 @@ public class SpigotConfig - { - silentCommandBlocks = getBoolean( "commands.silent-commandblock-console", false ); - } -+ -+ public static boolean filterCreativeItems; -+ private static void filterCreativeItems() -+ { -+ filterCreativeItems = getBoolean( "settings.filter-creative-items", true ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0075-Cap-Channel-Registrations.patch b/CraftBukkit-Patches/0075-Cap-Channel-Registrations.patch deleted file mode 100644 index 16b30936e4..0000000000 --- a/CraftBukkit-Patches/0075-Cap-Channel-Registrations.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 8b992f8c14428b6cf9f074c284f561fdf6f8315b Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 12 Feb 2014 20:02:58 +1100 -Subject: [PATCH] Cap Channel Registrations - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a725cf6..92e14d4 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1054,6 +1054,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } - - public void addChannel(String channel) { -+ com.google.common.base.Preconditions.checkState( channels.size() < 128, "Too many channels registered" ); // Spigot - if (channels.add(channel)) { - server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel)); - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0076-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch b/CraftBukkit-Patches/0076-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch deleted file mode 100644 index 3fc7bc0714..0000000000 --- a/CraftBukkit-Patches/0076-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch +++ /dev/null @@ -1,80 +0,0 @@ -From d9b1b2946e2c2db031144ba4dc96b5e06f297b79 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Wed, 12 Feb 2014 20:44:14 +0000 -Subject: [PATCH] Allow vanilla commands to be the main version of a command - - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1a5f14d..940fdd2 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -322,8 +322,11 @@ public final class CraftServer implements Server { - } - - if (type == PluginLoadOrder.POSTWORLD) { -+ // Spigot start - Allow vanilla commands to be forced to be the main command -+ setVanillaCommands(true); - commandMap.setFallbackCommands(); -- setVanillaCommands(); -+ setVanillaCommands(false); -+ // Spigot end - commandMap.registerServerAliases(); - loadCustomPermissions(); - DefaultPermissions.registerCorePermissions(); -@@ -336,10 +339,19 @@ public final class CraftServer implements Server { - pluginManager.disablePlugins(); - } - -- private void setVanillaCommands() { -+ private void setVanillaCommands(boolean first) { // Spigot - Map commands = new CommandDispatcher(console).getCommands(); - for (ICommand cmd : commands.values()) { -- commandMap.register("minecraft", new VanillaCommandWrapper((CommandAbstract) cmd, LocaleI18n.get(cmd.getUsage(null)))); -+ // Spigot start -+ VanillaCommandWrapper wrapper = new VanillaCommandWrapper((CommandAbstract) cmd, LocaleI18n.get(cmd.getUsage(null))); -+ if (org.spigotmc.SpigotConfig.replaceCommands.contains( wrapper.getName() ) ) { -+ if (first) { -+ commandMap.register("minecraft", wrapper); -+ } -+ } else if (!first) { -+ commandMap.register("minecraft", wrapper); -+ } -+ // Spigot end - } - } - -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 686b8bd..3a8734f 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -8,8 +8,10 @@ import java.lang.reflect.Method; - import java.lang.reflect.Modifier; - import java.util.Arrays; - import java.util.HashMap; -+import java.util.HashSet; - import java.util.List; - import java.util.Map; -+import java.util.Set; - import java.util.logging.Level; - import gnu.trove.map.hash.TObjectIntHashMap; - import net.minecraft.server.MinecraftServer; -@@ -302,4 +304,16 @@ public class SpigotConfig - { - filterCreativeItems = getBoolean( "settings.filter-creative-items", true ); - } -+ -+ public static Set replaceCommands; -+ private static void replaceCommands() -+ { -+ if ( config.contains( "replace-commands" ) ) -+ { -+ set( "commands.replace-commands", config.getStringList( "replace-commands" ) ); -+ config.set( "replace-commands", null ); -+ } -+ replaceCommands = new HashSet( (List) getList( "commands.replace-commands", -+ Arrays.asList( "setblock", "summon", "testforblock", "tellraw" ) ) ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0077-Implement-Silenceable-Lightning-API.patch b/CraftBukkit-Patches/0077-Implement-Silenceable-Lightning-API.patch deleted file mode 100644 index 53221b30ff..0000000000 --- a/CraftBukkit-Patches/0077-Implement-Silenceable-Lightning-API.patch +++ /dev/null @@ -1,87 +0,0 @@ -From e52c5ab7c27d3bb054750dc1d07ca6bca864db9d Mon Sep 17 00:00:00 2001 -From: drXor -Date: Sun, 23 Feb 2014 16:16:59 -0400 -Subject: [PATCH] Implement Silenceable Lightning API - - -diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java -index 35a0bdc..e507302 100644 ---- a/src/main/java/net/minecraft/server/EntityLightning.java -+++ b/src/main/java/net/minecraft/server/EntityLightning.java -@@ -11,6 +11,7 @@ public class EntityLightning extends EntityWeather { - private int c; - private final boolean d; - public boolean isEffect; // CraftBukkit -+ public boolean isSilent = false; // Spigot - - public EntityLightning(World world, double d0, double d1, double d2, boolean flag) { - super(world); -@@ -46,13 +47,21 @@ public class EntityLightning extends EntityWeather { - - } - -+ // Spigot start -+ public EntityLightning(World world, double d0, double d1, double d2, boolean isEffect, boolean isSilent) -+ { -+ this( world, d0, d1, d2, isEffect ); -+ this.isSilent = isSilent; -+ } -+ // Spigot end -+ - public SoundCategory bz() { - return SoundCategory.WEATHER; - } - - public void m() { - super.m(); -- if (this.lifeTicks == 2) { -+ if (!isSilent && this.lifeTicks == 2) { // Spigot - // CraftBukkit start - Use relative location for far away sounds - // this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dc, SoundCategory.d, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); - float pitch = 0.8F + this.random.nextFloat() * 0.2F; -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index bb0268e..80be0b1 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1575,6 +1575,22 @@ public class CraftWorld implements World { - { - CraftWorld.this.playEffect( location, effect, 0 ); - } -+ -+ @Override -+ public LightningStrike strikeLightning(Location loc, boolean isSilent) -+ { -+ EntityLightning lightning = new EntityLightning( world, loc.getX(), loc.getY(), loc.getZ(), false, isSilent ); -+ world.strikeLightning( lightning ); -+ return new CraftLightningStrike( server, lightning ); -+ } -+ -+ @Override -+ public LightningStrike strikeLightningEffect(Location loc, boolean isSilent) -+ { -+ EntityLightning lightning = new EntityLightning( world, loc.getX(), loc.getY(), loc.getZ(), true, isSilent ); -+ world.strikeLightning( lightning ); -+ return new CraftLightningStrike( server, lightning ); -+ } - }; - - public Spigot spigot() -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java -index 243e8e5..0bacc83 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java -@@ -31,6 +31,11 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike - // Spigot start - private final LightningStrike.Spigot spigot = new LightningStrike.Spigot() { - -+ @Override -+ public boolean isSilent() -+ { -+ return getHandle().isSilent; -+ } - }; - - @Override --- -2.5.0 - diff --git a/CraftBukkit-Patches/0078-Use-one-PermissibleBase-for-all-Command-Blocks.patch b/CraftBukkit-Patches/0078-Use-one-PermissibleBase-for-all-Command-Blocks.patch deleted file mode 100644 index 569107cdd6..0000000000 --- a/CraftBukkit-Patches/0078-Use-one-PermissibleBase-for-all-Command-Blocks.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e2edc5504ae83e934ac0df17db00f7d0b589def7 Mon Sep 17 00:00:00 2001 -From: FrozenBrain -Date: Sun, 2 Mar 2014 21:13:46 +0100 -Subject: [PATCH] Use one PermissibleBase for all Command Blocks - - -diff --git a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java -index 1314c74..b339cf3 100644 ---- a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java -+++ b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java -@@ -12,9 +12,18 @@ import org.bukkit.plugin.Plugin; - import java.util.Set; - - public abstract class ServerCommandSender implements CommandSender { -- private final PermissibleBase perm = new PermissibleBase(this); -+ private static PermissibleBase blockPermInst; -+ private final PermissibleBase perm; - - public ServerCommandSender() { -+ if (this instanceof CraftBlockCommandSender) { -+ if (blockPermInst == null) { -+ blockPermInst = new PermissibleBase(this); -+ } -+ this.perm = blockPermInst; -+ } else { -+ this.perm = new PermissibleBase(this); -+ } - } - - public boolean isPermissionSet(String name) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0079-Prevent-hoppers-from-loading-chunks.patch b/CraftBukkit-Patches/0079-Prevent-hoppers-from-loading-chunks.patch deleted file mode 100644 index d98c0f5306..0000000000 --- a/CraftBukkit-Patches/0079-Prevent-hoppers-from-loading-chunks.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 5422f5ffcbf36b7d2857dfcb23bdd1831db29f92 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Wed, 5 Mar 2014 20:27:27 +0000 -Subject: [PATCH] Prevent hoppers from loading chunks - - -diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index c01acb9..4cd2caa 100644 ---- a/src/main/java/net/minecraft/server/TileEntityHopper.java -+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -529,6 +529,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - int j = MathHelper.floor(d1); - int k = MathHelper.floor(d2); - BlockPosition blockposition = new BlockPosition(i, j, k); -+ if ( !world.isLoaded( blockposition ) ) return null; // Spigot - Block block = world.getType(blockposition).getBlock(); - - if (block.isTileEntity()) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0080-Guard-Entity-List.patch b/CraftBukkit-Patches/0080-Guard-Entity-List.patch deleted file mode 100644 index 506b9d937b..0000000000 --- a/CraftBukkit-Patches/0080-Guard-Entity-List.patch +++ /dev/null @@ -1,79 +0,0 @@ -From cc904e78d6ac8ef143d1b4adacc5b7058af19f72 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 10 Mar 2014 09:03:28 +1100 -Subject: [PATCH] Guard Entity List - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index e09ddf7..d9da020 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -33,7 +33,32 @@ public abstract class World implements IBlockAccess { - - private int a = 63; - protected boolean d; -- public final List entityList = Lists.newArrayList(); -+ // Spigot start - guard entity list from removals -+ public final List entityList = new java.util.ArrayList() -+ { -+ @Override -+ public Entity remove(int index) -+ { -+ guard(); -+ return super.remove( index ); -+ } -+ -+ @Override -+ public boolean remove(Object o) -+ { -+ guard(); -+ return super.remove( o ); -+ } -+ -+ private void guard() -+ { -+ if ( guardEntityList ) -+ { -+ throw new java.util.ConcurrentModificationException(); -+ } -+ } -+ }; -+ // Spigot end - protected final List f = Lists.newArrayList(); - public final List tileEntityList = Lists.newArrayList(); - public final List tileEntityListTick = Lists.newArrayList(); -@@ -101,6 +126,7 @@ public abstract class World implements IBlockAccess { - public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot - - public final SpigotTimings.WorldTimingsHandler timings; // Spigot -+ private boolean guardEntityList; // Spigot - - public CraftWorld getWorld() { - return this.world; -@@ -1338,6 +1364,7 @@ public abstract class World implements IBlockAccess { - - org.spigotmc.ActivationRange.activateEntities(this); // Spigot - timings.entityTick.startTiming(); // Spigot -+ guardEntityList = true; // Spigot - // CraftBukkit start - Use field for loop variable - for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) { - entity = (Entity) this.entityList.get(this.tickPosition); -@@ -1376,12 +1403,15 @@ public abstract class World implements IBlockAccess { - this.getChunkAt(j, l).b(entity); - } - -+ guardEntityList = false; // Spigot - this.entityList.remove(this.tickPosition--); // CraftBukkit - Use field for loop variable -+ guardEntityList = true; // Spigot - this.c(entity); - } - - this.methodProfiler.b(); - } -+ guardEntityList = false; // Spigot - - timings.entityTick.stopTiming(); // Spigot - this.methodProfiler.c("blockEntities"); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0081-Fix-ConcurrentModificationException-while-being-idle.patch b/CraftBukkit-Patches/0081-Fix-ConcurrentModificationException-while-being-idle.patch deleted file mode 100644 index 70d0b0ef33..0000000000 --- a/CraftBukkit-Patches/0081-Fix-ConcurrentModificationException-while-being-idle.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 660e6ebd7b74506ecaf13fbbfe38eebf7fafa49c Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Tue, 14 Jan 2014 20:11:25 +0000 -Subject: [PATCH] Fix ConcurrentModificationException while being idle kicked - in a vehicle - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d9da020..7765812 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1,4 +1,4 @@ --package net.minecraft.server; -+ package net.minecraft.server; - - import com.google.common.base.Function; - import com.google.common.base.Objects; -@@ -1042,6 +1042,7 @@ public abstract class World implements IBlockAccess { - this.everyoneSleeping(); - } - -+ if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking - int i = entity.ab; - int j = entity.ad; - -@@ -1058,6 +1059,7 @@ public abstract class World implements IBlockAccess { - this.entityList.remove(index); - } - // CraftBukkit end -+ } // Spigot - this.c(entity); - } - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0082-Cancellable-WitherSkull-potion-effect.patch b/CraftBukkit-Patches/0082-Cancellable-WitherSkull-potion-effect.patch deleted file mode 100644 index 294553d6e6..0000000000 --- a/CraftBukkit-Patches/0082-Cancellable-WitherSkull-potion-effect.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 9d8a4d8b4809e707fe190917ba287f66d040cb01 Mon Sep 17 00:00:00 2001 -From: drXor -Date: Tue, 25 Feb 2014 15:15:26 -0400 -Subject: [PATCH] Cancellable WitherSkull potion effect - - -diff --git a/src/main/java/net/minecraft/server/EntityWitherSkull.java b/src/main/java/net/minecraft/server/EntityWitherSkull.java -index 1080b00..edac23d 100644 ---- a/src/main/java/net/minecraft/server/EntityWitherSkull.java -+++ b/src/main/java/net/minecraft/server/EntityWitherSkull.java -@@ -38,8 +38,11 @@ public class EntityWitherSkull extends EntityFireball { - protected void a(MovingObjectPosition movingobjectposition) { - if (!this.world.isClientSide) { - if (movingobjectposition.entity != null) { -+ // Spigot start -+ boolean didDamage = false; - if (this.shooter != null) { -- if (movingobjectposition.entity.damageEntity(DamageSource.projectile(this, shooter), 8.0F)) { // CraftBukkit -+ didDamage = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, shooter), 8.0F); -+ if (didDamage) { - if (!movingobjectposition.entity.isAlive()) { - this.shooter.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit - } else { -@@ -47,10 +50,11 @@ public class EntityWitherSkull extends EntityFireball { - } - } - } else { -- movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5.0F); -+ didDamage = movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5.0F); - } - -- if (movingobjectposition.entity instanceof EntityLiving) { -+ if (didDamage && movingobjectposition.entity instanceof EntityLiving) { -+ // Spigot end - byte b0 = 0; - - if (this.world.getDifficulty() == EnumDifficulty.NORMAL) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0083-Descriptive-kick-reasons-instead-of-Nope.patch b/CraftBukkit-Patches/0083-Descriptive-kick-reasons-instead-of-Nope.patch deleted file mode 100644 index c9dde449d0..0000000000 --- a/CraftBukkit-Patches/0083-Descriptive-kick-reasons-instead-of-Nope.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 609be2ed65f9c2aed5a721299eb0250292510ea6 Mon Sep 17 00:00:00 2001 -From: drXor -Date: Sat, 15 Mar 2014 01:30:05 -0400 -Subject: [PATCH] Descriptive kick reasons instead of Nope! - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index c982151..4c55974 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -258,7 +258,7 @@ public abstract class Entity implements ICommandListener { - if (f == Float.POSITIVE_INFINITY || f == Float.NEGATIVE_INFINITY) { - if (this instanceof EntityPlayer) { - this.world.getServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid yaw"); -- ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope"); -+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite yaw (Hacking?)"); //Spigot "Nope" -> Descriptive reason - } - f = 0; - } -@@ -271,7 +271,7 @@ public abstract class Entity implements ICommandListener { - if (f1 == Float.POSITIVE_INFINITY || f1 == Float.NEGATIVE_INFINITY) { - if (this instanceof EntityPlayer) { - this.world.getServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid pitch"); -- ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope"); -+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite pitch (Hacking?)"); //Spigot "Nope" -> Descriptive reason - } - f1 = 0; - } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 2515ee7..2a04f15 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1113,7 +1113,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - this.player.resetIdleTimer(); - } else { - PlayerConnection.LOGGER.warn(this.player.getName() + " tried to set an invalid carried item"); -- this.disconnect("Nope!"); // CraftBukkit -+ this.disconnect("Invalid hotbar selection (Hacking?)"); // CraftBukkit //Spigot "Nope" -> Descriptive reason - } - } - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0084-Configurable-dragon-death-and-wither-spawn-sounds.patch b/CraftBukkit-Patches/0084-Configurable-dragon-death-and-wither-spawn-sounds.patch deleted file mode 100644 index 2d94d005f6..0000000000 --- a/CraftBukkit-Patches/0084-Configurable-dragon-death-and-wither-spawn-sounds.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 833a65221a2d1c60819b0771834ba21e522f3875 Mon Sep 17 00:00:00 2001 -From: drXor -Date: Sat, 29 Mar 2014 13:44:25 -0400 -Subject: [PATCH] Configurable dragon death and wither spawn sounds - - -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 737e463..b733df6 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -552,7 +552,24 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo - } - - if (this.bF == 1) { -- this.world.a(1028, new BlockPosition(this), 0); -+ // CraftBukkit start - Use relative location for far away sounds -+ // this.world.a(1028, new BlockPosition(this), 0); -+ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; -+ for (EntityPlayer player : (List) MinecraftServer.getServer().getPlayerList().players) { -+ double deltaX = this.locX - player.locX; -+ double deltaZ = this.locZ - player.locZ; -+ double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -+ if ( world.spigotConfig.dragonDeathSoundRadius > 0 && distanceSquared > world.spigotConfig.dragonDeathSoundRadius * world.spigotConfig.dragonDeathSoundRadius ) continue; // Spigot -+ if (distanceSquared > viewDistance * viewDistance) { -+ double deltaLength = Math.sqrt(distanceSquared); -+ double relativeX = player.locX + (deltaX / deltaLength) * viewDistance; -+ double relativeZ = player.locZ + (deltaZ / deltaLength) * viewDistance; -+ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1028, new BlockPosition((int) relativeX, (int) this.locY, (int) relativeZ), 0, true)); -+ } else { -+ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1028, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0, true)); -+ } -+ } -+ // CraftBukkit end - } - } - -diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java -index 76b6718..6b4dbb8 100644 ---- a/src/main/java/net/minecraft/server/EntityWither.java -+++ b/src/main/java/net/minecraft/server/EntityWither.java -@@ -202,6 +202,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity { - double deltaX = this.locX - player.locX; - double deltaZ = this.locZ - player.locZ; - double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -+ if ( world.spigotConfig.witherSpawnSoundRadius > 0 && distanceSquared > world.spigotConfig.witherSpawnSoundRadius * world.spigotConfig.witherSpawnSoundRadius ) continue; // Spigot - if (distanceSquared > viewDistance * viewDistance) { - double deltaLength = Math.sqrt(distanceSquared); - double relativeX = player.locX + (deltaX / deltaLength) * viewDistance; -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 19525eb..79a3124 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -231,4 +231,16 @@ public class SpigotWorldConfig - maxCollisionsPerEntity = getInt( "max-entity-collisions", 8 ); - log( "Max Entity Collisions: " + maxCollisionsPerEntity ); - } -+ -+ public int dragonDeathSoundRadius; -+ private void keepDragonDeathPerWorld() -+ { -+ dragonDeathSoundRadius = getInt( "dragon-death-sound-radius", 0 ); -+ } -+ -+ public int witherSpawnSoundRadius; -+ private void witherSpawnSoundRadius() -+ { -+ witherSpawnSoundRadius = getInt( "wither-spawn-sound-radius", 0 ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0085-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch b/CraftBukkit-Patches/0085-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch deleted file mode 100644 index c393580c92..0000000000 --- a/CraftBukkit-Patches/0085-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 18dd2fd41de7ddd765a1790af7cc55f8e34c3f4d Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Fri, 11 Apr 2014 11:16:34 +0100 -Subject: [PATCH] Display 'Spigot' in client crashes, server lists and Mojang - stats - - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 49e5aac..f550dff 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1013,7 +1013,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - } - - public String getServerModName() { -- return server.getName(); // CraftBukkit - cb > vanilla! -+ return "Spigot"; // Spigot - Spigot > // CraftBukkit - cb > vanilla! - } - - public CrashReport b(CrashReport crashreport) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0086-Treat-Bungee-as-Online-Mode.patch b/CraftBukkit-Patches/0086-Treat-Bungee-as-Online-Mode.patch deleted file mode 100644 index 7410b7123f..0000000000 --- a/CraftBukkit-Patches/0086-Treat-Bungee-as-Online-Mode.patch +++ /dev/null @@ -1,42 +0,0 @@ -From b9e8445f12f22f9d89a9266912d67a9d7a1e4e47 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 12 Apr 2014 21:23:58 +1000 -Subject: [PATCH] Treat Bungee as Online Mode - - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index d6a01a9..6b560b0 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -196,7 +196,14 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - if (!this.getOnlineMode()) { - DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); - DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware."); -- DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose."); -+ // Spigot start -+ if (org.spigotmc.SpigotConfig.bungee) { -+ DedicatedServer.LOGGER.warn("Whilst this makes it possible to use BungeeCord, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose."); -+ DedicatedServer.LOGGER.warn("Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information."); -+ } else { -+ DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose."); -+ } -+ // Spigot end - DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file."); - } - -diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -index b08d5d5..c527b3f 100644 ---- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -@@ -63,7 +63,7 @@ public class NameReferencingFileConverter { - } - }), String.class); - -- if (minecraftserver.getOnlineMode()) { -+ if (minecraftserver.getOnlineMode() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now. - minecraftserver.getGameProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, profilelookupcallback); - } else { - String[] astring1 = astring; --- -2.5.0 - diff --git a/CraftBukkit-Patches/0087-Add-Conversion-Message.patch b/CraftBukkit-Patches/0087-Add-Conversion-Message.patch deleted file mode 100644 index 6ef89ceb72..0000000000 --- a/CraftBukkit-Patches/0087-Add-Conversion-Message.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 4061f5031a14d656a89a50143c95057cc7eff15e Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 12 Apr 2014 23:30:44 +1000 -Subject: [PATCH] Add Conversion Message - - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 7a788d9..cf55b4d 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -562,6 +562,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - } - - protected boolean aO() { -+ server.getLogger().info( "**** Beginning UUID conversion, this may take A LONG time ****"); // Spigot, let the user know whats up! - boolean flag = false; - - int i; --- -2.5.0 - diff --git a/CraftBukkit-Patches/0088-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch b/CraftBukkit-Patches/0088-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch deleted file mode 100644 index 212d3c7a25..0000000000 --- a/CraftBukkit-Patches/0088-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 53a7065d5efcc84f18359165baf714339760f67e Mon Sep 17 00:00:00 2001 -From: "gjmcferrin@gmail.com" -Date: Mon, 10 Feb 2014 10:05:11 -0500 -Subject: [PATCH] Properly cancel fishing event. Fixes BUKKIT-5396 - -Previously, when cancelling a PlayerFishEvent with State.FISHING, the next -fishing attempt would automatically result in a new PlayerFishEvent with -State.FAILED_ATTEMPT because the player's hooked entity was not properly -cleared. This ensures that the player's hooked entity value is set to null so -that the next attempt will result in the proper state being called. - -diff --git a/src/main/java/net/minecraft/server/ItemFishingRod.java b/src/main/java/net/minecraft/server/ItemFishingRod.java -index 19f5f03..1a40b95 100644 ---- a/src/main/java/net/minecraft/server/ItemFishingRod.java -+++ b/src/main/java/net/minecraft/server/ItemFishingRod.java -@@ -25,6 +25,7 @@ public class ItemFishingRod extends Item { - world.getServer().getPluginManager().callEvent(playerFishEvent); - - if (playerFishEvent.isCancelled()) { -+ entityhuman.hookedFish = null; - return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack); - } - // CraftBukkit end --- -2.5.0 - diff --git a/CraftBukkit-Patches/0089-Print-Stack-on-InternalException.patch b/CraftBukkit-Patches/0089-Print-Stack-on-InternalException.patch deleted file mode 100644 index a2c00d0f5f..0000000000 --- a/CraftBukkit-Patches/0089-Print-Stack-on-InternalException.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 4c7bf255c8c29256c86098aeff0a46c6d223032b Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 13 Apr 2014 09:00:59 +1000 -Subject: [PATCH] Print Stack on InternalException - - -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index c3ff6c2..c6f9955 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -112,6 +112,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - - NetworkManager.g.debug(throwable); - this.close(chatmessage); -+ if (MinecraftServer.getServer().isDebugging()) throwable.printStackTrace(); // Spigot - } - - protected void a(ChannelHandlerContext channelhandlercontext, Packet packet) throws Exception { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0090-Use-Offline-Player-Data-Once-if-Required.patch b/CraftBukkit-Patches/0090-Use-Offline-Player-Data-Once-if-Required.patch deleted file mode 100644 index b4a10f4d0d..0000000000 --- a/CraftBukkit-Patches/0090-Use-Offline-Player-Data-Once-if-Required.patch +++ /dev/null @@ -1,43 +0,0 @@ -From c0f8bb52a9cd63f07574e4a35d7ac05f5935eb32 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 13 Apr 2014 14:41:23 +1000 -Subject: [PATCH] Use Offline Player Data Once if Required. - -If we are online mode and the only copy of player data we can find is the player's offline mode data, we will attempt a once off conversion by reading this data and then renaming the file so it won't be used again. - -diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index fb08743..81e8bdb 100644 ---- a/src/main/java/net/minecraft/server/WorldNBTStorage.java -+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -164,10 +164,28 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - - try { - File file = new File(this.playerDir, entityhuman.getUniqueID().toString() + ".dat"); -+ // Spigot Start -+ boolean usingWrongFile = false; -+ if ( !file.exists() ) -+ { -+ file = new File( this.playerDir, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat"); -+ if ( file.exists() ) -+ { -+ usingWrongFile = true; -+ org.bukkit.Bukkit.getServer().getLogger().warning( "Using offline mode UUID file for player " + entityhuman.getName() + " as it is the only copy we can find." ); -+ } -+ } -+ // Spigot End - - if (file.exists() && file.isFile()) { - nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file))); - } -+ // Spigot Start -+ if ( usingWrongFile ) -+ { -+ file.renameTo( new File( file.getPath() + ".offline-read" ) ); -+ } -+ // Spigot End - } catch (Exception exception) { - WorldNBTStorage.b.warn("Failed to load player data for " + entityhuman.getName()); - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0091-Use-Provided-Case-for-Non-Existent-Offline-Players.patch b/CraftBukkit-Patches/0091-Use-Provided-Case-for-Non-Existent-Offline-Players.patch deleted file mode 100644 index db4fe2ce63..0000000000 --- a/CraftBukkit-Patches/0091-Use-Provided-Case-for-Non-Existent-Offline-Players.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 9dd60ebc834af9cfe3089a1252cf4da72a30f3b2 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 14 Apr 2014 09:46:20 +1000 -Subject: [PATCH] Use Provided Case for Non Existent Offline Players - - -diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index 4d00614..bbe6e69 100644 ---- a/src/main/java/net/minecraft/server/UserCache.java -+++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -152,7 +152,7 @@ public class UserCache { - this.f.remove(gameprofile); - this.f.addFirst(gameprofile); - } else { -- gameprofile = a(this.g, s1); -+ gameprofile = a(this.g, s); // Spigot - use correct case for offline players - if (gameprofile != null) { - this.a(gameprofile); - usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(s1); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0092-Check-for-blank-OfflinePlayer-Names.patch b/CraftBukkit-Patches/0092-Check-for-blank-OfflinePlayer-Names.patch deleted file mode 100644 index dee45f37a0..0000000000 --- a/CraftBukkit-Patches/0092-Check-for-blank-OfflinePlayer-Names.patch +++ /dev/null @@ -1,21 +0,0 @@ -From acffc6ce7a15167908463edcf538e2b8073a069e Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 14 Apr 2014 17:21:24 +1000 -Subject: [PATCH] Check for blank OfflinePlayer Names - - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 940fdd2..7404ced 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1292,6 +1292,7 @@ public final class CraftServer implements Server { - @Deprecated - public OfflinePlayer getOfflinePlayer(String name) { - Validate.notNull(name, "Name cannot be null"); -+ com.google.common.base.Preconditions.checkArgument( !org.apache.commons.lang.StringUtils.isBlank( name ), "Name cannot be blank" ); // Spigot - - // If the name given cannot ever be a valid username give a dummy return, for scoreboard plugins - if (!validUserPattern.matcher(name).matches()) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0093-Fix-Player-Banning.patch b/CraftBukkit-Patches/0093-Fix-Player-Banning.patch deleted file mode 100644 index 6ed4275b49..0000000000 --- a/CraftBukkit-Patches/0093-Fix-Player-Banning.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 2e56c863ba5d4ae0afee8be802e7b05ee8108458 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 15 Apr 2014 10:32:48 +1000 -Subject: [PATCH] Fix Player Banning - -This issue stems from the fact that Bukkit's API only allows a UUID to be banned, but Minecraft requires both a UUID and name. To fix this we modify the code to require a UUID or a name, or both. The correct fix would be expanding the API to be able to provide a name, however this would require plugin changes. - -diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -index 27ce9d9..e68d2b3 100644 ---- a/src/main/java/net/minecraft/server/GameProfileBanEntry.java -+++ b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -@@ -28,20 +28,29 @@ public class GameProfileBanEntry extends ExpirableListEntry { - } - - private static GameProfile b(JsonObject jsonobject) { -- if (jsonobject.has("uuid") && jsonobject.has("name")) { -+ // Spigot start -+ // this whole method has to be reworked to account for the fact Bukkit only accepts UUID bans and gives no way for usernames to be stored! -+ UUID uuid = null; -+ String name = null; -+ if (jsonobject.has("uuid")) { - String s = jsonobject.get("uuid").getAsString(); - -- UUID uuid; -- - try { - uuid = UUID.fromString(s); - } catch (Throwable throwable) { -- return null; - } - -- return new GameProfile(uuid, jsonobject.get("name").getAsString()); -+ } -+ if ( jsonobject.has("name")) -+ { -+ name = jsonobject.get("name").getAsString(); -+ } -+ if ( uuid != null || name != null ) -+ { -+ return new GameProfile( uuid, name ); - } else { - return null; - } -+ // Spigot End - } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0094-Fix-ban-expire-dates.patch b/CraftBukkit-Patches/0094-Fix-ban-expire-dates.patch deleted file mode 100644 index 5c4b8734af..0000000000 --- a/CraftBukkit-Patches/0094-Fix-ban-expire-dates.patch +++ /dev/null @@ -1,22 +0,0 @@ -From ab7167cc5c00b7e8eb77568b2dd2a2e27a2d1da0 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 16 Apr 2014 10:09:56 +1000 -Subject: [PATCH] Fix ban expire dates. - - -diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -index e68d2b3..16fe481 100644 ---- a/src/main/java/net/minecraft/server/GameProfileBanEntry.java -+++ b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -@@ -12,7 +12,7 @@ public class GameProfileBanEntry extends ExpirableListEntry { - } - - public GameProfileBanEntry(GameProfile gameprofile, Date date, String s, Date date1, String s1) { -- super(gameprofile, date1, s, date1, s1); -+ super(gameprofile, date, s, date1, s1); // Spigot - } - - public GameProfileBanEntry(JsonObject jsonobject) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0095-Correct-Ban-Expiration.patch b/CraftBukkit-Patches/0095-Correct-Ban-Expiration.patch deleted file mode 100644 index 363bdbc8ed..0000000000 --- a/CraftBukkit-Patches/0095-Correct-Ban-Expiration.patch +++ /dev/null @@ -1,22 +0,0 @@ -From fc1275c9257b95dda24800955fdf1ebeffbaadac Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 16 Apr 2014 11:14:38 +1000 -Subject: [PATCH] Correct Ban Expiration - - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index eb9375d..9f0842c 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -463,7 +463,7 @@ public abstract class PlayerList { - } - - // return s; -- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s); -+ if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s); // Spigot - } else if (!this.isWhitelisted(gameprofile)) { - // return "You are not white-listed on this server!"; - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot --- -2.5.0 - diff --git a/CraftBukkit-Patches/0096-Convert-Horses-owner-to-UUID.patch b/CraftBukkit-Patches/0096-Convert-Horses-owner-to-UUID.patch deleted file mode 100644 index 0b5447daf7..0000000000 --- a/CraftBukkit-Patches/0096-Convert-Horses-owner-to-UUID.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 2dc192572acf60e2b40c07d744e06475ad6b77f8 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 16 Apr 2014 01:40:30 -0400 -Subject: [PATCH] Convert Horses owner to UUID - - -diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java -index 17a606a..abc7120 100644 ---- a/src/main/java/net/minecraft/server/EntityHorse.java -+++ b/src/main/java/net/minecraft/server/EntityHorse.java -@@ -983,6 +983,17 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener, IJu - s = nbttagcompound.getString("OwnerUUID"); - } else { - String s1 = nbttagcompound.getString("Owner"); -+ // Spigot start -+ if ( s1 == null || s1.isEmpty() ) -+ { -+ if (nbttagcompound.hasKey("OwnerName")) { -+ String owner = nbttagcompound.getString("OwnerName"); -+ if (owner != null && !owner.isEmpty()) { -+ s1 = owner; -+ } -+ } -+ } -+ // Spigot end - - s = NameReferencingFileConverter.a(this.h(), s1); - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0097-Add-Score.isScoreSet-Z-API.patch b/CraftBukkit-Patches/0097-Add-Score.isScoreSet-Z-API.patch deleted file mode 100644 index 3df869fc9e..0000000000 --- a/CraftBukkit-Patches/0097-Add-Score.isScoreSet-Z-API.patch +++ /dev/null @@ -1,25 +0,0 @@ -From fe92dc8144305d266d435a95d21b8fddb40c675a Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 17 Apr 2014 19:35:53 +1000 -Subject: [PATCH] Add Score.isScoreSet()Z API. - -Also fix generics on CraftScore.getScore()I. - -diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java -index 0b71b53..ee9d2ae 100644 ---- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java -+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java -@@ -63,7 +63,9 @@ final class CraftScore implements Score { - // Spigot start - @Override - public boolean isScoreSet() throws IllegalStateException { -- throw new UnsupportedOperationException("Not supported yet."); -+ Scoreboard board = objective.checkState().board; -+ -+ return board.getPlayers().contains(entry) && board.getPlayerObjectives(entry).containsKey(objective.getHandle()); - } - // Spigot end - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0098-Log-null-TileEntity-Owner.patch b/CraftBukkit-Patches/0098-Log-null-TileEntity-Owner.patch deleted file mode 100644 index 26deab902e..0000000000 --- a/CraftBukkit-Patches/0098-Log-null-TileEntity-Owner.patch +++ /dev/null @@ -1,29 +0,0 @@ -From d9f75e38c44bbc65960864ff9d94beb0a97658d6 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 20 Apr 2014 11:16:54 +1000 -Subject: [PATCH] Log null TileEntity Owner - - -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 8bbdc11..e6524e9 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -242,7 +242,14 @@ public abstract class TileEntity { - // CraftBukkit start - add method - public InventoryHolder getOwner() { - if (world == null) return null; -- org.bukkit.block.BlockState state = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState(); -+ // Spigot start -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()); -+ if (block == null) { -+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "No block for owner at %s %d %d %d", new Object[]{world.getWorld(), position.getX(), position.getY(), position.getZ()}); -+ return null; -+ } -+ // Spigot end -+ org.bukkit.block.BlockState state = block.getState(); - if (state instanceof InventoryHolder) return (InventoryHolder) state; - return null; - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0099-Don-t-special-case-invalid-usernames-for-UUIDs.patch b/CraftBukkit-Patches/0099-Don-t-special-case-invalid-usernames-for-UUIDs.patch deleted file mode 100644 index edb5944438..0000000000 --- a/CraftBukkit-Patches/0099-Don-t-special-case-invalid-usernames-for-UUIDs.patch +++ /dev/null @@ -1,25 +0,0 @@ -From bee2a97f30927ae5c4c64cb6748b060fc86102f8 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 20 Apr 2014 18:58:00 +1000 -Subject: [PATCH] Don't special case 'invalid' usernames for UUIDs. - - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7404ced..8900e01 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1294,11 +1294,6 @@ public final class CraftServer implements Server { - Validate.notNull(name, "Name cannot be null"); - com.google.common.base.Preconditions.checkArgument( !org.apache.commons.lang.StringUtils.isBlank( name ), "Name cannot be blank" ); // Spigot - -- // If the name given cannot ever be a valid username give a dummy return, for scoreboard plugins -- if (!validUserPattern.matcher(name).matches()) { -- return new CraftOfflinePlayer(this, new GameProfile(invalidUserUUID, name)); -- } -- - OfflinePlayer result = getPlayerExact(name); - if (result == null) { - // This is potentially blocking :( --- -2.5.0 - diff --git a/CraftBukkit-Patches/0100-Convert-player-skulls-async.patch b/CraftBukkit-Patches/0100-Convert-player-skulls-async.patch deleted file mode 100644 index dbe11f68b2..0000000000 --- a/CraftBukkit-Patches/0100-Convert-player-skulls-async.patch +++ /dev/null @@ -1,236 +0,0 @@ -From 1440b4a8c3469ba7d6f0360235d92b39f8e2b144 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sun, 20 Apr 2014 13:18:55 +0100 -Subject: [PATCH] Convert player skulls async - - -diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java -index 40338ae..2a8c5f0 100644 ---- a/src/main/java/net/minecraft/server/ItemSkull.java -+++ b/src/main/java/net/minecraft/server/ItemSkull.java -@@ -108,13 +108,21 @@ public class ItemSkull extends Item { - return super.a(itemstack); - } - -- public boolean a(NBTTagCompound nbttagcompound) { -+ public boolean a(final NBTTagCompound nbttagcompound) { // Spigot - make final - super.a(nbttagcompound); - if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && !nbttagcompound.getString("SkullOwner").isEmpty()) { - GameProfile gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); - -- gameprofile = TileEntitySkull.b(gameprofile); -- nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile)); -+ // Spigot start -+ TileEntitySkull.b(gameprofile, new com.google.common.base.Predicate() { -+ -+ @Override -+ public boolean apply(GameProfile gameprofile) { -+ nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile)); -+ return false; -+ } -+ }); -+ // Spigot end - return true; - } else { - return false; -diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index 244a424..7eecc6c 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySkull.java -+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java -@@ -6,6 +6,20 @@ import com.mojang.authlib.minecraft.MinecraftSessionService; - import com.mojang.authlib.properties.Property; - import java.util.UUID; - -+// Spigot start -+import com.google.common.base.Predicate; -+import com.google.common.cache.LoadingCache; -+import com.google.common.cache.CacheBuilder; -+import com.google.common.cache.CacheLoader; -+import java.util.concurrent.Executor; -+import java.util.concurrent.Executors; -+import java.util.concurrent.TimeUnit; -+ -+import com.google.common.util.concurrent.ThreadFactoryBuilder; -+import com.mojang.authlib.Agent; -+import com.mojang.authlib.ProfileLookupCallback; -+// Spigot end -+ - public class TileEntitySkull extends TileEntity implements ITickable { - - private int a; -@@ -15,6 +29,58 @@ public class TileEntitySkull extends TileEntity implements ITickable { - private boolean i; - private static UserCache j; - private static MinecraftSessionService k; -+ // Spigot start -+ public static final Executor executor = Executors.newFixedThreadPool(3, -+ new ThreadFactoryBuilder() -+ .setNameFormat("Head Conversion Thread - %1$d") -+ .build() -+ ); -+ public static final LoadingCache skinCache = CacheBuilder.newBuilder() -+ .maximumSize( 5000 ) -+ .expireAfterAccess( 60, TimeUnit.MINUTES ) -+ .build( new CacheLoader() -+ { -+ @Override -+ public GameProfile load(String key) throws Exception -+ { -+ final GameProfile[] profiles = new GameProfile[1]; -+ ProfileLookupCallback gameProfileLookup = new ProfileLookupCallback() { -+ -+ @Override -+ public void onProfileLookupSucceeded(GameProfile gp) { -+ profiles[0] = gp; -+ } -+ -+ @Override -+ public void onProfileLookupFailed(GameProfile gp, Exception excptn) { -+ profiles[0] = gp; -+ } -+ }; -+ -+ MinecraftServer.getServer().getGameProfileRepository().findProfilesByNames(new String[] { key }, Agent.MINECRAFT, gameProfileLookup); -+ -+ GameProfile profile = profiles[ 0 ]; -+ if (profile == null) { -+ UUID uuid = EntityHuman.a(new GameProfile(null, key)); -+ profile = new GameProfile(uuid, key); -+ -+ gameProfileLookup.onProfileLookupSucceeded(profile); -+ } else -+ { -+ -+ Property property = Iterables.getFirst( profile.getProperties().get( "textures" ), null ); -+ -+ if ( property == null ) -+ { -+ profile = MinecraftServer.getServer().ay().fillProfileProperties( profile, true ); -+ } -+ } -+ -+ -+ return profile; -+ } -+ } ); -+ // Spigot end - - public TileEntitySkull() {} - -@@ -93,35 +159,60 @@ public class TileEntitySkull extends TileEntity implements ITickable { - } - - private void g() { -- this.g = b(this.g); -- this.update(); -+ // Spigot start -+ GameProfile profile = this.g; -+ setSkullType( 0 ); // Work around client bug -+ b(profile, new Predicate() { -+ -+ @Override -+ public boolean apply(GameProfile input) { -+ setSkullType(3); // Work around client bug -+ g = input; -+ update(); -+ if (world != null) { -+ world.m(position); // PAIL: notify -+ } -+ return false; -+ } -+ }); -+ // Spigot end - } - -- public static GameProfile b(GameProfile gameprofile) { -+ // Spigot start - Support async lookups -+ public static void b(final GameProfile gameprofile, final Predicate callback) { - if (gameprofile != null && !UtilColor.b(gameprofile.getName())) { - if (gameprofile.isComplete() && gameprofile.getProperties().containsKey("textures")) { -- return gameprofile; -- } else if (TileEntitySkull.j != null && TileEntitySkull.k != null) { -- GameProfile gameprofile1 = TileEntitySkull.j.getProfile(gameprofile.getName()); -- -- if (gameprofile1 == null) { -- return gameprofile; -+ callback.apply(gameprofile); -+ } else if (MinecraftServer.getServer() == null) { -+ callback.apply(gameprofile); -+ } else { -+ GameProfile profile = skinCache.getIfPresent(gameprofile.getName()); -+ if (profile != null && Iterables.getFirst(profile.getProperties().get("textures"), (Object) null) != null) { -+ callback.apply(profile); - } else { -- Property property = (Property) Iterables.getFirst(gameprofile1.getProperties().get("textures"), (Object) null); -- -- if (property == null) { -- gameprofile1 = TileEntitySkull.k.fillProfileProperties(gameprofile1, true); -- } -- -- return gameprofile1; -+ executor.execute(new Runnable() { -+ @Override -+ public void run() { -+ final GameProfile profile = skinCache.getUnchecked(gameprofile.getName().toLowerCase()); -+ MinecraftServer.getServer().processQueue.add(new Runnable() { -+ @Override -+ public void run() { -+ if (profile == null) { -+ callback.apply(gameprofile); -+ } else { -+ callback.apply(profile); -+ } -+ } -+ }); -+ } -+ }); - } -- } else { -- return gameprofile; - } - } else { -- return gameprofile; -+ callback.apply(gameprofile); - } - } -+ // Spigot end - - public int getSkullType() { - return this.a; -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -index 8a11b87..2abca0c 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -@@ -68,13 +68,27 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { - } - - @Override -- void applyToItem(NBTTagCompound tag) { -+ void applyToItem(final NBTTagCompound tag) { // Spigot - make final - super.applyToItem(tag); - - if (profile != null) { - 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.b(profile, new com.google.common.base.Predicate() { -+ -+ @Override -+ public boolean apply(GameProfile input) { -+ NBTTagCompound owner = new NBTTagCompound(); -+ GameProfileSerializer.serialize( owner, input ); -+ tag.set( SKULL_OWNER.NBT, owner ); -+ return false; -+ } -+ }); -+ // Spigot end - } - } - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0101-Prevent-NoClassDefError-crash-and-notify-on-crash.patch b/CraftBukkit-Patches/0101-Prevent-NoClassDefError-crash-and-notify-on-crash.patch deleted file mode 100644 index f62972e7e6..0000000000 --- a/CraftBukkit-Patches/0101-Prevent-NoClassDefError-crash-and-notify-on-crash.patch +++ /dev/null @@ -1,50 +0,0 @@ -From bcc01c9b44c796ef04203f34f2bcbe0e4f5c29ce Mon Sep 17 00:00:00 2001 -From: David -Date: Mon, 21 Apr 2014 12:43:08 +0100 -Subject: [PATCH] Prevent NoClassDefError crash and notify on crash - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7765812..2257f0f 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -127,6 +127,8 @@ public abstract class World implements IBlockAccess { - - public final SpigotTimings.WorldTimingsHandler timings; // Spigot - private boolean guardEntityList; // Spigot -+ public static boolean haveWeSilencedAPhysicsCrash; -+ public static String blockLocation; - - public CraftWorld getWorld() { - return this.world; -@@ -536,6 +538,9 @@ public abstract class World implements IBlockAccess { - } - // CraftBukkit end - iblockdata.getBlock().doPhysics(this, blockposition, iblockdata, block); -+ } catch (StackOverflowError stackoverflowerror) { // Spigot Start -+ haveWeSilencedAPhysicsCrash = true; -+ blockLocation = blockposition.getX() + ", " + blockposition.getY() + ", " + blockposition.getZ(); // Spigot End - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours"); - CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated"); -diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index de08ad6..94a3d42 100644 ---- a/src/main/java/org/spigotmc/WatchdogThread.java -+++ b/src/main/java/org/spigotmc/WatchdogThread.java -@@ -60,6 +60,13 @@ public class WatchdogThread extends Thread - log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" ); - log.log( Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion() ); - // -+ if(net.minecraft.server.World.haveWeSilencedAPhysicsCrash) -+ { -+ log.log( Level.SEVERE, "------------------------------" ); -+ log.log( Level.SEVERE, "During the run of the server, a physics stackoverflow was supressed" ); -+ log.log( Level.SEVERE, "near " + net.minecraft.server.World.blockLocation); -+ } -+ // - log.log( Level.SEVERE, "------------------------------" ); - log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Spigot!):" ); - dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log ); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0102-Check-Skull-canPlace.patch b/CraftBukkit-Patches/0102-Check-Skull-canPlace.patch deleted file mode 100644 index 7a5051d3b8..0000000000 --- a/CraftBukkit-Patches/0102-Check-Skull-canPlace.patch +++ /dev/null @@ -1,26 +0,0 @@ -From f2216c44f5be2c9cccd99b4f5dbab4ad311352bd Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 15 Apr 2014 10:48:35 +1000 -Subject: [PATCH] Check Skull canPlace - - -diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java -index 2a8c5f0..75cd3f1 100644 ---- a/src/main/java/net/minecraft/server/ItemSkull.java -+++ b/src/main/java/net/minecraft/server/ItemSkull.java -@@ -33,6 +33,12 @@ public class ItemSkull extends Item { - if (world.isClientSide) { - return EnumInteractionResult.SUCCESS; - } else { -+ // Spigot Start -+ if ( !Blocks.SKULL.canPlace( world, blockposition ) ) -+ { -+ return EnumInteractionResult.FAIL; -+ } -+ // Spigot End - world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 11); - int i = 0; - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0103-Fix-race-condition-that-could-kill-connections-befor.patch b/CraftBukkit-Patches/0103-Fix-race-condition-that-could-kill-connections-befor.patch deleted file mode 100644 index 0e3c706de7..0000000000 --- a/CraftBukkit-Patches/0103-Fix-race-condition-that-could-kill-connections-befor.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 6a6f6dd1e01b57ef61f4c90abc1d2c2ecfae00db Mon Sep 17 00:00:00 2001 -From: Jonas Konrad -Date: Fri, 25 Apr 2014 23:46:46 +0200 -Subject: [PATCH] Fix race condition that could kill connections before they - were initiated - -Because NetworkManagers are registered before they get their channel in -channelActive, the ServerConnection would remove them sometimes because -it thought they were disconnected. This commit fixes this by introducing -a 'preparing' variable that is true while the NetworkManager is not -initialized. The ServerConnection does not remove NetworkManagers with -this flag. - -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index c6f9955..4c6dfb1 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -68,6 +68,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - public SocketAddress l; - public java.util.UUID spoofedUUID; - public com.mojang.authlib.properties.Property[] spoofedProfile; -+ public boolean preparing = true; - // Spigot End - private PacketListener m; - private IChatBaseComponent n; -@@ -82,6 +83,9 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - super.channelActive(channelhandlercontext); - this.channel = channelhandlercontext.channel(); - this.l = this.channel.remoteAddress(); -+ // Spigot Start -+ this.preparing = false; -+ // Spigot End - - try { - this.setProtocol(EnumProtocol.HANDSHAKING); -@@ -236,6 +240,9 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - } - - public void close(IChatBaseComponent ichatbasecomponent) { -+ // Spigot Start -+ this.preparing = false; -+ // Spigot End - if (this.channel.isOpen()) { - this.channel.close(); // We can't wait as this may be called from an event loop. - this.n = ichatbasecomponent; -diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java -index 827bfaf..7797575 100644 ---- a/src/main/java/net/minecraft/server/ServerConnection.java -+++ b/src/main/java/net/minecraft/server/ServerConnection.java -@@ -167,6 +167,10 @@ public class ServerConnection { - networkmanager.stopReading(); - } - } else { -+ // Spigot Start -+ // Fix a race condition where a NetworkManager could be unregistered just before connection. -+ if (networkmanager.preparing) continue; -+ // Spigot End - iterator.remove(); - networkmanager.handleDisconnection(); - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0104-Configurable-UserCache-cap.patch b/CraftBukkit-Patches/0104-Configurable-UserCache-cap.patch deleted file mode 100644 index b05b9e4663..0000000000 --- a/CraftBukkit-Patches/0104-Configurable-UserCache-cap.patch +++ /dev/null @@ -1,37 +0,0 @@ -From b419d40ea1a6849d64dbe72e34dc40f4a1cfe9c6 Mon Sep 17 00:00:00 2001 -From: drXor -Date: Fri, 25 Apr 2014 18:17:30 -0400 -Subject: [PATCH] Configurable UserCache cap - - -diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index bbe6e69..4dcf736 100644 ---- a/src/main/java/net/minecraft/server/UserCache.java -+++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -220,7 +220,7 @@ public class UserCache { - } - - public void c() { -- String s = this.b.toJson(this.a(1000)); -+ String s = this.b.toJson(this.a(org.spigotmc.SpigotConfig.userCacheCap)); - BufferedWriter bufferedwriter = null; - - try { -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 3a8734f..e88765b 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -316,4 +316,10 @@ public class SpigotConfig - replaceCommands = new HashSet( (List) getList( "commands.replace-commands", - Arrays.asList( "setblock", "summon", "testforblock", "tellraw" ) ) ); - } -+ -+ public static int userCacheCap; -+ private static void userCacheCap() -+ { -+ userCacheCap = getInt( "settings.user-cache-size", 1000 ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0105-Implement-PlayerSpawnLocationEvent.patch b/CraftBukkit-Patches/0105-Implement-PlayerSpawnLocationEvent.patch deleted file mode 100644 index b7ff897b16..0000000000 --- a/CraftBukkit-Patches/0105-Implement-PlayerSpawnLocationEvent.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 1ba0da9d71e285dd8b937386a676bdac5b218393 Mon Sep 17 00:00:00 2001 -From: ninja -Date: Tue, 8 Apr 2014 14:05:19 +0200 -Subject: [PATCH] Implement PlayerSpawnLocationEvent. - - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 9f0842c..6eb509c 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -36,6 +36,7 @@ import org.bukkit.event.player.PlayerQuitEvent; - import org.bukkit.event.player.PlayerRespawnEvent; - import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; - import org.bukkit.util.Vector; -+import org.spigotmc.event.player.PlayerSpawnLocationEvent; - // CraftBukkit end - - public abstract class PlayerList { -@@ -105,6 +106,19 @@ public abstract class PlayerList { - s1 = networkmanager.getSocketAddress().toString(); - } - -+ // Spigot start - spawn location event -+ Player bukkitPlayer = entityplayer.getBukkitEntity(); -+ PlayerSpawnLocationEvent ev = new PlayerSpawnLocationEvent(bukkitPlayer, bukkitPlayer.getLocation()); -+ Bukkit.getPluginManager().callEvent(ev); -+ -+ Location loc = ev.getSpawnLocation(); -+ WorldServer world = ((CraftWorld) loc.getWorld()).getHandle(); -+ -+ entityplayer.spawnIn(world); -+ entityplayer.setPosition(loc.getX(), loc.getY(), loc.getZ()); -+ entityplayer.setYawPitch(loc.getYaw(), loc.getPitch()); -+ // Spigot end -+ - // CraftBukkit - Moved message to after join - // PlayerList.f.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); - WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0106-Cap-Objective-Score-Length.patch b/CraftBukkit-Patches/0106-Cap-Objective-Score-Length.patch deleted file mode 100644 index 9d1273d4e8..0000000000 --- a/CraftBukkit-Patches/0106-Cap-Objective-Score-Length.patch +++ /dev/null @@ -1,22 +0,0 @@ -From f43b9f8ca15034bc6c64d21d2060c77ae85d35cc Mon Sep 17 00:00:00 2001 -From: hauno -Date: Tue, 6 May 2014 18:01:37 -0700 -Subject: [PATCH] Cap Objective Score Length - -Adds a check for Score arguments that would crash the client - -diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java -index 239ceca..5bd8cf9 100644 ---- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java -+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java -@@ -93,6 +93,7 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective - - public Score getScore(String entry) throws IllegalArgumentException, IllegalStateException { - Validate.notNull(entry, "Entry cannot be null"); -+ if (entry.length() > 40) throw new IllegalArgumentException("Entry cannot be longer than 40 characters!"); // Spigot - CraftScoreboard scoreboard = checkState(); - - return new CraftScore(this, entry); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0107-Process-conversation-input-on-the-main-thread.-Fixes.patch b/CraftBukkit-Patches/0107-Process-conversation-input-on-the-main-thread.-Fixes.patch deleted file mode 100644 index df14454add..0000000000 --- a/CraftBukkit-Patches/0107-Process-conversation-input-on-the-main-thread.-Fixes.patch +++ /dev/null @@ -1,34 +0,0 @@ -From cacbcaae1eeabd9cd04a40d1ff7365c3b46a4407 Mon Sep 17 00:00:00 2001 -From: riking -Date: Wed, 14 May 2014 13:46:48 -0700 -Subject: [PATCH] Process conversation input on the main thread. Fixes - BUKKIT-5611 - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 2a04f15..fec19f1 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1175,7 +1175,18 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - } else if (s.isEmpty()) { - LOGGER.warn(this.player.getName() + " tried to send an empty message"); - } else if (getPlayer().isConversing()) { -- getPlayer().acceptConversationInput(s); -+ // Spigot start -+ final String message = s; -+ this.minecraftServer.processQueue.add( new Waitable() -+ { -+ @Override -+ protected Object evaluate() -+ { -+ getPlayer().acceptConversationInput( message ); -+ return null; -+ } -+ } ); -+ // Spigot end - } else if (this.player.getChatFlags() == EntityHuman.EnumChatVisibility.SYSTEM) { // Re-add "Command Only" flag check - ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0108-Configurable-save-on-stop-only-for-UserCache.patch b/CraftBukkit-Patches/0108-Configurable-save-on-stop-only-for-UserCache.patch deleted file mode 100644 index 8df58fe8da..0000000000 --- a/CraftBukkit-Patches/0108-Configurable-save-on-stop-only-for-UserCache.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 4bfb89700e3794a7600e65a190bca8e636efbfc4 Mon Sep 17 00:00:00 2001 -From: drXor -Date: Fri, 23 May 2014 18:05:10 -0400 -Subject: [PATCH] Configurable save-on-stop-only for UserCache - - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f550dff..e96a01f 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -490,6 +490,12 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - this.m.e(); - } - -+ // Spigot start -+ if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { -+ LOGGER.info("Saving usercache.json"); -+ this.X.c(); -+ } -+ // Spigot end - } - - public String getServerIp() { -diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index 4dcf736..825fed6 100644 ---- a/src/main/java/net/minecraft/server/UserCache.java -+++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -131,7 +131,7 @@ public class UserCache { - this.d.put(gameprofile.getName().toLowerCase(Locale.ROOT), usercache_usercacheentry); - this.e.put(uuid, usercache_usercacheentry); - this.f.addFirst(gameprofile); -- this.c(); -+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled - } - - public GameProfile getProfile(String s) { -@@ -159,7 +159,7 @@ public class UserCache { - } - } - -- this.c(); -+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled - return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); - } - -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index e88765b..f35e92e 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -322,4 +322,10 @@ public class SpigotConfig - { - userCacheCap = getInt( "settings.user-cache-size", 1000 ); - } -+ -+ public static boolean saveUserCacheOnStopOnly; -+ private static void saveUserCacheOnStopOnly() -+ { -+ saveUserCacheOnStopOnly = getBoolean( "settings.save-user-cache-on-stop-only", false ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0109-Prevent-Unbounded-IntCache-Growth.patch b/CraftBukkit-Patches/0109-Prevent-Unbounded-IntCache-Growth.patch deleted file mode 100644 index 5c3f784980..0000000000 --- a/CraftBukkit-Patches/0109-Prevent-Unbounded-IntCache-Growth.patch +++ /dev/null @@ -1,62 +0,0 @@ -From bbadef23001534073b04d18671f35bf4fc689c98 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 20 Jun 2014 19:40:00 +1000 -Subject: [PATCH] Prevent Unbounded IntCache Growth - -Based on work by Peter Lawrey, this commit prevents unbounded growth of the integer cache and instead caps it to a value specified in the configuration (1024 by default). Should prevent thrashing, especially around world generation. - -diff --git a/src/main/java/net/minecraft/server/IntCache.java b/src/main/java/net/minecraft/server/IntCache.java -index 8167fdd..95060a4 100644 ---- a/src/main/java/net/minecraft/server/IntCache.java -+++ b/src/main/java/net/minecraft/server/IntCache.java -@@ -17,11 +17,11 @@ public class IntCache { - if (i <= 256) { - if (IntCache.b.isEmpty()) { - aint = new int[256]; -- IntCache.c.add(aint); -+ if (c.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.c.add(aint); - return aint; - } else { - aint = (int[]) IntCache.b.remove(IntCache.b.size() - 1); -- IntCache.c.add(aint); -+ if (c.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.c.add(aint); - return aint; - } - } else if (i > IntCache.a) { -@@ -29,15 +29,15 @@ public class IntCache { - IntCache.d.clear(); - IntCache.e.clear(); - aint = new int[IntCache.a]; -- IntCache.e.add(aint); -+ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.e.add(aint); - return aint; - } else if (IntCache.d.isEmpty()) { - aint = new int[IntCache.a]; -- IntCache.e.add(aint); -+ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.e.add(aint); - return aint; - } else { - aint = (int[]) IntCache.d.remove(IntCache.d.size() - 1); -- IntCache.e.add(aint); -+ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.e.add(aint); - return aint; - } - } -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index f35e92e..921d7d5 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -328,4 +328,10 @@ public class SpigotConfig - { - saveUserCacheOnStopOnly = getBoolean( "settings.save-user-cache-on-stop-only", false ); - } -+ -+ public static int intCacheLimit; -+ private static void intCacheLimit() -+ { -+ intCacheLimit = getInt( "settings.int-cache-limit", 1024 ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0110-Add-damager-to-the-unhandled-error.patch b/CraftBukkit-Patches/0110-Add-damager-to-the-unhandled-error.patch deleted file mode 100644 index 38081ae5db..0000000000 --- a/CraftBukkit-Patches/0110-Add-damager-to-the-unhandled-error.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 883d7fccf95356015d2fd974ac88c16dde438a7f Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Thu, 26 Jun 2014 23:42:52 +0100 -Subject: [PATCH] Add damager to the unhandled error - - -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 646ee2b..bfa218b 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -189,7 +189,7 @@ public class CraftEventFactory { - */ - public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, ItemStack itemstack, EnumHand hand) { - if (action != Action.LEFT_CLICK_AIR && action != Action.RIGHT_CLICK_AIR) { -- throw new AssertionError(String.format("%s performing %s with %s", who, action, itemstack)); -+ throw new IllegalArgumentException(String.format("%s performing %s with %s", who, action, itemstack)); // Spigot - } - return callPlayerInteractEvent(who, action, new BlockPosition(0, 256, 0), EnumDirection.SOUTH, itemstack, hand); - } -@@ -496,7 +496,7 @@ public class CraftEventFactory { - if (source == DamageSource.CACTUS) { - cause = DamageCause.CONTACT; - } else { -- throw new AssertionError(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.translationIndex)); -+ throw new RuntimeException(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.translationIndex)); // Spigot - } - EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions)); - if (!event.isCancelled()) { -@@ -516,7 +516,7 @@ public class CraftEventFactory { - } else if (source == DamageSource.DRAGON_BREATH) { - cause = DamageCause.DRAGON_BREATH; - } else { -- throw new AssertionError(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.translationIndex)); -+ throw new RuntimeException(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.translationIndex)); // Spigot - } - EntityDamageEvent event = callEvent(new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions)); - if (!event.isCancelled()) { -@@ -556,7 +556,7 @@ public class CraftEventFactory { - return callEntityDamageEvent(null, entity, cause, modifiers, modifierFunctions); - } - -- throw new AssertionError(String.format("Unhandled damage of %s from %s", entity, source.translationIndex)); -+ throw new RuntimeException(String.format("Unhandled damage of %s from %s", entity, source.translationIndex)); // Spigot - } - - private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map modifiers, Map> modifierFunctions) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0111-Cross-World-Entity-Teleportation.patch b/CraftBukkit-Patches/0111-Cross-World-Entity-Teleportation.patch deleted file mode 100644 index eaf5b4a914..0000000000 --- a/CraftBukkit-Patches/0111-Cross-World-Entity-Teleportation.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 53ee60cb03a718db23c05a44991b29186c01b0c0 Mon Sep 17 00:00:00 2001 -From: Andrew Krieger -Date: Tue, 24 Dec 2013 07:55:23 -0800 -Subject: [PATCH] Cross World Entity Teleportation - -Use Entity.teleportTo for cross-world teleportation in CraftEntity. - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 0fc57de..6f4b46f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -244,7 +244,14 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { - // If this entity is riding another entity, we must dismount before teleporting. - entity.stopRiding(); - -- entity.world = ((CraftWorld) location.getWorld()).getHandle(); -+ // Spigot start -+ if (!location.getWorld().equals(getWorld())) { -+ entity.teleportTo(location, cause.equals(TeleportCause.NETHER_PORTAL)); -+ return true; -+ } -+ -+ // entity.world = ((CraftWorld) location.getWorld()).getHandle(); -+ // Spigot end - entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - // entity.setLocation() throws no event, and so cannot be cancelled - return true; --- -2.5.0 - diff --git a/CraftBukkit-Patches/0112-Limit-block-placement-interaction-packets.patch b/CraftBukkit-Patches/0112-Limit-block-placement-interaction-packets.patch deleted file mode 100644 index b324a81d03..0000000000 --- a/CraftBukkit-Patches/0112-Limit-block-placement-interaction-packets.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 80a3ac9101388c99787260b3617c8329199848cd Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sun, 29 Jun 2014 21:10:34 +0100 -Subject: [PATCH] Limit block placement/interaction packets - - -diff --git a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -deleted file mode 100644 -index cb0356e..0000000 ---- a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -+++ /dev/null -@@ -1,30 +0,0 @@ --package net.minecraft.server; -- --import java.io.IOException; -- --public class PacketPlayInArmAnimation implements Packet { -- -- private EnumHand a; -- -- public PacketPlayInArmAnimation() {} -- -- public PacketPlayInArmAnimation(EnumHand enumhand) { -- this.a = enumhand; -- } -- -- public void a(PacketDataSerializer packetdataserializer) throws IOException { -- this.a = (EnumHand) packetdataserializer.a(EnumHand.class); -- } -- -- public void b(PacketDataSerializer packetdataserializer) throws IOException { -- packetdataserializer.a((Enum) this.a); -- } -- -- public void a(PacketListenerPlayIn packetlistenerplayin) { -- packetlistenerplayin.a(this); -- } -- -- public EnumHand a() { -- return this.a; -- } --} -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index fec19f1..f354985 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -898,6 +898,10 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - - } - -+ // Spigot start - limit place/interactions -+ private long lastPlace = -1; -+ private int packets = 0; -+ // Spigot end - public void a(PacketPlayInBlockPlace packetplayinblockplace) { - PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.x()); - if (this.player.dead) return; // CraftBukkit -@@ -906,7 +910,17 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - ItemStack itemstack = this.player.b(enumhand); - - this.player.resetIdleTimer(); -- if (itemstack != null) { -+ // Spigot start -+ boolean throttled = false; -+ if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) { -+ throttled = true; -+ } else if ( packetplayinblockplace.timestamp - lastPlace >= 30 || lastPlace == -1 ) -+ { -+ lastPlace = packetplayinblockplace.timestamp; -+ packets = 0; -+ } -+ // Spigot end -+ if (!throttled && itemstack != null) { // Spigot - skip the event if throttled - // CraftBukkit start - // Raytrace to look for 'rogue armswings' - float f1 = this.player.pitch; --- -2.5.0 - diff --git a/CraftBukkit-Patches/0113-Better-item-validation.patch b/CraftBukkit-Patches/0113-Better-item-validation.patch deleted file mode 100644 index becdad6b53..0000000000 --- a/CraftBukkit-Patches/0113-Better-item-validation.patch +++ /dev/null @@ -1,115 +0,0 @@ -From ed973083147e379a9f5c7d279371bcbee8479fc0 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Wed, 2 Jul 2014 23:35:51 +0100 -Subject: [PATCH] Better item validation - - -diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 9655e74..ede4fe2 100644 ---- a/src/main/java/net/minecraft/server/PacketDataSerializer.java -+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -213,6 +213,10 @@ public class PacketDataSerializer extends ByteBuf { - NBTTagCompound nbttagcompound = null; - - if (itemstack.getItem().usesDurability() || itemstack.getItem().p()) { -+ // Spigot start - filter -+ itemstack = itemstack.cloneItemStack(); -+ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); -+ // Spigot end - nbttagcompound = itemstack.getTag(); - } - -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -index 0318958..0b5ada0 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -@@ -22,6 +22,10 @@ import net.minecraft.server.IChatBaseComponent; - import net.minecraft.server.NBTTagString; - import org.bukkit.craftbukkit.util.CraftChatMessage; - -+// Spigot start -+import static org.spigotmc.ValidateUtils.*; -+// Spigot end -+ - @DelegateDeserialization(SerializableMeta.class) - public class CraftMetaBook extends CraftMetaItem implements BookMeta { - static final ItemMetaKey BOOK_TITLE = new ItemMetaKey("title"); -@@ -57,11 +61,11 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { - super(tag); - - if (tag.hasKey(BOOK_TITLE.NBT)) { -- this.title = tag.getString(BOOK_TITLE.NBT); -+ this.title = limit( tag.getString(BOOK_TITLE.NBT), 1024 ); // Spigot - } - - if (tag.hasKey(BOOK_AUTHOR.NBT)) { -- this.author = tag.getString(BOOK_AUTHOR.NBT); -+ this.author = limit( tag.getString(BOOK_AUTHOR.NBT), 1024 ); // Spigot - } - - boolean resolved = false; -@@ -86,7 +90,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { - // Ignore and treat as an old book - } - } -- addPage(page); -+ addPage( limit( page, 2048 ) ); // Spigot - } - } - } -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index e487d52..07ea6f6 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -47,6 +47,10 @@ import java.util.logging.Logger; - import net.minecraft.server.NBTCompressedStreamTools; - import org.apache.commons.codec.binary.Base64; - -+// Spigot start -+import static org.spigotmc.ValidateUtils.*; -+// Spigot end -+ - /** - * Children must include the following: - * -@@ -247,7 +251,7 @@ class CraftMetaItem implements ItemMeta, Repairable { - NBTTagCompound display = tag.getCompound(DISPLAY.NBT); - - if (display.hasKey(NAME.NBT)) { -- displayName = display.getString(NAME.NBT); -+ displayName = limit( display.getString(NAME.NBT), 1024 ); // Spigot - } - - if (display.hasKey(LORE.NBT)) { -@@ -255,7 +259,7 @@ class CraftMetaItem implements ItemMeta, Repairable { - lore = new ArrayList(list.size()); - - for (int index = 0; index < list.size(); index++) { -- String line = list.getString(index); -+ String line = limit( list.getString(index), 1024 ); // Spigot - lore.add(line); - } - } -diff --git a/src/main/java/org/spigotmc/ValidateUtils.java b/src/main/java/org/spigotmc/ValidateUtils.java -new file mode 100644 -index 0000000..58a9534 ---- /dev/null -+++ b/src/main/java/org/spigotmc/ValidateUtils.java -@@ -0,0 +1,14 @@ -+package org.spigotmc; -+ -+public class ValidateUtils -+{ -+ -+ public static String limit(String str, int limit) -+ { -+ if ( str.length() > limit ) -+ { -+ return str.substring( 0, limit ); -+ } -+ return str; -+ } -+} --- -2.5.0 - diff --git a/CraftBukkit-Patches/0114-Further-Seed-Customisation.patch b/CraftBukkit-Patches/0114-Further-Seed-Customisation.patch deleted file mode 100644 index aed03ad3b9..0000000000 --- a/CraftBukkit-Patches/0114-Further-Seed-Customisation.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 74e653a9ea9ca9c082ba6230c5460aeaf39e9de5 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 4 Jul 2014 13:28:45 +1000 -Subject: [PATCH] Further Seed Customisation - -Allow server admins that really want to to customise the seeds used in world generation even further. - -diff --git a/src/main/java/net/minecraft/server/WorldGenLargeFeature.java b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java -index 462dc76..1ab69cc 100644 ---- a/src/main/java/net/minecraft/server/WorldGenLargeFeature.java -+++ b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java -@@ -54,7 +54,7 @@ public class WorldGenLargeFeature extends StructureGenerator { - - int i1 = i / this.d; - int j1 = j / this.d; -- Random random = this.g.a(i1, j1, 14357617); -+ Random random = this.g.a(i1, j1, this.g.spigotConfig.largeFeatureSeed); // Spigot - - i1 *= this.d; - j1 *= this.d; -diff --git a/src/main/java/net/minecraft/server/WorldGenVillage.java b/src/main/java/net/minecraft/server/WorldGenVillage.java -index 2f43742..02d8fec 100644 ---- a/src/main/java/net/minecraft/server/WorldGenVillage.java -+++ b/src/main/java/net/minecraft/server/WorldGenVillage.java -@@ -53,7 +53,7 @@ public class WorldGenVillage extends StructureGenerator { - - int i1 = i / this.d; - int j1 = j / this.d; -- Random random = this.g.a(i1, j1, 10387312); -+ Random random = this.g.a(i1, j1, this.g.spigotConfig.villageSeed); // Spigot - - i1 *= this.d; - j1 *= this.d; -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 79a3124..7cf8f2d 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -243,4 +243,13 @@ public class SpigotWorldConfig - { - witherSpawnSoundRadius = getInt( "wither-spawn-sound-radius", 0 ); - } -+ -+ public int villageSeed; -+ public int largeFeatureSeed; -+ private void initWorldGenSeeds() -+ { -+ villageSeed = getInt( "seed-village", 10387312 ); -+ largeFeatureSeed = getInt( "seed-feature", 14357617 ); -+ log( "Custom Map Seeds: Village: " + villageSeed + " Feature: " + largeFeatureSeed ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0115-Disable-ResourceLeakDetector.patch b/CraftBukkit-Patches/0115-Disable-ResourceLeakDetector.patch deleted file mode 100644 index 43ddde28a1..0000000000 --- a/CraftBukkit-Patches/0115-Disable-ResourceLeakDetector.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 81669fdb7dd4c2e840bb0007caca901252909d19 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 8 Jul 2014 09:01:50 +1000 -Subject: [PATCH] Disable ResourceLeakDetector - -Hopefully no plugins are somehow leaking buffers, but disabling the ResourceLeakDetector is a good thing for performance of the Netty IO subsytem (it's been disabled in BungeeCord for a while now). - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bf0b825..32290a0 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -122,6 +122,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - // Spigot end - - public MinecraftServer(OptionSet options, Proxy proxy, DataConverterManager dataconvertermanager, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) { -+ io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable - this.e = proxy; - this.U = yggdrasilauthenticationservice; - this.V = minecraftsessionservice; --- -2.5.0 - diff --git a/CraftBukkit-Patches/0116-Add-More-Information-to-session.lock-Errors.patch b/CraftBukkit-Patches/0116-Add-More-Information-to-session.lock-Errors.patch deleted file mode 100644 index 4c0a95ac9d..0000000000 --- a/CraftBukkit-Patches/0116-Add-More-Information-to-session.lock-Errors.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 514102b4812128ada9ef5ad40e69c9bc69836991 Mon Sep 17 00:00:00 2001 -From: Suddenly -Date: Sat, 5 Jul 2014 16:56:44 +0100 -Subject: [PATCH] Add More Information to session.lock Errors - - -diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index 81e8bdb..df82c14 100644 ---- a/src/main/java/net/minecraft/server/WorldNBTStorage.java -+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -59,7 +59,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - - } catch (IOException ioexception) { - ioexception.printStackTrace(); -- throw new RuntimeException("Failed to check session lock, aborting"); -+ throw new RuntimeException("Failed to check session lock for world located at " + this.baseDir + ", aborting. Stop the server and delete the session.lock in this world to prevent further issues."); // Spigot - } - } - -@@ -74,14 +74,14 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - - try { - if (datainputstream.readLong() != this.sessionId) { -- throw new ExceptionWorldConflict("The save is being accessed from another location, aborting"); -+ throw new ExceptionWorldConflict("The save for world located at " + this.baseDir + " is being accessed from another location, aborting"); // Spigot - } - } finally { - datainputstream.close(); - } - - } catch (IOException ioexception) { -- throw new ExceptionWorldConflict("Failed to check session lock, aborting"); -+ throw new ExceptionWorldConflict("Failed to check session lock for world located at " + this.baseDir + ", aborting. Stop the server and delete the session.lock in this world to prevent further issues."); // Spigot - } - } - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0117-Safer-JSON-Loading.patch b/CraftBukkit-Patches/0117-Safer-JSON-Loading.patch deleted file mode 100644 index 8b5f07dec4..0000000000 --- a/CraftBukkit-Patches/0117-Safer-JSON-Loading.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 00ba6b1058d452bd2e2ecd6e7246de98b74581a7 Mon Sep 17 00:00:00 2001 -From: Suddenly -Date: Tue, 8 Jul 2014 09:44:18 +1000 -Subject: [PATCH] Safer JSON Loading - - -diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java -index f5c3aae..8e4ecfd 100644 ---- a/src/main/java/net/minecraft/server/JsonList.java -+++ b/src/main/java/net/minecraft/server/JsonList.java -@@ -170,6 +170,17 @@ public class JsonList> { - try { - bufferedreader = Files.newReader(this.c, Charsets.UTF_8); - collection = (Collection) this.b.fromJson(bufferedreader, JsonList.f); -+ // Spigot Start -+ } catch ( java.io.FileNotFoundException ex ) -+ { -+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.INFO, "Unable to find file {0}, creating it.", this.c ); -+ } catch ( com.google.gson.JsonSyntaxException ex ) -+ { -+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, "Unable to read file {0}, backing it up to {0}.backup and creating new copy.", this.c ); -+ File backup = new File( this.c + ".backup" ); -+ this.c.renameTo( backup ); -+ this.c.delete(); -+ // Spigot End - } finally { - IOUtils.closeQuietly(bufferedreader); - } -diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index 825fed6..46129d8 100644 ---- a/src/main/java/net/minecraft/server/UserCache.java -+++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -211,6 +211,11 @@ public class UserCache { - } - } catch (FileNotFoundException filenotfoundexception) { - ; -+ // Spigot Start -+ } catch (com.google.gson.JsonSyntaxException ex) { -+ JsonList.a.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." ); -+ this.h.delete(); -+ // Spigot End - } catch (JsonParseException jsonparseexception) { - ; - } finally { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0118-Add-CommandLine-EULA-Flag.patch b/CraftBukkit-Patches/0118-Add-CommandLine-EULA-Flag.patch deleted file mode 100644 index 55b58a347f..0000000000 --- a/CraftBukkit-Patches/0118-Add-CommandLine-EULA-Flag.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 49f7c06001e54932cb6b9b11d4dfaf182d97ffd5 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 9 Jul 2014 10:35:44 +1000 -Subject: [PATCH] Add CommandLine EULA Flag - -This flag contains the same message as eula.txt (albeit with proper grammar for 3rd person plural). By setting this flag you are agreeing to the terms listed in the message printed upon setting this flag, which are no different from those agreed to by any other method. - -This feature only exists for hosting companies and people who manage servers in bulk who wish to agree to the terms by setting a flag in a script. - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 8a8e05b..0f8c10a 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -126,7 +126,16 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - DedicatedServer.LOGGER.info("Loading properties"); - this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support - this.q = new EULA(new File("eula.txt")); -- if (!this.q.a()) { -+ // Spigot Start -+ boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" ); -+ if ( eulaAgreed ) -+ { -+ System.err.println( "You have used the Spigot command line EULA agreement flag." ); -+ System.err.println( "By using this setting you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula)." ); -+ System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." ); -+ } -+ // Spigot End -+ if (!this.q.a() && !eulaAgreed) { // Spigot - DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); - this.q.b(); - return false; --- -2.5.0 - diff --git a/CraftBukkit-Patches/0119-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch b/CraftBukkit-Patches/0119-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch deleted file mode 100644 index 2561a1b5f4..0000000000 --- a/CraftBukkit-Patches/0119-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 800cf4ce6d592914dcfc664ae67f2fa2fc8eb42e Mon Sep 17 00:00:00 2001 -From: drXor -Date: Thu, 17 Jul 2014 21:13:15 -0400 -Subject: [PATCH] Fix for enchanting table wiping meta when placing stacked - items - - -diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTable.java b/src/main/java/net/minecraft/server/ContainerEnchantTable.java -index bc2500c..2493326 100644 ---- a/src/main/java/net/minecraft/server/ContainerEnchantTable.java -+++ b/src/main/java/net/minecraft/server/ContainerEnchantTable.java -@@ -347,7 +347,11 @@ public class ContainerEnchantTable extends Container { - ((Slot) this.c.get(0)).set(itemstack1.cloneItemStack()); - itemstack1.count = 0; - } else if (itemstack1.count >= 1) { -- ((Slot) this.c.get(0)).set(new ItemStack(itemstack1.getItem(), 1, itemstack1.getData())); -+ // Spigot start -+ ItemStack clone = itemstack1.cloneItemStack(); -+ clone.count = 1; -+ ((Slot) this.c.get(0)).set(clone); -+ // Spigot end - --itemstack1.count; - } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0120-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch b/CraftBukkit-Patches/0120-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch deleted file mode 100644 index eb071251eb..0000000000 --- a/CraftBukkit-Patches/0120-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch +++ /dev/null @@ -1,47 +0,0 @@ -From c500eacb08ec83135f9599519cfc0c6eea129a2e Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sat, 19 Jul 2014 12:49:48 +0100 -Subject: [PATCH] Don't spawn bonus ocelots when plugins spawn ocelots - - -diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java -index 06ace47..f74d1b9 100644 ---- a/src/main/java/net/minecraft/server/EntityOcelot.java -+++ b/src/main/java/net/minecraft/server/EntityOcelot.java -@@ -7,6 +7,7 @@ public class EntityOcelot extends EntityTameableAnimal { - private static final DataWatcherObject bz = DataWatcher.a(EntityOcelot.class, DataWatcherRegistry.b); - private PathfinderGoalAvoidTarget bA; - private PathfinderGoalTempt bB; -+ public boolean spawnBonus = true; // Spigot - - public EntityOcelot(World world) { - super(world); -@@ -229,7 +230,7 @@ public class EntityOcelot extends EntityTameableAnimal { - - public GroupDataEntity prepare(DifficultyDamageScaler difficultydamagescaler, GroupDataEntity groupdataentity) { - groupdataentity = super.prepare(difficultydamagescaler, groupdataentity); -- if (this.world.random.nextInt(7) == 0) { -+ if (spawnBonus && this.world.random.nextInt(7) == 0) { // Spigot - for (int i = 0; i < 2; ++i) { - EntityOcelot entityocelot = new EntityOcelot(this.world); - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 80be0b1..e0b1c0c 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1153,6 +1153,12 @@ public class CraftWorld implements World { - } - - if (entity != null) { -+ // Spigot start -+ if (entity instanceof EntityOcelot) -+ { -+ ( (EntityOcelot) entity ).spawnBonus = false; -+ } -+ // Spigot end - return entity; - } - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0121-Prevent-a-crash-involving-attributes.patch b/CraftBukkit-Patches/0121-Prevent-a-crash-involving-attributes.patch deleted file mode 100644 index 63a85e149b..0000000000 --- a/CraftBukkit-Patches/0121-Prevent-a-crash-involving-attributes.patch +++ /dev/null @@ -1,30 +0,0 @@ -From f96164c1f3d6856df8008b2be6afc7ac1ce03a17 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sat, 19 Jul 2014 19:54:41 +0100 -Subject: [PATCH] Prevent a crash involving attributes - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 92e14d4..8fefb1f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1304,7 +1304,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - break; - } - } -- collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); -+ // Spigot start -+ double healthMod = scaledHealth ? healthScale : getMaxHealth(); -+ if ( healthMod >= Float.MAX_VALUE || healthMod <= 0 ) -+ { -+ healthMod = 20; // Reset health -+ getServer().getLogger().warning( getName() + " tried to crash the server with a large health attribute" ); -+ } -+ collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", healthMod, 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); -+ // Spigot end - } - - @Override --- -2.5.0 - diff --git a/CraftBukkit-Patches/0122-Make-moved-wrongly-limit-configurable.patch b/CraftBukkit-Patches/0122-Make-moved-wrongly-limit-configurable.patch deleted file mode 100644 index e51d8d5934..0000000000 --- a/CraftBukkit-Patches/0122-Make-moved-wrongly-limit-configurable.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 56f43f705bf61748a904e04db6e560eb0281038e Mon Sep 17 00:00:00 2001 -From: Jonas Konrad -Date: Fri, 4 Jul 2014 23:03:13 +0200 -Subject: [PATCH] Make "moved wrongly" limit configurable - - -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 921d7d5..7e774f2 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -334,4 +334,10 @@ public class SpigotConfig - { - intCacheLimit = getInt( "settings.int-cache-limit", 1024 ); - } -+ -+ public static double movedWronglyThreshold; -+ private static void movedWronglyThreshold() -+ { -+ movedWronglyThreshold = getDouble( "settings.moved-wrongly-threshold", 0.0625D ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0123-Fix-Null-Tile-Entity-Worlds.patch b/CraftBukkit-Patches/0123-Fix-Null-Tile-Entity-Worlds.patch deleted file mode 100644 index 112c877b43..0000000000 --- a/CraftBukkit-Patches/0123-Fix-Null-Tile-Entity-Worlds.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 81a1e50a433e6c9b913b09792b693fe72bb98eb1 Mon Sep 17 00:00:00 2001 -From: "Evan A. Haskell" -Date: Thu, 26 Jun 2014 18:37:29 -0400 -Subject: [PATCH] Fix Null Tile Entity Worlds - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 2257f0f..d7847c5 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1964,6 +1964,7 @@ public abstract class World implements IBlockAccess { - } - } - -+ tileentity.a(this); // Spigot - No null worlds - this.b.add(tileentity); - } else { - this.a(tileentity); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0124-Make-moved-too-quickly-limit-configurable.patch b/CraftBukkit-Patches/0124-Make-moved-too-quickly-limit-configurable.patch deleted file mode 100644 index 337fcbe2b8..0000000000 --- a/CraftBukkit-Patches/0124-Make-moved-too-quickly-limit-configurable.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0acc1d4540fffea7e59df69727b42f566b203d30 Mon Sep 17 00:00:00 2001 -From: Jonas Konrad -Date: Tue, 22 Jul 2014 15:59:01 +0200 -Subject: [PATCH] Make "moved too quickly" limit configurable - - -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 7e774f2..2a23a4e 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -340,4 +340,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 ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0125-Apply-NBTReadLimiter-to-more-things.patch b/CraftBukkit-Patches/0125-Apply-NBTReadLimiter-to-more-things.patch deleted file mode 100644 index dbaf2f718c..0000000000 --- a/CraftBukkit-Patches/0125-Apply-NBTReadLimiter-to-more-things.patch +++ /dev/null @@ -1,71 +0,0 @@ -From b2db0dd7ae5d9e03d10f5ed0833057c207b449c9 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. - - -diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -index 2a04b86..b2d5254 100644 ---- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -@@ -44,6 +44,12 @@ public class NBTCompressedStreamTools { - } - - public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) throws IOException { -+ // Spigot start -+ if ( datainput instanceof io.netty.buffer.ByteBufInputStream ) -+ { -+ datainput = new DataInputStream(new org.spigotmc.LimitStream((InputStream) datainput, nbtreadlimiter)); -+ } -+ // Spigot end - NBTBase nbtbase = a(datainput, 0, nbtreadlimiter); - - if (nbtbase instanceof 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..8c32e8b ---- /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( 8 ); -+ return super.read(); -+ } -+ -+ @Override -+ public int read(byte[] b) throws IOException -+ { -+ limit.a( b.length * 8 ); -+ return super.read( b ); -+ } -+ -+ @Override -+ public int read(byte[] b, int off, int len) throws IOException -+ { -+ limit.a( len * 8 ); -+ return super.read( b, off, len ); -+ } -+} --- -2.5.0 - diff --git a/CraftBukkit-Patches/0126-Allow-Attribute-Capping.patch b/CraftBukkit-Patches/0126-Allow-Attribute-Capping.patch deleted file mode 100644 index 0af649dda0..0000000000 --- a/CraftBukkit-Patches/0126-Allow-Attribute-Capping.patch +++ /dev/null @@ -1,78 +0,0 @@ -From ff1cbc9c27c12f0ade79b8a3791321ee31cce996 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 28 Jul 2014 16:55:51 +1000 -Subject: [PATCH] Allow Attribute Capping. - -Apply some sensible defaults and allow server owners to customize the maximum values of selected common attributes. - -diff --git a/src/main/java/net/minecraft/server/AttributeRanged.java b/src/main/java/net/minecraft/server/AttributeRanged.java -index 13602f0..838daed 100644 ---- a/src/main/java/net/minecraft/server/AttributeRanged.java -+++ b/src/main/java/net/minecraft/server/AttributeRanged.java -@@ -3,7 +3,7 @@ package net.minecraft.server; - public class AttributeRanged extends AttributeBase { - - private final double a; -- private final double b; -+ public double b; // Spigot - private String c; - - public AttributeRanged(IAttribute iattribute, String s, double d0, double d1, double d2) { -diff --git a/src/main/java/net/minecraft/server/GenericAttributes.java b/src/main/java/net/minecraft/server/GenericAttributes.java -index 16aaf1a..f43aa57 100644 ---- a/src/main/java/net/minecraft/server/GenericAttributes.java -+++ b/src/main/java/net/minecraft/server/GenericAttributes.java -@@ -9,14 +9,16 @@ import org.apache.logging.log4j.Logger; - public class GenericAttributes { - - private static final Logger i = LogManager.getLogger(); -- public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)).a("Max Health").a(true); -+ // Spigot start -+ public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true); - public static final IAttribute FOLLOW_RANGE = (new AttributeRanged((IAttribute) null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); - public static final IAttribute c = (new AttributeRanged((IAttribute) null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); -- public static final IAttribute MOVEMENT_SPEED = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, 1024.0D)).a("Movement Speed").a(true); -- public static final IAttribute ATTACK_DAMAGE = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, 2048.0D); -+ public static final IAttribute MOVEMENT_SPEED = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, org.spigotmc.SpigotConfig.movementSpeed)).a("Movement Speed").a(true); -+ public static final IAttribute ATTACK_DAMAGE = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, org.spigotmc.SpigotConfig.attackDamage); - public static final IAttribute f = (new AttributeRanged((IAttribute) null, "generic.attackSpeed", 4.0D, 0.0D, 1024.0D)).a(true); - public static final IAttribute g = (new AttributeRanged((IAttribute) null, "generic.armor", 0.0D, 0.0D, 30.0D)).a(true); - public static final IAttribute h = (new AttributeRanged((IAttribute) null, "generic.luck", 0.0D, -1024.0D, 1024.0D)).a(true); -+ // Spigot end - - public static NBTTagList a(AttributeMapBase attributemapbase) { - NBTTagList nbttaglist = new NBTTagList(); -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 2a23a4e..a187598 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -14,6 +14,8 @@ import java.util.Map; - import java.util.Set; - import java.util.logging.Level; - import gnu.trove.map.hash.TObjectIntHashMap; -+import net.minecraft.server.AttributeRanged; -+import net.minecraft.server.GenericAttributes; - import net.minecraft.server.MinecraftServer; - import org.bukkit.Bukkit; - import org.bukkit.ChatColor; -@@ -346,4 +348,17 @@ public class SpigotConfig - { - movedTooQuicklyThreshold = getDouble( "settings.moved-too-quickly-threshold", 100.0D ); - } -+ -+ public static double maxHealth = 2048; -+ public static double movementSpeed = 2048; -+ public static double attackDamage = 2048; -+ private static void attributeMaxes() -+ { -+ maxHealth = getDouble( "settings.attribute.maxHealth.max", maxHealth ); -+ ( (AttributeRanged) GenericAttributes.maxHealth ).b = maxHealth; -+ movementSpeed = getDouble( "settings.attribute.movementSpeed.max", movementSpeed ); -+ ( (AttributeRanged) GenericAttributes.MOVEMENT_SPEED ).b = movementSpeed; -+ attackDamage = getDouble( "settings.attribute.attackDamage.max", attackDamage ); -+ ( (AttributeRanged) GenericAttributes.ATTACK_DAMAGE ).b = attackDamage; -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0127-Only-fetch-an-online-UUID-in-online-mode.patch b/CraftBukkit-Patches/0127-Only-fetch-an-online-UUID-in-online-mode.patch deleted file mode 100644 index 3b7f7a28cf..0000000000 --- a/CraftBukkit-Patches/0127-Only-fetch-an-online-UUID-in-online-mode.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 249003af99a25a9fbad7dbba89b7b3fe01dbf5f7 Mon Sep 17 00:00:00 2001 -From: Maxim Van de Wynckel -Date: Wed, 30 Jul 2014 01:19:51 +0200 -Subject: [PATCH] Only fetch an online UUID in online mode - -The previous code would get an online UUID even in offline mode that -breaks plugins if the player joins. - -Example: -You want to store data for player "Test" who never joined. An online UUID is created and you save it using that UUID. - -The player Test joins with an offline UUID but that will not match the online UUID of the saved data. - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 8900e01..cabb3e5 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1296,8 +1296,14 @@ public final class CraftServer implements Server { - - OfflinePlayer result = getPlayerExact(name); - if (result == null) { -- // This is potentially blocking :( -- GameProfile profile = console.getUserCache().getProfile(name); -+ // Spigot Start -+ GameProfile profile = null; -+ // Only fetch an online UUID in online mode -+ if ( MinecraftServer.getServer().getOnlineMode() || org.spigotmc.SpigotConfig.bungee ) -+ { -+ profile = console.getUserCache().getProfile( name ); -+ } -+ // Spigot end - if (profile == null) { - // Make an OfflinePlayer using an offline mode UUID since the name has no profile - result = getOfflinePlayer(new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name)); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0128-Filter-attribute-modifiers-which-cause-the-attribute.patch b/CraftBukkit-Patches/0128-Filter-attribute-modifiers-which-cause-the-attribute.patch deleted file mode 100644 index 9c449811c9..0000000000 --- a/CraftBukkit-Patches/0128-Filter-attribute-modifiers-which-cause-the-attribute.patch +++ /dev/null @@ -1,147 +0,0 @@ -From 747c9586e1c1b513205364465986bf165a354748 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Thu, 31 Jul 2014 17:48:20 +0100 -Subject: [PATCH] Filter attribute modifiers which cause the attribute to go - out of its range - - -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 07ea6f6..2dac846 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -49,6 +49,8 @@ import org.apache.commons.codec.binary.Base64; - - // Spigot start - import static org.spigotmc.ValidateUtils.*; -+import net.minecraft.server.GenericAttributes; -+import net.minecraft.server.IAttribute; - // Spigot end - - /** -@@ -279,6 +281,123 @@ class CraftMetaItem implements ItemMeta, Repairable { - NBTTagList save = null; - NBTTagList nbttaglist = tag.getList(ATTRIBUTES.NBT, 10); - -+ // Spigot start -+ gnu.trove.map.hash.TObjectDoubleHashMap attributeTracker = new gnu.trove.map.hash.TObjectDoubleHashMap(); -+ gnu.trove.map.hash.TObjectDoubleHashMap attributeTrackerX = new gnu.trove.map.hash.TObjectDoubleHashMap(); -+ Map attributesByName = new HashMap(); -+ attributeTracker.put( "generic.maxHealth", 20.0 ); -+ attributesByName.put( "generic.maxHealth", GenericAttributes.maxHealth ); -+ attributeTracker.put( "generic.followRange", 32.0 ); -+ attributesByName.put( "generic.followRange", GenericAttributes.FOLLOW_RANGE ); -+ attributeTracker.put( "generic.knockbackResistance", 0.0 ); -+ attributesByName.put( "generic.knockbackResistance", GenericAttributes.c ); -+ attributeTracker.put( "generic.movementSpeed", 0.7 ); -+ attributesByName.put( "generic.movementSpeed", GenericAttributes.MOVEMENT_SPEED ); -+ attributeTracker.put( "generic.attackDamage", 1.0 ); -+ attributesByName.put( "generic.attackDamage", GenericAttributes.ATTACK_DAMAGE ); -+ NBTTagList oldList = nbttaglist; -+ nbttaglist = new NBTTagList(); -+ -+ List op0 = new ArrayList(); -+ List op1 = new ArrayList(); -+ List op2 = new ArrayList(); -+ -+ for ( int i = 0; i < oldList.size(); ++i ) -+ { -+ NBTTagCompound nbttagcompound = oldList.get( i ); -+ if ( nbttagcompound == null ) continue; -+ -+ if ( !nbttagcompound.hasKeyOfType(ATTRIBUTES_UUID_HIGH.NBT, 99) ) -+ { -+ continue; -+ } -+ if ( !nbttagcompound.hasKeyOfType(ATTRIBUTES_UUID_LOW.NBT, 99) ) -+ { -+ continue; -+ } -+ if ( !( nbttagcompound.get( ATTRIBUTES_IDENTIFIER.NBT ) instanceof NBTTagString ) || !CraftItemFactory.KNOWN_NBT_ATTRIBUTE_NAMES.contains( nbttagcompound.getString( ATTRIBUTES_IDENTIFIER.NBT ) ) ) -+ { -+ continue; -+ } -+ if ( !( nbttagcompound.get( ATTRIBUTES_NAME.NBT ) instanceof NBTTagString ) || nbttagcompound.getString( ATTRIBUTES_NAME.NBT ).isEmpty() ) -+ { -+ continue; -+ } -+ if ( !nbttagcompound.hasKeyOfType(ATTRIBUTES_VALUE.NBT, 99) ) -+ { -+ continue; -+ } -+ if ( !nbttagcompound.hasKeyOfType(ATTRIBUTES_TYPE.NBT, 99) || nbttagcompound.getInt( ATTRIBUTES_TYPE.NBT ) < 0 || nbttagcompound.getInt( ATTRIBUTES_TYPE.NBT ) > 2 ) -+ { -+ continue; -+ } -+ -+ switch ( nbttagcompound.getInt( ATTRIBUTES_TYPE.NBT ) ) -+ { -+ case 0: -+ op0.add( nbttagcompound ); -+ break; -+ case 1: -+ op1.add( nbttagcompound ); -+ break; -+ case 2: -+ op2.add( nbttagcompound ); -+ break; -+ } -+ } -+ for ( NBTTagCompound nbtTagCompound : op0 ) -+ { -+ String name = nbtTagCompound.getString( ATTRIBUTES_IDENTIFIER.NBT ); -+ if ( attributeTracker.containsKey( name ) ) -+ { -+ double val = attributeTracker.get( name ); -+ val += nbtTagCompound.getDouble( ATTRIBUTES_VALUE.NBT ); -+ if ( val != attributesByName.get( name ).a( val ) ) -+ { -+ continue; -+ } -+ attributeTracker.put( name, val ); -+ } -+ nbttaglist.add( nbtTagCompound ); -+ } -+ for ( String name : attributeTracker.keySet() ) -+ { -+ attributeTrackerX.put( name, attributeTracker.get( name ) ); -+ } -+ for ( NBTTagCompound nbtTagCompound : op1 ) -+ { -+ String name = nbtTagCompound.getString( ATTRIBUTES_IDENTIFIER.NBT ); -+ if ( attributeTracker.containsKey( name ) ) -+ { -+ double val = attributeTracker.get( name ); -+ double valX = attributeTrackerX.get( name ); -+ val += valX * nbtTagCompound.getDouble( ATTRIBUTES_VALUE.NBT ); -+ if ( val != attributesByName.get( name ).a( val ) ) -+ { -+ continue; -+ } -+ attributeTracker.put( name, val ); -+ } -+ nbttaglist.add( nbtTagCompound ); -+ } -+ for ( NBTTagCompound nbtTagCompound : op2 ) -+ { -+ String name = nbtTagCompound.getString( ATTRIBUTES_IDENTIFIER.NBT ); -+ if ( attributeTracker.containsKey( name ) ) -+ { -+ double val = attributeTracker.get( name ); -+ val += val * nbtTagCompound.getDouble( ATTRIBUTES_VALUE.NBT ); -+ if ( val != attributesByName.get( name ).a( val ) ) -+ { -+ continue; -+ } -+ attributeTracker.put( name, val ); -+ } -+ nbttaglist.add( nbtTagCompound ); -+ } -+ -+ // Spigot end -+ - for (int i = 0; i < nbttaglist.size(); ++i) { - if (!(nbttaglist.get(i) instanceof NBTTagCompound)) { - continue; --- -2.5.0 - diff --git a/CraftBukkit-Patches/0129-Plug-WorldMap-Memory-Leak.patch b/CraftBukkit-Patches/0129-Plug-WorldMap-Memory-Leak.patch deleted file mode 100644 index c77a2ff50f..0000000000 --- a/CraftBukkit-Patches/0129-Plug-WorldMap-Memory-Leak.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 1fa81343f01c5002f45dbed000823fc7942d650f Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 8 Aug 2014 19:57:03 +1000 -Subject: [PATCH] Plug WorldMap Memory Leak - - -diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java -index c29e3f7..6f013eb 100644 ---- a/src/main/java/net/minecraft/server/PersistentCollection.java -+++ b/src/main/java/net/minecraft/server/PersistentCollection.java -@@ -18,7 +18,7 @@ public class PersistentCollection { - - private IDataManager b; - protected Map a = Maps.newHashMap(); -- private List c = Lists.newArrayList(); -+ public List c = Lists.newArrayList(); // Spigot - private Map d = Maps.newHashMap(); - - public PersistentCollection(IDataManager idatamanager) { -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d7847c5..8ad0aa2 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1032,6 +1032,23 @@ public abstract class World implements IBlockAccess { - entity.die(); - if (entity instanceof EntityHuman) { - this.players.remove(entity); -+ // Spigot start -+ for ( Object o : worldMaps.c ) -+ { -+ if ( o instanceof WorldMap ) -+ { -+ WorldMap map = (WorldMap) o; -+ map.j.remove( entity ); -+ for ( Iterator iter = (Iterator) map.h.iterator(); iter.hasNext(); ) -+ { -+ if ( iter.next().trackee == entity ) -+ { -+ iter.remove(); -+ } -+ } -+ } -+ } -+ // Spigot end - this.everyoneSleeping(); - this.c(entity); - } -diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java -index bf53fe5..d0d7c9d 100644 ---- a/src/main/java/net/minecraft/server/WorldMap.java -+++ b/src/main/java/net/minecraft/server/WorldMap.java -@@ -23,7 +23,7 @@ public class WorldMap extends PersistentBase { - public byte scale; - public byte[] colors = new byte[16384]; - public List h = Lists.newArrayList(); -- private Map j = Maps.newHashMap(); -+ public Map j = Maps.newHashMap(); // Spigot - public Map decorations = Maps.newLinkedHashMap(); - - // CraftBukkit start --- -2.5.0 - diff --git a/CraftBukkit-Patches/0130-Fix-Corrupted-Trapped-Chest.patch b/CraftBukkit-Patches/0130-Fix-Corrupted-Trapped-Chest.patch deleted file mode 100644 index f2366c61a2..0000000000 --- a/CraftBukkit-Patches/0130-Fix-Corrupted-Trapped-Chest.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 117e10736f1bcaa9bae8945314ae91bbb2935a28 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 15 Aug 2014 00:56:41 -0400 -Subject: [PATCH] Fix Corrupted Trapped Chest - -The CraftBukkit code that auto repairs corrupted tile entities never was updated for Trapped Chest. -If a Trapped Chest gets its Tile Entity corrupted, it will crash the server every time the chunk is loaded. - -This will now fix Trapped Chests too. - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 7823174..0d6f5af 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -122,7 +122,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { - TileEntity result = super.getTileEntity(pos); - Block type = getType(pos).getBlock(); - -- if (type == Blocks.CHEST) { -+ if (type == Blocks.CHEST || type == Blocks.TRAPPED_CHEST) { // Spigot - if (!(result instanceof TileEntityChest)) { - result = fixTileEntity(pos, type, result); - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0131-Remove-uneeded-validation.patch b/CraftBukkit-Patches/0131-Remove-uneeded-validation.patch deleted file mode 100644 index a2163f6f6c..0000000000 --- a/CraftBukkit-Patches/0131-Remove-uneeded-validation.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 42e2a4e371d3257d5ae94cde52f3552f2b11d0a4 Mon Sep 17 00:00:00 2001 -From: drXor -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 2dac846..e3d3424 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -239,7 +239,7 @@ class CraftMetaItem implements ItemMeta, Repairable { - this.lore = new ArrayList(meta.lore); - } - -- if (meta.hasEnchants()) { -+ if (meta.enchantments != null) { // Spigot - this.enchantments = new HashMap(meta.enchantments); - } - -@@ -572,7 +572,7 @@ class CraftMetaItem implements ItemMeta, Repairable { - } - - static void applyEnchantments(Map enchantments, NBTTagCompound tag, ItemMetaKey key) { -- if (enchantments == null || enchantments.size() == 0) { -+ if (enchantments == null /*|| enchantments.size() == 0*/) { // Spigot - remove size check - return; - } - -@@ -659,7 +659,14 @@ class CraftMetaItem implements ItemMeta, Repairable { - } - - public boolean removeEnchant(Enchantment ench) { -- return hasEnchants() && enchantments.remove(ench) != null; -+ // Spigot start -+ boolean b = hasEnchants() && enchantments.remove( ench ) != null; -+ if ( enchantments != null && enchantments.isEmpty() ) -+ { -+ this.enchantments = null; -+ } -+ return b; -+ // Spigot end - } - - public boolean hasEnchants() { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0132-Add-Hunger-Config-Values.patch b/CraftBukkit-Patches/0132-Add-Hunger-Config-Values.patch deleted file mode 100644 index a10a2f65ba..0000000000 --- a/CraftBukkit-Patches/0132-Add-Hunger-Config-Values.patch +++ /dev/null @@ -1,68 +0,0 @@ -From ab1a2c66d0382cb2bf7fe5413578a1482cf564e6 Mon Sep 17 00:00:00 2001 -From: lazertester -Date: Sun, 17 Aug 2014 19:56:17 +1000 -Subject: [PATCH] Add Hunger Config Values - - -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 41619c1..6e40e60 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1140,7 +1140,7 @@ public abstract class EntityHuman extends EntityLiving { - } - } - -- this.applyExhaustion(0.3F); -+ this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value - } else { - this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dY, this.bz(), 1.0F, 1.0F); - if (flag4) { -@@ -1407,9 +1407,9 @@ public abstract class EntityHuman extends EntityLiving { - super.ch(); - this.b(StatisticList.w); - if (this.isSprinting()) { -- this.applyExhaustion(0.8F); -+ this.applyExhaustion(world.spigotConfig.sprintExhaustion); // Spigot - Change to use configurable value - } else { -- this.applyExhaustion(0.2F); -+ this.applyExhaustion(world.spigotConfig.walkExhaustion); // Spigot - Change to use configurable value - } - - } -diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java -index 6974045..1a24336 100644 ---- a/src/main/java/net/minecraft/server/FoodMetaData.java -+++ b/src/main/java/net/minecraft/server/FoodMetaData.java -@@ -73,7 +73,7 @@ public class FoodMetaData { - ++this.foodTickTimer; - if (this.foodTickTimer >= 80) { - entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason -- this.a(4.0F); -+ this.a(entityhuman.world.spigotConfig.regenExhaustion); // Spigot - Change to use configurable value - this.foodTickTimer = 0; - } - } else if (this.foodLevel <= 0) { -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 7cf8f2d..4cbcd14 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -252,4 +252,16 @@ public class SpigotWorldConfig - largeFeatureSeed = getInt( "seed-feature", 14357617 ); - log( "Custom Map Seeds: Village: " + villageSeed + " Feature: " + largeFeatureSeed ); - } -+ -+ public float walkExhaustion; -+ public float sprintExhaustion; -+ public float combatExhaustion; -+ public float regenExhaustion; -+ private void initHunger() -+ { -+ walkExhaustion = (float) getDouble( "hunger.walk-exhaustion", 0.2 ); -+ sprintExhaustion = (float) getDouble( "hunger.sprint-exhaustion", 0.8 ); -+ combatExhaustion = (float) getDouble( "hunger.combat-exhaustion", 0.3 ); -+ regenExhaustion = (float) getDouble( "hunger.regen-exhaustion", 3 ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0133-Make-debug-logging-togglable.patch b/CraftBukkit-Patches/0133-Make-debug-logging-togglable.patch deleted file mode 100644 index 987b23ac8c..0000000000 --- a/CraftBukkit-Patches/0133-Make-debug-logging-togglable.patch +++ /dev/null @@ -1,67 +0,0 @@ -From e20fadfcb0b56c690c29ebd4acddc0b1bc100814 Mon Sep 17 00:00:00 2001 -From: Minecrell -Date: Sun, 17 Aug 2014 12:42:53 +0200 -Subject: [PATCH] Make debug logging togglable. - - -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index a187598..f6a67d6 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -17,6 +17,9 @@ import gnu.trove.map.hash.TObjectIntHashMap; - import net.minecraft.server.AttributeRanged; - import net.minecraft.server.GenericAttributes; - import net.minecraft.server.MinecraftServer; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.core.LoggerContext; -+import org.apache.logging.log4j.core.config.Configuration; - import org.bukkit.Bukkit; - import org.bukkit.ChatColor; - import org.bukkit.command.Command; -@@ -361,4 +364,27 @@ public class SpigotConfig - attackDamage = getDouble( "settings.attribute.attackDamage.max", attackDamage ); - ( (AttributeRanged) GenericAttributes.ATTACK_DAMAGE ).b = attackDamage; - } -+ -+ public static boolean debug; -+ private static void debug() -+ { -+ debug = getBoolean( "settings.debug", false ); -+ -+ if ( debug && !LogManager.getRootLogger().isTraceEnabled() ) -+ { -+ // Enable debug logging -+ LoggerContext ctx = (LoggerContext) LogManager.getContext( false ); -+ Configuration conf = ctx.getConfiguration(); -+ conf.getLoggerConfig( LogManager.ROOT_LOGGER_NAME ).setLevel( org.apache.logging.log4j.Level.ALL ); -+ ctx.updateLoggers( conf ); -+ } -+ -+ if ( LogManager.getRootLogger().isTraceEnabled() ) -+ { -+ Bukkit.getLogger().info( "Debug logging is enabled" ); -+ } else -+ { -+ Bukkit.getLogger().info( "Debug logging is disabled" ); -+ } -+ } - } -diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml -index 08d68aa..f37d1c2 100644 ---- a/src/main/resources/log4j2.xml -+++ b/src/main/resources/log4j2.xml -@@ -18,9 +18,9 @@ - - - -- -+ - -- -+ - - - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0134-Skip-invalid-enchants-in-CraftMetaItem.patch b/CraftBukkit-Patches/0134-Skip-invalid-enchants-in-CraftMetaItem.patch deleted file mode 100644 index aa0f4f4e17..0000000000 --- a/CraftBukkit-Patches/0134-Skip-invalid-enchants-in-CraftMetaItem.patch +++ /dev/null @@ -1,29 +0,0 @@ -From c54023cbcbbe58062508491bb0491dbb821dd71d Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Tue, 19 Aug 2014 11:04:21 +0100 -Subject: [PATCH] Skip invalid enchants in CraftMetaItem - -Its a rare case but when loading a world from a modded server which added enchantments -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 e3d3424..dcb9252 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 { - int id = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_ID.NBT); - int level = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_LVL.NBT); - -- enchantments.put(Enchantment.getById(id), level); -+ // Spigot start - skip invalid enchantments -+ Enchantment e = Enchantment.getById(id); -+ if (e == null) continue; -+ // Spigot end -+ enchantments.put(e, level); - } - - return enchantments; --- -2.5.0 - diff --git a/CraftBukkit-Patches/0135-Limit-TNT-Detonations-per-tick.patch b/CraftBukkit-Patches/0135-Limit-TNT-Detonations-per-tick.patch deleted file mode 100644 index 15b9b1a902..0000000000 --- a/CraftBukkit-Patches/0135-Limit-TNT-Detonations-per-tick.patch +++ /dev/null @@ -1,55 +0,0 @@ -From e9a46ef63c6712195a25c4d7eebb571759487cc1 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 20 Aug 2014 18:12:32 -0400 -Subject: [PATCH] Limit TNT Detonations per tick - -This gives a per-world control on how much TNT will be processed per-tick, -preventing a massive TNT detonation from lagging out the server. - -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index e467aff..35ed2a6 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -45,6 +45,7 @@ public class EntityTNTPrimed extends Entity { - } - - public void m() { -+ if (world.spigotConfig.currentPrimedTnt++ > world.spigotConfig.maxTntTicksPerTick) { return; } // Spigot - this.lastX = this.locX; - this.lastY = this.locY; - this.lastZ = this.locZ; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index b666996..46004f0 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -626,6 +626,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { - - this.worldProvider.r(); - super.tickEntities(); -+ spigotConfig.currentPrimedTnt = 0; // Spigot - } - - protected void l() { -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 4cbcd14..a4d7ebb 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -264,4 +264,15 @@ public class SpigotWorldConfig - combatExhaustion = (float) getDouble( "hunger.combat-exhaustion", 0.3 ); - regenExhaustion = (float) getDouble( "hunger.regen-exhaustion", 3 ); - } -+ -+ public int currentPrimedTnt = 0; -+ public int maxTntTicksPerTick; -+ private void maxTntPerTick() { -+ if ( SpigotConfig.version < 7 ) -+ { -+ set( "max-tnt-per-tick", 100 ); -+ } -+ maxTntTicksPerTick = getInt( "max-tnt-per-tick", 100 ); -+ log( "Max TNT Explosions: " + maxTntTicksPerTick ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0136-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch b/CraftBukkit-Patches/0136-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch deleted file mode 100644 index e838af3e3c..0000000000 --- a/CraftBukkit-Patches/0136-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 218a2ff7f819369481e1cbcd2d6cc2cc0926f4c0 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 3a2d0d8..22cc267 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -217,6 +217,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"); -+ @Specific(Specific.To.NBT) -+ static final ItemMetaKey UNBREAKABLE = new ItemMetaKey("Unbreakable"); // Spigot - - private String displayName; - private List lore; -@@ -246,6 +248,7 @@ class CraftMetaItem implements ItemMeta, Repairable { - this.repairCost = meta.repairCost; - this.hideFlag = meta.hideFlag; - this.unhandledTags.putAll(meta.unhandledTags); -+ spigot.setUnbreakable( meta.spigot.isUnbreakable() ); // Spigot - } - - CraftMetaItem(NBTTagCompound tag) { -@@ -446,6 +449,12 @@ class CraftMetaItem implements ItemMeta, Repairable { - unhandledTags.put(key, tag.get(key)); - } - } -+ // Spigot start -+ if ( tag.hasKey( UNBREAKABLE.NBT ) ) -+ { -+ spigot.setUnbreakable( tag.getBoolean( UNBREAKABLE.NBT ) ); -+ } -+ // Spigot end - } - - static Map buildEnchantments(NBTTagCompound tag, ItemMetaKey key) { -@@ -498,6 +507,14 @@ class CraftMetaItem implements ItemMeta, Repairable { - } - } - -+ // Spigot start -+ Boolean unbreakable = SerializableMeta.getObject( Boolean.class, map, UNBREAKABLE.BUKKIT, true ); -+ if ( unbreakable != null ) -+ { -+ spigot.setUnbreakable( unbreakable ); -+ } -+ // Spigot end -+ - String internal = SerializableMeta.getString(map, "internal", true); - if (internal != null) { - ByteArrayInputStream buf = new ByteArrayInputStream(Base64.decodeBase64(internal)); -@@ -552,6 +569,14 @@ 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); -@@ -611,7 +636,7 @@ class CraftMetaItem implements ItemMeta, Repairable { - - @Overridden - boolean isEmpty() { -- return !(hasDisplayName() || hasEnchants() || hasLore() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0); -+ return !(hasDisplayName() || hasEnchants() || hasLore() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0 || spigot.isUnbreakable()); // Spigot - } - - public String getDisplayName() { -@@ -769,7 +794,8 @@ class CraftMetaItem implements ItemMeta, Repairable { - && (this.hasLore() ? that.hasLore() && this.lore.equals(that.lore) : !that.hasLore()) - && (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost()) - && (this.unhandledTags.equals(that.unhandledTags)) -- && (this.hideFlag == that.hideFlag); -+ && (this.hideFlag == that.hideFlag) -+ && (this.spigot.isUnbreakable() == that.spigot.isUnbreakable()); // Spigot - } - - /** -@@ -796,6 +822,7 @@ class CraftMetaItem implements ItemMeta, Repairable { - hash = 61 * hash + (hasRepairCost() ? this.repairCost : 0); - hash = 61 * hash + unhandledTags.hashCode(); - hash = 61 * hash + hideFlag; -+ hash = 61 * hash + (spigot.isUnbreakable() ? 1231 : 1237); // Spigot - return hash; - } - -@@ -839,6 +866,14 @@ class CraftMetaItem implements ItemMeta, Repairable { - if (hasRepairCost()) { - builder.put(REPAIR.BUKKIT, repairCost); - } -+ -+ // Spigot start -+ if ( spigot.isUnbreakable() ) -+ { -+ builder.put( UNBREAKABLE.BUKKIT, true ); -+ } -+ // Spigot end -+ - - Set hideFlags = new HashSet(); - for (ItemFlag hideFlagEnum : getItemFlags()) { -@@ -930,6 +965,7 @@ class CraftMetaItem implements ItemMeta, Repairable { - synchronized (HANDLED_TAGS) { - if (HANDLED_TAGS.isEmpty()) { - HANDLED_TAGS.addAll(Arrays.asList( -+ UNBREAKABLE.NBT, // Spigot - DISPLAY.NBT, - REPAIR.NBT, - ENCHANTMENTS.NBT, -@@ -958,6 +994,19 @@ 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 --- -2.5.0 - diff --git a/CraftBukkit-Patches/0137-Configurable-Hanging-Tick.patch b/CraftBukkit-Patches/0137-Configurable-Hanging-Tick.patch deleted file mode 100644 index b0bd1fd325..0000000000 --- a/CraftBukkit-Patches/0137-Configurable-Hanging-Tick.patch +++ /dev/null @@ -1,37 +0,0 @@ -From f3190586ed2e1760267ef859761294383c4ec07c Mon Sep 17 00:00:00 2001 -From: drXor -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 -index 0ff4df1..947c777 100644 ---- a/src/main/java/net/minecraft/server/EntityHanging.java -+++ b/src/main/java/net/minecraft/server/EntityHanging.java -@@ -103,7 +103,7 @@ public abstract class EntityHanging extends Entity { - this.lastX = this.locX; - this.lastY = this.locY; - this.lastZ = this.locZ; -- if (this.d++ == 100 && !this.world.isClientSide) { -+ if (this.d++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isClientSide) { // Spigot - this.d = 0; - if (!this.dead && !this.survives()) { - // CraftBukkit start - fire break events -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index a4d7ebb..8b40760 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -275,4 +275,10 @@ public class SpigotWorldConfig - maxTntTicksPerTick = getInt( "max-tnt-per-tick", 100 ); - log( "Max TNT Explosions: " + maxTntTicksPerTick ); - } -+ -+ public int hangingTickFrequency; -+ private void hangingTickFrequency() -+ { -+ hangingTickFrequency = getInt( "hanging-tick-frequency", 100 ); -+ } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0138-Refactor-ItemDoor-Place.patch b/CraftBukkit-Patches/0138-Refactor-ItemDoor-Place.patch deleted file mode 100644 index 258c4285cb..0000000000 --- a/CraftBukkit-Patches/0138-Refactor-ItemDoor-Place.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 02237184015ff86418a374b78dd54607433e0ff5 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 30 Sep 2014 21:43:15 +1000 -Subject: [PATCH] Refactor ItemDoor Place - - -diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java -index 669940a..adaa131 100644 ---- a/src/main/java/net/minecraft/server/ItemDoor.java -+++ b/src/main/java/net/minecraft/server/ItemDoor.java -@@ -58,9 +58,11 @@ public class ItemDoor extends Item { - boolean flag3 = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition3); - IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag ? BlockDoor.EnumDoorHinge.RIGHT : BlockDoor.EnumDoorHinge.LEFT).set(BlockDoor.POWERED, Boolean.valueOf(flag3)).set(BlockDoor.OPEN, Boolean.valueOf(flag3)); - -- world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2); -- world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2); -- world.applyPhysics(blockposition, block); -- world.applyPhysics(blockposition3, block); -+ // Spigot start - update physics after the block multi place event -+ world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 3); -+ world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 3); -+ // world.applyPhysics(blockposition, block); -+ // world.applyPhysics(blockposition3, block); -+ // Spigot end - } - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0139-BungeeCord-Chat-API.patch b/CraftBukkit-Patches/0139-BungeeCord-Chat-API.patch deleted file mode 100644 index e698fe9c47..0000000000 --- a/CraftBukkit-Patches/0139-BungeeCord-Chat-API.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 24e6c6941fbbb67401365dea9f85460add367e33 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 13 Dec 2014 13:06:05 +1100 -Subject: [PATCH] BungeeCord Chat API - - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index c5147b6..c0e1199 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -5,6 +5,7 @@ import java.io.IOException; - public class PacketPlayOutChat implements Packet { - - private IChatBaseComponent a; -+ public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot - private byte b; - - public PacketPlayOutChat() {} -@@ -24,7 +25,13 @@ public class PacketPlayOutChat implements Packet { - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { -- packetdataserializer.a(this.a); -+ // Spigot start -+ if (components != null) { -+ packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); -+ } else { -+ packetdataserializer.a(this.a); -+ } -+ // Spigot end - packetdataserializer.writeByte(this.b); - } - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index cabb3e5..7831a12 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -126,6 +126,7 @@ import io.netty.buffer.ByteBufOutputStream; - import io.netty.buffer.Unpooled; - import io.netty.handler.codec.base64.Base64; - import jline.console.ConsoleReader; -+import net.md_5.bungee.api.chat.BaseComponent; - - public final class CraftServer implements Server { - private static final Player[] EMPTY_PLAYER_ARRAY = new Player[0]; -@@ -1721,6 +1722,20 @@ public final class CraftServer implements Server { - public void restart() { - org.spigotmc.RestartCommand.restart(); - } -+ -+ @Override -+ public void broadcast(BaseComponent component) { -+ for (Player player : getOnlinePlayers()) { -+ player.spigot().sendMessage(component); -+ } -+ } -+ -+ @Override -+ public void broadcast(BaseComponent... components) { -+ for (Player player : getOnlinePlayers()) { -+ player.spigot().sendMessage(components); -+ } -+ } - }; - - public Spigot spigot() -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 8fefb1f..250f112 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -19,6 +19,7 @@ import java.util.Set; - import java.util.UUID; - import java.util.logging.Level; - import java.util.logging.Logger; -+import net.md_5.bungee.api.chat.BaseComponent; - - import net.minecraft.server.*; - import net.minecraft.server.PacketPlayOutTitle.EnumTitleAction; -@@ -1517,6 +1518,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - - return java.util.Collections.unmodifiableSet( ret ); - } -+ -+ @Override -+ public void sendMessage(BaseComponent component) { -+ sendMessage( new BaseComponent[] { component } ); -+ } -+ -+ @Override -+ public void sendMessage(BaseComponent... components) { -+ if ( getHandle().playerConnection == null ) return; -+ -+ PacketPlayOutChat packet = new PacketPlayOutChat(); -+ packet.components = components; -+ getHandle().playerConnection.sendPacket(packet); -+ } - }; - - public Player.Spigot spigot() --- -2.5.0 - diff --git a/CraftBukkit-Patches/0140-Use-Standard-List-for-EntitySlices.patch b/CraftBukkit-Patches/0140-Use-Standard-List-for-EntitySlices.patch deleted file mode 100644 index 4487409aea..0000000000 --- a/CraftBukkit-Patches/0140-Use-Standard-List-for-EntitySlices.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 77134a53b8c718b84e50cb28cf1c24f5621763bf Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 20 Feb 2015 21:33:36 +1100 -Subject: [PATCH] Use Standard List for EntitySlices. - - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 277a6ad..f2bb134 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -32,7 +32,7 @@ public class Chunk { - public final int locZ; - private boolean l; - public final Map tileEntities; -- public final EntitySlice[] entitySlices; -+ public final List[] entitySlices; // Spigot - private boolean done; - private boolean lit; - private boolean q; -@@ -81,14 +81,14 @@ public class Chunk { - this.tileEntities = Maps.newHashMap(); - this.w = 4096; - this.x = Queues.newConcurrentLinkedQueue(); -- this.entitySlices = (EntitySlice[]) (new EntitySlice[16]); -+ this.entitySlices = (List[]) (new List[16]); // Spigot - this.world = world; - this.locX = i; - this.locZ = j; - this.heightMap = new int[256]; - - for (int k = 0; k < this.entitySlices.length; ++k) { -- this.entitySlices[k] = new EntitySlice(Entity.class); -+ this.entitySlices[k] = new org.bukkit.craftbukkit.util.UnsafeList(); // Spigot - } - - Arrays.fill(this.g, -999); -@@ -857,12 +857,12 @@ public class Chunk { - j = MathHelper.clamp(j, 0, this.entitySlices.length - 1); - - for (int k = i; k <= j; ++k) { -- Iterator iterator = this.entitySlices[k].c(oclass).iterator(); -+ Iterator iterator = this.entitySlices[k].iterator(); // Spigot - - while (iterator.hasNext()) { - Entity entity = (Entity) iterator.next(); - -- if (entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply((T) entity))) { // CraftBukkit - fix decompile error -+ if (oclass.isInstance(entity) && entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply((T) entity))) { // CraftBukkit - fix decompile error // Spigot - list.add((T) entity); // Fix decompile error - } - } -@@ -1260,7 +1260,7 @@ public class Chunk { - return this.tileEntities; - } - -- public EntitySlice[] getEntitySlices() { -+ public List[] getEntitySlices() { - return this.entitySlices; - } - -diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 70d8ab1..d88f1b1 100644 ---- a/src/main/java/org/spigotmc/ActivationRange.java -+++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -1,5 +1,6 @@ - package org.spigotmc; - -+import java.util.List; - import java.util.Set; - import net.minecraft.server.AxisAlignedBB; - import net.minecraft.server.Chunk; -@@ -140,9 +141,9 @@ public class ActivationRange - */ - private static void activateChunkEntities(Chunk chunk) - { -- for ( EntitySlice slice : chunk.entitySlices ) -+ for ( List slice : chunk.entitySlices ) - { -- for ( Entity entity : (Set) slice ) -+ for ( Entity entity : slice ) - { - if ( MinecraftServer.currentTick > entity.activatedTick ) - { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0141-Allow-Capping-Tile-Entity-Tick-Time.patch b/CraftBukkit-Patches/0141-Allow-Capping-Tile-Entity-Tick-Time.patch deleted file mode 100644 index 7a521ea02f..0000000000 --- a/CraftBukkit-Patches/0141-Allow-Capping-Tile-Entity-Tick-Time.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 48d0b867419f0e56e63caa672b460fcffcba4761 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 20 Feb 2015 21:39:31 +1100 -Subject: [PATCH] Allow Capping (Tile)Entity Tick Time. - -This patch adds world configuration options for max-tick-time.entity / max-tick-time.tile which allows setting a hard cap on the amount of time (in milliseconds) that a tick can consume. The default values of 50ms each are very conservative and mean this feature will not activate until the server is well below 15tps (minimum). Values of 20ms each have been reported to provide a good performance increase, however I personally think 25ms for entities and 10-15ms for tiles would give even more significant gains, assuming that these things are not a large priority on your server. - -For tiles there is very little tradeoff for this option, as tile ticks are based on wall time for most things, however for entities setting this option too low could lead to jerkiness / lag. The gain however is a faster and more responsive server to other actions such as blocks, chat, combat etc. - -This feature was commisioned by Chunkr. - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 8ad0aa2..b5fa1a2 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -129,6 +129,9 @@ public abstract class World implements IBlockAccess { - private boolean guardEntityList; // Spigot - public static boolean haveWeSilencedAPhysicsCrash; - public static String blockLocation; -+ private org.spigotmc.TickLimiter entityLimiter; -+ private org.spigotmc.TickLimiter tileLimiter; -+ private int tileTickPosition; - - public CraftWorld getWorld() { - return this.world; -@@ -192,6 +195,8 @@ public abstract class World implements IBlockAccess { - this.getServer().addWorld(this.world); - // CraftBukkit end - timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings -+ this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); -+ this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); - } - - public World b() { -@@ -1390,7 +1395,12 @@ public abstract class World implements IBlockAccess { - timings.entityTick.startTiming(); // Spigot - guardEntityList = true; // Spigot - // CraftBukkit start - Use field for loop variable -- for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) { -+ int entitiesThisCycle = 0; -+ if (tickPosition < 0) tickPosition = 0; -+ for (entityLimiter.initTick(); -+ entitiesThisCycle < entityList.size() && (entitiesThisCycle % 10 != 0 || entityLimiter.shouldContinue()); -+ tickPosition++, entitiesThisCycle++) { -+ tickPosition = (tickPosition < entityList.size()) ? tickPosition : 0; - entity = (Entity) this.entityList.get(this.tickPosition); - // CraftBukkit end - Entity entity1 = entity.by(); -@@ -1447,14 +1457,20 @@ public abstract class World implements IBlockAccess { - this.tileEntityListUnload.clear(); - } - // CraftBukkit end -- Iterator iterator = this.tileEntityListTick.iterator(); - -- while (iterator.hasNext()) { -- TileEntity tileentity = (TileEntity) iterator.next(); -+ // Spigot start -+ // Iterator iterator = this.tileEntityListTick.iterator(); -+ int tilesThisCycle = 0; -+ for (tileLimiter.initTick(); -+ tilesThisCycle < tileEntityListTick.size() && (tilesThisCycle % 10 != 0 || tileLimiter.shouldContinue()); -+ tileTickPosition++, tilesThisCycle++) { -+ tileTickPosition = (tileTickPosition < tileEntityListTick.size()) ? tileTickPosition : 0; -+ TileEntity tileentity = (TileEntity) this.tileEntityListTick.get(tileTickPosition); - // Spigot start - if (tileentity == null) { - getServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash"); -- iterator.remove(); -+ tilesThisCycle--; -+ this.tileEntityListTick.remove(tileTickPosition--); - continue; - } - // Spigot end -@@ -1483,7 +1499,8 @@ public abstract class World implements IBlockAccess { - } - - if (tileentity.x()) { -- iterator.remove(); -+ tilesThisCycle--; -+ this.tileEntityListTick.remove(tileTickPosition--); - this.tileEntityList.remove(tileentity); - if (this.isLoaded(tileentity.getPosition())) { - this.getChunkAtWorldCoords(tileentity.getPosition()).d(tileentity.getPosition()); -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 8b40760..43242a8 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -281,4 +281,13 @@ public class SpigotWorldConfig - { - hangingTickFrequency = getInt( "hanging-tick-frequency", 100 ); - } -+ -+ public int tileMaxTickTime; -+ public int entityMaxTickTime; -+ private void maxTickTimes() -+ { -+ tileMaxTickTime = getInt("max-tick-time.tile", 50); -+ entityMaxTickTime = getInt("max-tick-time.entity", 50); -+ log("Tile Max Tick Time: " + tileMaxTickTime + "ms Entity max Tick Time: " + entityMaxTickTime + "ms"); -+ } - } -diff --git a/src/main/java/org/spigotmc/TickLimiter.java b/src/main/java/org/spigotmc/TickLimiter.java -new file mode 100644 -index 0000000..23a3938 ---- /dev/null -+++ b/src/main/java/org/spigotmc/TickLimiter.java -@@ -0,0 +1,20 @@ -+package org.spigotmc; -+ -+public class TickLimiter { -+ -+ private final int maxTime; -+ private long startTime; -+ -+ public TickLimiter(int maxtime) { -+ this.maxTime = maxtime; -+ } -+ -+ public void initTick() { -+ startTime = System.currentTimeMillis(); -+ } -+ -+ public boolean shouldContinue() { -+ long remaining = System.currentTimeMillis() - startTime; -+ return remaining < maxTime; -+ } -+} --- -2.5.0 - diff --git a/CraftBukkit-Patches/0142-Use-FastMatches-for-ItemStack-Dirty-Check.patch b/CraftBukkit-Patches/0142-Use-FastMatches-for-ItemStack-Dirty-Check.patch deleted file mode 100644 index 019c2186f2..0000000000 --- a/CraftBukkit-Patches/0142-Use-FastMatches-for-ItemStack-Dirty-Check.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 26db98024cc859fced8580668b483410732d6dc8 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 22 Feb 2015 12:27:40 +1100 -Subject: [PATCH] Use FastMatches for ItemStack Dirty Check - -The check to find dirty itemstacks and send update packets each tick can be very intensive as it checks the entire itemstack, including the entire NBT map. To save on this, 19/20 times we will simply compare the basic count/data/type. If for some strange reason the NBT of an item already existing in an inventory is changes, it will take up to 1 second to show, with an average time of half a second. This odd 0.5 second delay is far preferable to lag every tick, and shouldn't be noticed by anyone. - -diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java -index 1d6ec51..000b4db 100644 ---- a/src/main/java/net/minecraft/server/Container.java -+++ b/src/main/java/net/minecraft/server/Container.java -@@ -28,6 +28,7 @@ public abstract class Container { - private final Set h = Sets.newHashSet(); - protected List listeners = Lists.newArrayList(); - private Set i = Sets.newHashSet(); -+ private int tickCount; // Spigot - - // CraftBukkit start - public boolean checkReachable = true; -@@ -75,7 +76,7 @@ public abstract class Container { - ItemStack itemstack = ((Slot) this.c.get(i)).getItem(); - ItemStack itemstack1 = (ItemStack) this.b.get(i); - -- if (!ItemStack.matches(itemstack1, itemstack)) { -+ if (!ItemStack.fastMatches(itemstack1, itemstack) || (tickCount % 20 == 0 && !ItemStack.matches(itemstack1, itemstack))) { // Spigot - itemstack1 = itemstack == null ? null : itemstack.cloneItemStack(); - this.b.set(i, itemstack1); - -@@ -84,6 +85,7 @@ public abstract class Container { - } - } - } -+ tickCount++; // Spigot - - } - -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 4a43208..d9d61ef 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -451,6 +451,18 @@ public final class ItemStack { - return itemstack == null && itemstack1 == null ? true : (itemstack != null && itemstack1 != null ? (itemstack.tag == null && itemstack1.tag != null ? false : itemstack.tag == null || itemstack.tag.equals(itemstack1.tag)) : false); - } - -+ // Spigot Start -+ public static boolean fastMatches(ItemStack itemstack, ItemStack itemstack1) { -+ if (itemstack == null && itemstack1 == null) { -+ return true; -+ } -+ if (itemstack != null && itemstack1 != null) { -+ return itemstack.count == itemstack1.count && itemstack.item == itemstack1.item && itemstack.damage == itemstack1.damage; -+ } -+ return false; -+ } -+ // Spigot End -+ - public static boolean matches(ItemStack itemstack, ItemStack itemstack1) { - return itemstack == null && itemstack1 == null ? true : (itemstack != null && itemstack1 != null ? itemstack.e(itemstack1) : false); - } --- -2.5.0 - diff --git a/CraftBukkit-Patches/0143-Use-CLQ-for-main-thread-tasks.patch b/CraftBukkit-Patches/0143-Use-CLQ-for-main-thread-tasks.patch deleted file mode 100644 index 57c8c7d4a6..0000000000 --- a/CraftBukkit-Patches/0143-Use-CLQ-for-main-thread-tasks.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 07b0592001e94be3e44f3df2f45214be3a861bb5 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 19 Apr 2015 09:19:39 +1000 -Subject: [PATCH] Use CLQ for main thread tasks. - - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 866148d..4cc436d 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -98,7 +98,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - private final GameProfileRepository W; - private final UserCache X; - private long Y = 0L; -- protected final Queue> j = Queues.newArrayDeque(); -+ protected final Queue> j = new java.util.concurrent.ConcurrentLinkedQueue>(); // Spigot, PAIL: Rename - private Thread serverThread; - private long aa = av(); - -@@ -714,11 +714,13 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - this.methodProfiler.a("jobs"); - Queue queue = this.j; - -- synchronized (this.j) { -- while (!this.j.isEmpty()) { -- SystemUtils.a((FutureTask) this.j.poll(), MinecraftServer.LOGGER); -- } -- } -+ // Spigot start -+ FutureTask entry; -+ int count = this.j.size(); -+ while (count-- > 0 && (entry = this.j.poll()) != null) { -+ SystemUtils.a(entry, MinecraftServer.LOGGER); -+ } -+ // Spigot end - - this.methodProfiler.c("levels"); - -@@ -1481,10 +1483,10 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable); - Queue queue = this.j; - -- synchronized (this.j) { -- this.j.add(listenablefuturetask); -- return listenablefuturetask; -- } -+ // Spigot start -+ this.j.add(listenablefuturetask); -+ return listenablefuturetask; -+ // Spigot end - } else { - try { - return Futures.immediateFuture(callable.call()); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0144-map-decoration-fix.patch b/CraftBukkit-Patches/0144-map-decoration-fix.patch deleted file mode 100644 index b87ed83d9e..0000000000 --- a/CraftBukkit-Patches/0144-map-decoration-fix.patch +++ /dev/null @@ -1,126 +0,0 @@ -From 6b40527380526915e7a782674806510418b98bcd Mon Sep 17 00:00:00 2001 -From: Antony Riley -Date: Sun, 26 Apr 2015 02:14:13 +0300 -Subject: [PATCH] map decoration fix - - -diff --git a/src/main/java/net/minecraft/server/EntityItemFrame.java b/src/main/java/net/minecraft/server/EntityItemFrame.java -index 1a9b5cc..1d9f569 100644 ---- a/src/main/java/net/minecraft/server/EntityItemFrame.java -+++ b/src/main/java/net/minecraft/server/EntityItemFrame.java -@@ -1,5 +1,7 @@ - package net.minecraft.server; - -+import java.util.UUID; -+import org.apache.commons.codec.Charsets; - import com.google.common.base.Optional; - - public class EntityItemFrame extends EntityHanging { -@@ -95,7 +97,7 @@ public class EntityItemFrame extends EntityHanging { - if (itemstack.getItem() == Items.FILLED_MAP) { - WorldMap worldmap = ((ItemWorldMap) itemstack.getItem()).getSavedMap(itemstack, this.world); - -- worldmap.decorations.remove("frame-" + this.getId()); -+ worldmap.decorations.remove(UUID.nameUUIDFromBytes(("frame-" + this.getId()).getBytes(Charsets.US_ASCII))); // Spigot - } - - itemstack.a((EntityItemFrame) null); -diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java -index d0d7c9d..e090fea 100644 ---- a/src/main/java/net/minecraft/server/WorldMap.java -+++ b/src/main/java/net/minecraft/server/WorldMap.java -@@ -1,5 +1,6 @@ - package net.minecraft.server; - -+import com.google.common.base.Charsets; - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; - import java.util.Iterator; -@@ -24,7 +25,7 @@ public class WorldMap extends PersistentBase { - public byte[] colors = new byte[16384]; - public List h = Lists.newArrayList(); - public Map j = Maps.newHashMap(); // Spigot -- public Map decorations = Maps.newLinkedHashMap(); -+ public Map decorations = Maps.newLinkedHashMap(); // Spigot - - // CraftBukkit start - public final CraftMapView mapView; -@@ -152,7 +153,7 @@ public class WorldMap extends PersistentBase { - } - - if (!entityhuman.inventory.f(itemstack)) { -- this.decorations.remove(entityhuman.getName()); -+ this.decorations.remove(entityhuman.getUniqueID()); // Spigot - } - - for (int i = 0; i < this.h.size(); ++i) { -@@ -160,7 +161,7 @@ public class WorldMap extends PersistentBase { - - if (!worldmap_worldmaphumantracker1.trackee.dead && (worldmap_worldmaphumantracker1.trackee.inventory.f(itemstack) || itemstack.y())) { - if (!itemstack.y() && worldmap_worldmaphumantracker1.trackee.dimension == this.map && this.track) { -- this.a(0, worldmap_worldmaphumantracker1.trackee.world, worldmap_worldmaphumantracker1.trackee.getName(), worldmap_worldmaphumantracker1.trackee.locX, worldmap_worldmaphumantracker1.trackee.locZ, (double) worldmap_worldmaphumantracker1.trackee.yaw); -+ this.a(0, worldmap_worldmaphumantracker1.trackee.world, worldmap_worldmaphumantracker1.trackee.getUniqueID(), worldmap_worldmaphumantracker1.trackee.locX, worldmap_worldmaphumantracker1.trackee.locZ, (double) worldmap_worldmaphumantracker1.trackee.yaw); // Spigot - } - } else { - this.j.remove(worldmap_worldmaphumantracker1.trackee); -@@ -172,7 +173,7 @@ public class WorldMap extends PersistentBase { - EntityItemFrame entityitemframe = itemstack.z(); - BlockPosition blockposition = entityitemframe.getBlockPosition(); - -- this.a(1, entityhuman.world, "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.direction.get2DRotationValue() * 90)); -+ this.a(1, entityhuman.world, UUID.nameUUIDFromBytes(("frame-" + entityitemframe.getId()).getBytes(Charsets.US_ASCII)), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.direction.get2DRotationValue() * 90)); // Spigot - } - - if (itemstack.hasTag() && itemstack.getTag().hasKeyOfType("Decorations", 9)) { -@@ -181,15 +182,18 @@ public class WorldMap extends PersistentBase { - for (int j = 0; j < nbttaglist.size(); ++j) { - NBTTagCompound nbttagcompound = nbttaglist.get(j); - -- if (!this.decorations.containsKey(nbttagcompound.getString("id"))) { -- this.a(nbttagcompound.getByte("type"), entityhuman.world, nbttagcompound.getString("id"), nbttagcompound.getDouble("x"), nbttagcompound.getDouble("z"), nbttagcompound.getDouble("rot")); -+ // Spigot - start -+ UUID uuid = UUID.nameUUIDFromBytes(nbttagcompound.getString("id").getBytes(Charsets.US_ASCII)); -+ if (!this.decorations.containsKey(uuid)) { -+ this.a(nbttagcompound.getByte("type"), entityhuman.world, uuid, nbttagcompound.getDouble("x"), nbttagcompound.getDouble("z"), nbttagcompound.getDouble("rot")); -+ // Spigot - end - } - } - } - - } - -- private void a(int i, World world, String s, double d0, double d1, double d2) { -+ private void a(int i, World world, UUID s, double d0, double d1, double d2) { - int j = 1 << this.scale; - float f = (float) (d0 - (double) this.centerX) / (float) j; - float f1 = (float) (d1 - (double) this.centerZ) / (float) j; -diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java -index d56a291..ad47bdd 100644 ---- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java -+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java -@@ -1,5 +1,6 @@ - package org.bukkit.craftbukkit.map; - -+import java.util.UUID; - import net.minecraft.server.WorldMap; - import net.minecraft.server.MapIcon; - -@@ -34,13 +35,12 @@ public class CraftMapRenderer extends MapRenderer { - cursors.removeCursor(cursors.getCursor(0)); - } - -- for (Object key : worldMap.decorations.keySet()) { -+ for (UUID key : worldMap.decorations.keySet()) { // Spigot string -> uuid. - // If this cursor is for a player check visibility with vanish system -- Player other = Bukkit.getPlayerExact((String) key); -+ Player other = Bukkit.getPlayer(key); // Spigot - if (other != null && !player.canSee(other)) { - continue; - } -- - - MapIcon decoration = (MapIcon) worldMap.decorations.get(key); - cursors.addCursor(decoration.getX(), decoration.getY(), (byte) (decoration.getRotation() & 15), decoration.getType()); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0145-Use-Map-for-getPlayer-String-lookup.patch b/CraftBukkit-Patches/0145-Use-Map-for-getPlayer-String-lookup.patch deleted file mode 100644 index dac7e44fd3..0000000000 --- a/CraftBukkit-Patches/0145-Use-Map-for-getPlayer-String-lookup.patch +++ /dev/null @@ -1,119 +0,0 @@ -From c6f91ad2c2077d4b5643b5f98cec026d7c55661d Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 13 Jul 2015 19:05:15 +1000 -Subject: [PATCH] Use Map for getPlayer(String) lookup. - - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 708c94c..08faf3a 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -65,6 +65,7 @@ public abstract class PlayerList { - - // CraftBukkit start - private CraftServer cserver; -+ private final Map playersByName = new org.spigotmc.CaseInsensitiveMap(); - - public PlayerList(MinecraftServer minecraftserver) { - this.cserver = minecraftserver.server = new CraftServer(minecraftserver, this); -@@ -321,6 +322,7 @@ public abstract class PlayerList { - - public void onPlayerJoin(EntityPlayer entityplayer, String joinMessage) { // CraftBukkit added param - this.players.add(entityplayer); -+ this.playersByName.put(entityplayer.getName(), entityplayer); // Spigot - this.j.put(entityplayer.getUniqueID(), entityplayer); - // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer})); // CraftBukkit - replaced with loop below - WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); -@@ -406,6 +408,7 @@ public abstract class PlayerList { - worldserver.kill(entityplayer); - worldserver.getPlayerChunkMap().removePlayer(entityplayer); - this.players.remove(entityplayer); -+ this.playersByName.remove(entityplayer.getName()); // Spigot - UUID uuid = entityplayer.getUniqueID(); - EntityPlayer entityplayer1 = (EntityPlayer) this.j.get(uuid); - -@@ -557,6 +560,7 @@ public abstract class PlayerList { - // entityplayer.x().getTracker().untrackEntity(entityplayer); // CraftBukkit - entityplayer.x().getPlayerChunkMap().removePlayer(entityplayer); - this.players.remove(entityplayer); -+ this.playersByName.remove(entityplayer.getName()); // Spigot - this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer); - BlockPosition blockposition = entityplayer.getBed(); - boolean flag1 = entityplayer.isRespawnForced(); -@@ -661,6 +665,7 @@ public abstract class PlayerList { - worldserver.getPlayerChunkMap().addPlayer(entityplayer1); - worldserver.addEntity(entityplayer1); - this.players.add(entityplayer1); -+ this.playersByName.put(entityplayer1.getName(), entityplayer1); // Spigot - this.j.put(entityplayer1.getUniqueID(), entityplayer1); - } - // entityplayer1.syncInventory(); -@@ -1129,19 +1134,7 @@ public abstract class PlayerList { - } - - public EntityPlayer getPlayer(String s) { -- Iterator iterator = this.players.iterator(); -- -- EntityPlayer entityplayer; -- -- do { -- if (!iterator.hasNext()) { -- return null; -- } -- -- entityplayer = (EntityPlayer) iterator.next(); -- } while (!entityplayer.getName().equalsIgnoreCase(s)); -- -- return entityplayer; -+ return this.playersByName.get(s); // Spigot - } - - public void sendPacketNearby(EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, Packet packet) { -diff --git a/src/main/java/org/spigotmc/CaseInsensitiveHashingStrategy.java b/src/main/java/org/spigotmc/CaseInsensitiveHashingStrategy.java -new file mode 100644 -index 0000000..aafdd36 ---- /dev/null -+++ b/src/main/java/org/spigotmc/CaseInsensitiveHashingStrategy.java -@@ -0,0 +1,18 @@ -+package org.spigotmc; -+ -+import gnu.trove.strategy.HashingStrategy; -+ -+class CaseInsensitiveHashingStrategy implements HashingStrategy { -+ -+ static final CaseInsensitiveHashingStrategy INSTANCE = new CaseInsensitiveHashingStrategy(); -+ -+ @Override -+ public int computeHashCode(Object object) { -+ return ((String) object).toLowerCase().hashCode(); -+ } -+ -+ @Override -+ public boolean equals(Object o1, Object o2) { -+ return o1.equals(o2) || (o1 instanceof String && o2 instanceof String && ((String) o1).toLowerCase().equals(((String) o2).toLowerCase())); -+ } -+} -diff --git a/src/main/java/org/spigotmc/CaseInsensitiveMap.java b/src/main/java/org/spigotmc/CaseInsensitiveMap.java -new file mode 100644 -index 0000000..1934fd5 ---- /dev/null -+++ b/src/main/java/org/spigotmc/CaseInsensitiveMap.java -@@ -0,0 +1,15 @@ -+package org.spigotmc; -+ -+import gnu.trove.map.hash.TCustomHashMap; -+import java.util.Map; -+ -+public class CaseInsensitiveMap extends TCustomHashMap { -+ -+ public CaseInsensitiveMap() { -+ super(CaseInsensitiveHashingStrategy.INSTANCE); -+ } -+ -+ public CaseInsensitiveMap(Map map) { -+ super(CaseInsensitiveHashingStrategy.INSTANCE, map); -+ } -+} --- -2.5.0 - diff --git a/CraftBukkit-Patches/0146-Clear-Packet-Queue-on-Disconnect.patch b/CraftBukkit-Patches/0146-Clear-Packet-Queue-on-Disconnect.patch deleted file mode 100644 index 5f5b0083f4..0000000000 --- a/CraftBukkit-Patches/0146-Clear-Packet-Queue-on-Disconnect.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 328d5299f11ac60682ca5cadfac7db5934f94ac1 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 22 Jul 2015 19:04:37 +1000 -Subject: [PATCH] Clear Packet Queue on Disconnect - - -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 4c6dfb1..a9ea3f5 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -316,6 +316,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - } else if (this.i() != null) { - this.i().a(new ChatComponentText("Disconnected")); - } -+ this.i.clear(); // Free up packet queue. - } - - } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index f354985..39ba550 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1084,7 +1084,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - } - - // CraftBukkit start -- if (packet == null) { -+ if (packet == null || this.processedDisconnect) { // Spigot - return; - } else if (packet instanceof PacketPlayOutSpawnPosition) { - PacketPlayOutSpawnPosition packet6 = (PacketPlayOutSpawnPosition) packet; --- -2.5.0 - diff --git a/CraftBukkit-Patches/0147-Optimize-Chunk-Saving-Memory-Allocation-and-Compress.patch b/CraftBukkit-Patches/0147-Optimize-Chunk-Saving-Memory-Allocation-and-Compress.patch deleted file mode 100644 index b2a13204bf..0000000000 --- a/CraftBukkit-Patches/0147-Optimize-Chunk-Saving-Memory-Allocation-and-Compress.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 8d76759534a15987f4f6a35afe74c7f64f61437f Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 29 Aug 2015 13:59:25 -0400 -Subject: [PATCH] Optimize Chunk Saving Memory Allocation and Compression - -Minecraft ineffeciently uses OutputStreams by calling .write(int) on the stream. -For Chunks, this is a DeflaterOutputStream, which allocates a single byte EVERY write. - -This is causing the server to allocate tons of new byte[1] objects. -Additionally, this is very ineffecient for the Deflate process. - -By Buffering Writes the same way it already is Buffering Reads, we will -write to the stream much more effeciently. - -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index b6f0c0b..1cd8be8 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -171,8 +171,9 @@ public class RegionFile { - } - } - -- public DataOutputStream b(int i, int j) { -- return this.d(i, j) ? null : new DataOutputStream(new BufferedOutputStream(new DeflaterOutputStream(new RegionFile.ChunkBuffer(i, j)))); -+ public DataOutputStream b(int i, int j) { // PAIL: getChunkOutputStream -+ // PAIL: isInvalidRegion -+ return this.d(i, j) ? null : new DataOutputStream(new java.io.BufferedOutputStream(new DeflaterOutputStream(new RegionFile.ChunkBuffer(i, j)))); // Spigot - use a BufferedOutputStream to greatly improve file write performance - } - - protected synchronized void a(int i, int j, byte[] abyte, int k) { --- -2.5.0 - diff --git a/CraftBukkit-Patches/0148-More-effecient-RegionFile-zero-ing.patch b/CraftBukkit-Patches/0148-More-effecient-RegionFile-zero-ing.patch deleted file mode 100644 index 715f012153..0000000000 --- a/CraftBukkit-Patches/0148-More-effecient-RegionFile-zero-ing.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 630c07926fec1744af435452e552445389be028f Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 29 Aug 2015 17:48:20 -0400 -Subject: [PATCH] More effecient RegionFile zero'ing - -Speeds up new Chunk Generation by using 2 4k block writes vs 2048 4 byte writes -more effecient than going in and out of native calls repeatedly. - -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 1cd8be8..4c39b54 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -17,7 +17,7 @@ import java.util.zip.InflaterInputStream; - - public class RegionFile { - -- private static final byte[] a = new byte[4096]; -+ private static final byte[] a = new byte[4096]; // Spigot - note: if this ever changes to not be 4096 bytes, update constructor! // PAIL: empty 4k block - private final File b; - private RandomAccessFile c; - private final int[] d = new int[1024]; -@@ -37,8 +37,9 @@ public class RegionFile { - - this.c = new RandomAccessFile(file, "rw"); - if (this.c.length() < 4096L) { -- this.c.write(RegionFile.a); -- this.c.write(RegionFile.a); -+ // Spigot - more effecient chunk zero'ing -+ this.c.write(RegionFile.a); // Spigot -+ this.c.write(RegionFile.a); // Spigot - this.g += 8192; - } - --- -2.5.0 - diff --git a/CraftBukkit-Patches/0149-Implement-SpawnerSpawnEvent.patch b/CraftBukkit-Patches/0149-Implement-SpawnerSpawnEvent.patch deleted file mode 100644 index 5592ac165c..0000000000 --- a/CraftBukkit-Patches/0149-Implement-SpawnerSpawnEvent.patch +++ /dev/null @@ -1,49 +0,0 @@ -From e87ff2924bd5b604551eba4fc075f71a6dbdb95c Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 3 Mar 2016 19:45:46 +1100 -Subject: [PATCH] Implement SpawnerSpawnEvent. - - -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index efe792b..a7903a2 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -99,6 +99,9 @@ public abstract class MobSpawnerAbstract { - { - entity.fromMobSpawner = true; - } -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { -+ continue; -+ } - // Spigot End - ChunkRegionLoader.a(entity, world, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit - world.triggerEffect(2004, blockposition, 0); -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index bfa218b..dd50e8b 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -998,6 +998,21 @@ public class CraftEventFactory { - return event; - } - -+ /** -+ * Mob spawner event. -+ */ -+ public static SpawnerSpawnEvent callSpawnerSpawnEvent(Entity spawnee, BlockPosition pos) { -+ org.bukkit.craftbukkit.entity.CraftEntity entity = spawnee.getBukkitEntity(); -+ BlockState state = entity.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()).getState(); -+ if (!(state instanceof org.bukkit.block.CreatureSpawner)) { -+ state = null; -+ } -+ -+ SpawnerSpawnEvent event = new SpawnerSpawnEvent(entity, (org.bukkit.block.CreatureSpawner) state); -+ entity.getServer().getPluginManager().callEvent(event); -+ return event; -+ } -+ - public static EntityToggleGlideEvent callToggleGlideEvent(EntityLiving entity, boolean gliding) { - EntityToggleGlideEvent event = new EntityToggleGlideEvent((LivingEntity) entity.getBukkitEntity(), gliding); - entity.world.getServer().getPluginManager().callEvent(event); --- -2.5.0 - diff --git a/CraftBukkit-Patches/0150-Optimize-Navigation-Listener.patch b/CraftBukkit-Patches/0150-Optimize-Navigation-Listener.patch deleted file mode 100644 index 70357fd539..0000000000 --- a/CraftBukkit-Patches/0150-Optimize-Navigation-Listener.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 45425317236f1d52c740a0794657806b26af6247 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Tue, 8 Mar 2016 19:13:54 -0500 -Subject: [PATCH] Optimize Navigation Listener - -Replace WeakHashMap with an ArrayList and manually manage object -lifecycle. Gives superior iteration performance at a slight cost -to removal performance and also ensures entities are removed immediately -upon losing their validity within the world. - -Additionally, change listener registration to be done upon world add -instead of immediate up creation. This provides benefit of only -registering and ticking real Navigation objects, and not invalid -entities (cancelled entity spawns for example). - -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 2f4265a..7cfe0af 100644 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -32,7 +32,7 @@ public abstract class NavigationAbstract { - this.b = world; - this.g = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE); - this.s = this.a(); -- this.b.C().a(this); -+ //this.b.C().a(this); // Spigot - Optimized Nav Listener - registered on world add - } - - protected abstract Pathfinder a(); -diff --git a/src/main/java/net/minecraft/server/NavigationListener.java b/src/main/java/net/minecraft/server/NavigationListener.java -index f82ea80..ed79b03 100644 ---- a/src/main/java/net/minecraft/server/NavigationListener.java -+++ b/src/main/java/net/minecraft/server/NavigationListener.java -@@ -1,26 +1,35 @@ - package net.minecraft.server; - -+import java.util.ArrayList; // Spigot -+import java.util.List; // Spigot - import java.util.WeakHashMap; - - public class NavigationListener implements IWorldAccess { - - private static final Object a = new Object(); -- private final WeakHashMap b = new WeakHashMap(); -+ private final List navigators = new ArrayList(); // Spigot - - public NavigationListener() {} - - public void a(NavigationAbstract navigationabstract) { -- this.b.put(navigationabstract, NavigationListener.a); -+ //this.b.put(navigationabstract, NavigationListener.a); // Spigot -+ new Throwable("Unexpected NavigationListener add").printStackTrace(); // Spigot - } - - public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, int i) { - if (this.a(world, blockposition, iblockdata, iblockdata1)) { -+ /* // Spigot start - NavigationAbstract[] anavigationabstract = (NavigationAbstract[]) this.b.keySet().toArray(new NavigationAbstract[0]); - NavigationAbstract[] anavigationabstract1 = anavigationabstract; - int j = anavigationabstract.length; - -- for (int k = 0; k < j; ++k) { -- NavigationAbstract navigationabstract = anavigationabstract1[k]; -+ */ -+ // DO NOT USE AN ITERATOR! This must be a for (;;) to avoid CME. -+ // This is perfectly safe, as additions are ok to be done in this iteration -+ // and Removals are queued instead of immediate. -+ for (int k = 0; k < this.navigators.size(); ++k) { -+ NavigationAbstract navigationabstract = this.navigators.get(k); -+ // Spigot end - - if (navigationabstract != null && !navigationabstract.i()) { - PathEntity pathentity = navigationabstract.k(); -@@ -55,9 +64,21 @@ public class NavigationListener implements IWorldAccess { - - public void a(int i, boolean flag, double d0, double d1, double d2, double d3, double d4, double d5, int... aint) {} - -- public void a(Entity entity) {} -+ public void a(Entity entity) { -+ // Spigot start -+ if (entity instanceof EntityInsentient) { -+ this.navigators.add(((EntityInsentient) entity).navigation); -+ } -+ // Spigot end -+ } - -- public void b(Entity entity) {} -+ public void b(Entity entity) { -+ // Spigot start -+ if (entity instanceof EntityInsentient) { -+ this.navigators.remove(((EntityInsentient) entity).navigation); -+ } -+ // Spigot end -+ } - - public void a(SoundEffect soundeffect, BlockPosition blockposition) {} - --- -2.5.0 - diff --git a/Spigot b/Spigot new file mode 160000 index 0000000000..04266858e3 --- /dev/null +++ b/Spigot @@ -0,0 +1 @@ +Subproject commit 04266858e3436dafcb20eba5ae3c9f6d63a7c5a9 diff --git a/applyPatches.sh b/applyPatches.sh index cf2b3c8041..3421a961cd 100755 --- a/applyPatches.sh +++ b/applyPatches.sh @@ -6,6 +6,7 @@ echo "Rebuilding Forked projects.... " function applyPatch { what=$1 + what_name=$(basename $what) target=$2 branch=$3 cd "$basedir/$what" @@ -17,14 +18,14 @@ function applyPatch { git clone "$what" "$target" fi cd "$basedir/$target" - echo "Resetting $target to $what..." + echo "Resetting $target to $what_name..." git remote add -f upstream ../$what >/dev/null 2>&1 git checkout master >/dev/null 2>&1 git fetch upstream >/dev/null 2>&1 git reset --hard upstream/upstream echo " Applying patches to $target..." git am --abort >/dev/null 2>&1 - git am --3way --ignore-whitespace "$basedir/${what}-Patches/"*.patch + git am --3way --ignore-whitespace "$basedir/${what_name}-Patches/"*.patch if [ "$?" != "0" ]; then echo " Something did not apply cleanly to $target." echo " Please review above details and finish the apply then" @@ -35,5 +36,15 @@ function applyPatch { fi } -applyPatch Bukkit Spigot-API HEAD && applyPatch CraftBukkit Spigot-Server patched -applyPatch Spigot-API Paper-API HEAD && applyPatch Spigot-Server Paper-Server HEAD \ No newline at end of file +# Move into spigot dir +pushd Spigot +basedir=$basedir/Spigot +# Apply Spigot +applyPatch ../Bukkit Spigot-API HEAD && applyPatch ../CraftBukkit Spigot-Server patched +# Move out of Spigot +popd +basedir=$(dirname $basedir) + +# Apply paper +applyPatch Spigot/Spigot-API Paper-API HEAD && applyPatch Spigot/Spigot-Server Paper-Server HEAD + diff --git a/rebuildPatches.sh b/rebuildPatches.sh index a4efde5a5b..b18d70b29c 100755 --- a/rebuildPatches.sh +++ b/rebuildPatches.sh @@ -26,16 +26,16 @@ function cleanupPatches { function savePatches { what=$1 + what_name=$(basename $what) target=$2 echo "Formatting patches for $what..." cd "$basedir/$target" - rm -rf "$basedir/${what}-Patches/" - git format-patch --no-stat -N -o "$basedir/${what}-Patches/" upstream/upstream >/dev/null + git format-patch --no-stat -N -o "$basedir/${what_name}-Patches/" upstream/upstream >/dev/null cd "$basedir" - git add -A "$basedir/${what}-Patches" - cleanupPatches "$basedir/${what}-Patches" - echo " Patches saved for $what to $what-Patches/" + git add -A "$basedir/${what_name}-Patches" + cleanupPatches "$basedir/${what_name}-Patches" + echo " Patches saved for $what to $what_name-Patches/" } -savePatches Spigot-API Paper-API -savePatches Spigot-Server Paper-Server +savePatches Spigot/Spigot-API Paper-API +savePatches Spigot/Spigot-Server Paper-Server