diff --git a/LICENSE.md b/LICENSE.md index 88efeb9cc5..c5341db551 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -33,4 +33,5 @@ MiniDigger | Martin Brokkonaut vemacs stonar96 +Hugo Manrique ``` diff --git a/Spigot-Server-Patches/Avoid-item-merge-if-stack-size-above-max-stack-size.patch b/Spigot-Server-Patches/Avoid-item-merge-if-stack-size-above-max-stack-size.patch new file mode 100644 index 0000000000..ae4a52d773 --- /dev/null +++ b/Spigot-Server-Patches/Avoid-item-merge-if-stack-size-above-max-stack-size.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hugo Manrique +Date: Mon, 16 Jul 2018 12:42:20 +0200 +Subject: [PATCH] Avoid item merge if stack size above max stack size + + +diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java +index d232bab745..b0f22f8f09 100644 +--- a/src/main/java/net/minecraft/server/EntityItem.java ++++ b/src/main/java/net/minecraft/server/EntityItem.java +@@ -0,0 +0,0 @@ public class EntityItem extends Entity { + } + + private void v() { ++ // Paper start - avoid item merge if stack size above max stack size ++ ItemStack stack = getItemStack(); ++ if (stack.getCount() >= stack.getMaxStackSize()) return; ++ // Paper end + // Spigot start + double radius = world.spigotConfig.itemMerge; + Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(radius, radius, radius)).iterator(); +-- \ No newline at end of file diff --git a/Spigot-Server-Patches/Load-version-history-at-server-start.patch b/Spigot-Server-Patches/Load-version-history-at-server-start.patch index 716b43e79f..f820f1b51b 100644 --- a/Spigot-Server-Patches/Load-version-history-at-server-start.patch +++ b/Spigot-Server-Patches/Load-version-history-at-server-start.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Load version history at server start diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 7ff2fa535..a329887ce 100644 +index 927cbeedcd..ae7a8c1046 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer diff --git a/Spigot-Server-Patches/Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch b/Spigot-Server-Patches/Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch index a4cd188d03..3387f40e2e 100644 --- a/Spigot-Server-Patches/Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch +++ b/Spigot-Server-Patches/Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch @@ -12,7 +12,7 @@ results in a separate line, even though it should not result in a line break. Log4j's implementation handles it correctly. diff --git a/pom.xml b/pom.xml -index f9e225b73..9d2473317 100644 +index f2c7d2ba8b..fa6c3702a7 100644 --- a/pom.xml +++ b/pom.xml @@ -0,0 +0,0 @@ @@ -30,7 +30,7 @@ index f9e225b73..9d2473317 100644 junit diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 069eb7d68..7ff2fa535 100644 +index 681194e94f..927cbeedcd 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer diff --git a/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch b/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch index e52248a03e..827af65ea1 100644 --- a/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch @@ -15,12 +15,11 @@ New features: IntelliJ IDEA Other changes: - - Update JLine to 3.3.1 (from 2.12.1) - Server starts 1-2 seconds faster thanks to optimizations in Log4j configuration diff --git a/pom.xml b/pom.xml -index 17bc80776..f9e225b73 100644 +index 17bc807763..f2c7d2ba8b 100644 --- a/pom.xml +++ b/pom.xml @@ -0,0 +0,0 @@ @@ -44,12 +43,12 @@ index 17bc80776..f9e225b73 100644 + + net.minecrell + terminalconsoleappender -+ 1.0.0 ++ 1.1.0 + + + net.java.dev.jna + jna -+ 4.4.0 ++ 4.5.2 + runtime + + @@ -88,9 +87,55 @@ index 17bc80776..f9e225b73 100644 org.apache.maven.plugins +diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java +new file mode 100644 +index 0000000000..688b4715eb +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java +@@ -0,0 +0,0 @@ ++package com.destroystokyo.paper.console; ++ ++import net.minecraft.server.DedicatedServer; ++import net.minecrell.terminalconsole.SimpleTerminalConsole; ++import org.bukkit.craftbukkit.command.ConsoleCommandCompleter; ++import org.jline.reader.LineReader; ++import org.jline.reader.LineReaderBuilder; ++ ++public final class PaperConsole extends SimpleTerminalConsole { ++ ++ private final DedicatedServer server; ++ ++ public PaperConsole(DedicatedServer server) { ++ this.server = server; ++ } ++ ++ @Override ++ protected LineReader buildReader(LineReaderBuilder builder) { ++ return super.buildReader(builder ++ .appName("Paper") ++ .completer(new ConsoleCommandCompleter(this.server)) ++ ); ++ } ++ ++ @Override ++ protected boolean isRunning() { ++ return !this.server.isStopped() && this.server.isRunning(); ++ } ++ ++ @Override ++ protected void runCommand(String command) { ++ this.server.issueCommand(command, this.server.getServerCommandListener()); ++ } ++ ++ @Override ++ protected void shutdown() { ++ this.server.safeShutdown(); ++ } ++ ++} diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java new file mode 100644 -index 000000000..685deaa0e +index 0000000000..685deaa0e5 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java @@ -0,0 +0,0 @@ @@ -111,107 +156,29 @@ index 000000000..685deaa0e + } + +} -diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalHandler.java b/src/main/java/com/destroystokyo/paper/console/TerminalHandler.java -new file mode 100644 -index 000000000..d013bc047 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/console/TerminalHandler.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.console; -+ -+import net.minecraft.server.DedicatedServer; -+import net.minecrell.terminalconsole.TerminalConsoleAppender; -+import org.bukkit.craftbukkit.command.ConsoleCommandCompleter; -+import org.jline.reader.EndOfFileException; -+import org.jline.reader.LineReader; -+import org.jline.reader.LineReaderBuilder; -+import org.jline.reader.UserInterruptException; -+import org.jline.terminal.Terminal; -+ -+public class TerminalHandler { -+ -+ private TerminalHandler() { -+ } -+ -+ public static boolean handleCommands(DedicatedServer server) { -+ final Terminal terminal = TerminalConsoleAppender.getTerminal(); -+ if (terminal == null) { -+ return false; -+ } -+ -+ LineReader reader = LineReaderBuilder.builder() -+ .appName("Paper") -+ .terminal(terminal) -+ .completer(new ConsoleCommandCompleter(server)) -+ .build(); -+ reader.setOpt(LineReader.Option.DISABLE_EVENT_EXPANSION); -+ reader.unsetOpt(LineReader.Option.INSERT_TAB); -+ -+ TerminalConsoleAppender.setReader(reader); -+ -+ try { -+ String line; -+ while (!server.isStopped() && server.isRunning()) { -+ try { -+ line = reader.readLine("> "); -+ } catch (EndOfFileException ignored) { -+ // Continue reading after EOT -+ continue; -+ } -+ -+ if (line == null) { -+ break; -+ } -+ -+ line = line.trim(); -+ if (!line.isEmpty()) { -+ server.issueCommand(line, server.getServerCommandListener()); -+ } -+ } -+ } catch (UserInterruptException e) { -+ server.safeShutdown(); -+ } finally { -+ TerminalConsoleAppender.setReader(null); -+ } -+ -+ return true; -+ } -+ -+} diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index a3d58b5ce..069eb7d68 100644 +index a3d58b5ce5..681194e94f 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer if (!org.bukkit.craftbukkit.Main.useConsole) { return; } -- jline.console.ConsoleReader bufferedreader = reader; -+ // Paper start - Use TerminalConsoleAppender implementation -+ if (com.destroystokyo.paper.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; -+ BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); -+ // Paper end ++ // Paper start - Use TerminalConsoleAppender ++ new com.destroystokyo.paper.console.PaperConsole(DedicatedServer.this).start(); ++ /* + jline.console.ConsoleReader bufferedreader = reader; // CraftBukkit end - String s; @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - try { - // CraftBukkit start - JLine disabling compatibility - while (!DedicatedServer.this.isStopped() && DedicatedServer.this.isRunning()) { -+ // Paper start - code is not used for jline -+ /* - if (org.bukkit.craftbukkit.Main.useJline) { - s = bufferedreader.readLine(">", null); - } else { - s = bufferedreader.readLine(); - } -+ */ -+ s = bufferedreader.readLine(); -+ // Paper end -+ - if (s != null && s.trim().length() > 0) { // Trim to filter lines which are just spaces - DedicatedServer.this.issueCommand(s, DedicatedServer.this.getServerCommandListener()); - } + DedicatedServer.LOGGER.error("Exception handling console input", ioexception); + } + ++ */ ++ // Paper end + } + }; + @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler()); @@ -232,7 +199,7 @@ index a3d58b5ce..069eb7d68 100644 System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true)); System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true)); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f679c6bc2..39a8b1d69 100644 +index f679c6bc27..39a8b1d696 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ import org.apache.commons.lang3.Validate; @@ -290,7 +257,7 @@ index f679c6bc2..39a8b1d69 100644 public KeyPair G() { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 4c9ff8c29..9e403d625 100644 +index 4c9ff8c297..9e403d6251 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -304,7 +271,7 @@ index 4c9ff8c29..9e403d625 100644 this.k = new GameProfileBanList(PlayerList.a); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 470e334f7..9fe7c6a0d 100644 +index 470e334f79..9fe7c6a0db 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ import java.nio.ByteBuffer; @@ -332,7 +299,7 @@ index 470e334f7..9fe7c6a0d 100644 @Override public PluginCommand getPluginCommand(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index aad208f47..ac38028d7 100644 +index aad208f477..ac38028d7c 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ import java.util.logging.Logger; @@ -374,7 +341,7 @@ index aad208f47..ac38028d7 100644 if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java deleted file mode 100644 -index 26a2fb894..000000000 +index 26a2fb8942..0000000000 --- a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java +++ /dev/null @@ -0,0 +0,0 @@ @@ -453,7 +420,7 @@ index 26a2fb894..000000000 - } -} diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java -index 33e8ea02c..1e3aae3b8 100644 +index 33e8ea02c4..1e3aae3b8f 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java @@ -0,0 +0,0 @@ import java.util.logging.Level; @@ -532,7 +499,7 @@ index 33e8ea02c..1e3aae3b8 100644 } } diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java -index 984df4083..bbb5a84f3 100644 +index 984df4083d..bbb5a84f36 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java +++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java @@ -0,0 +0,0 @@ public class ServerShutdownThread extends Thread { @@ -546,7 +513,7 @@ index 984df4083..bbb5a84f3 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java deleted file mode 100644 -index b64097113..000000000 +index b640971130..0000000000 --- a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java +++ /dev/null @@ -0,0 +0,0 @@ @@ -605,7 +572,7 @@ index b64097113..000000000 - } -} diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml -index 5cee8f00e..08b6bb7f9 100644 +index 5cee8f00ef..08b6bb7f97 100644 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -0,0 +0,0 @@ diff --git a/Spigot-Server-Patches/Use-asynchronous-Log4j-2-loggers.patch b/Spigot-Server-Patches/Use-asynchronous-Log4j-2-loggers.patch new file mode 100644 index 0000000000..5642695e59 --- /dev/null +++ b/Spigot-Server-Patches/Use-asynchronous-Log4j-2-loggers.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Minecrell +Date: Tue, 17 Jul 2018 16:42:17 +0200 +Subject: [PATCH] Use asynchronous Log4j 2 loggers + + +diff --git a/pom.xml b/pom.xml +index 8fd1e36283..0c4b0daf56 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -0,0 +0,0 @@ + 2.8.1 + + ++ ++ ++ com.lmax ++ disruptor ++ 3.4.2 ++ runtime ++ ++ + + + junit +diff --git a/src/main/resources/log4j2.component.properties b/src/main/resources/log4j2.component.properties +new file mode 100644 +index 0000000000..ee7c90784c +--- /dev/null ++++ b/src/main/resources/log4j2.component.properties +@@ -0,0 +1 @@ ++Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector +-- \ No newline at end of file