From a0632a8f06cbea4722c00252c70d3b0da20cb99d Mon Sep 17 00:00:00 2001 From: Noah van der Aa Date: Mon, 28 Aug 2023 13:05:48 +0200 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9648) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 6b34da8f SPIGOT-7467: Add getAddress to RemoteConsoleCommandSender CraftBukkit Changes: db4ba2897 SPIGOT-7467: Add getAddress to RemoteConsoleCommandSender 4f7ff4dec PR-1246: Add missing AbstractTestingBase to tests which need them f70a7b68d SPIGOT-7465, MC-264979: Fresh installations print NoSuchFileException for server.properties 8ef7afef6 PR-1240: Call BlockGrowEvent for vines that are growing on additional sides of an existing vine block Spigot Changes: d2eba2c8 Rebuild patches --- .../server/Fix-test-not-bootstrapping.patch | 24 ------------- .../Further-improve-server-tick-loop.patch | 2 +- .../server/Improve-logging-and-errors.patch | 17 --------- patches/server/Timings-v2.patch | 35 +++++++++++-------- ...oleAppender-for-console-improvements.patch | 2 +- .../Use-a-Queue-for-Queueing-Commands.patch | 2 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 9 files changed, 26 insertions(+), 62 deletions(-) delete mode 100644 patches/server/Fix-test-not-bootstrapping.patch diff --git a/patches/server/Fix-test-not-bootstrapping.patch b/patches/server/Fix-test-not-bootstrapping.patch deleted file mode 100644 index b6d832e1e3..0000000000 --- a/patches/server/Fix-test-not-bootstrapping.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Mon, 2 Aug 2021 08:52:21 +0200 -Subject: [PATCH] Fix test not bootstrapping - -Signed-off-by: Mariell Hoversholm - -diff --git a/src/test/java/org/bukkit/enchantments/EnchantmentTargetTest.java b/src/test/java/org/bukkit/enchantments/EnchantmentTargetTest.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/test/java/org/bukkit/enchantments/EnchantmentTargetTest.java -+++ b/src/test/java/org/bukkit/enchantments/EnchantmentTargetTest.java -@@ -0,0 +0,0 @@ import net.minecraft.world.item.Item; - import net.minecraft.world.item.enchantment.EnchantmentCategory; - import org.bukkit.Material; - import org.bukkit.craftbukkit.util.CraftMagicNumbers; -+import org.bukkit.support.AbstractTestingBase; - import org.junit.Assert; - import org.junit.Test; - --public class EnchantmentTargetTest { -+public class EnchantmentTargetTest extends AbstractTestingBase { // Paper - - @Test - public void test() { diff --git a/patches/server/Further-improve-server-tick-loop.patch b/patches/server/Further-improve-server-tick-loop.patch index cd2cdb6f79..debf0da413 100644 --- a/patches/server/Further-improve-server-tick-loop.patch +++ b/patches/server/Further-improve-server-tick-loop.patch @@ -16,8 +16,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> { - } - - public static Properties loadFromFile(Path path) { -+ // Paper start -+ if (Files.notExists(path)) { -+ LOGGER.info("Could not find existing {}. Creating with default values...", path.getFileName()); -+ return new Properties(); -+ } -+ // Paper end - try { - Properties properties; - Properties properties1; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/patches/server/Timings-v2.patch b/patches/server/Timings-v2.patch index 8f3533fbc6..32afd52bb3 100644 --- a/patches/server/Timings-v2.patch +++ b/patches/server/Timings-v2.patch @@ -934,7 +934,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 -import org.bukkit.craftbukkit.SpigotTimings; // Spigot +import co.aikar.timings.MinecraftTimings; // Paper import org.bukkit.event.server.ServerCommandEvent; -+import org.bukkit.craftbukkit.util.Waitable; ++import org.bukkit.craftbukkit.util.Waitable; // Paper import org.bukkit.event.server.RemoteServerCommandEvent; // CraftBukkit end @@ -957,21 +957,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + } - @Override - public String runCommand(String command) { -+ Waitable[] waitableArray = new Waitable[1]; - this.rconConsoleSource.prepareForCommand(); + public String runCommand(RconConsoleSource rconConsoleSource, String s) { ++ Waitable[] waitableArray = new Waitable[1]; // Paper + rconConsoleSource.prepareForCommand(); ++ final java.util.concurrent.atomic.AtomicReference command = new java.util.concurrent.atomic.AtomicReference<>(s); // Paper this.executeBlocking(() -> { - // CraftBukkit start - fire RemoteServerCommandEvent + CommandSourceStack wrapper = rconConsoleSource.createCommandSourceStack(); + RemoteServerCommandEvent event = new RemoteServerCommandEvent(rconConsoleSource.getBukkitSender(wrapper), s); @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface if (event.isCancelled()) { return; } +- ConsoleInput serverCommand = new ConsoleInput(event.getCommand(), wrapper); +- server.dispatchServerCommand(event.getSender(), serverCommand); ++ + // Paper start -+ if (command.toLowerCase().startsWith("timings") && command.toLowerCase().matches("timings (report|paste|get|merged|seperate)")) { ++ command.set(event.getCommand()); ++ if (event.getCommand().toLowerCase().startsWith("timings") && event.getCommand().toLowerCase().matches("timings (report|paste|get|merged|seperate)")) { + org.bukkit.command.BufferedCommandSender sender = new org.bukkit.command.BufferedCommandSender(); -+ Waitable waitable = new Waitable() { ++ Waitable waitable = new Waitable<>() { + @Override + protected String evaluate() { + return sender.getBuffer(); @@ -981,10 +987,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + co.aikar.timings.Timings.generateReport(new co.aikar.timings.TimingsReportListener(sender, waitable)); + } else { + // Paper end - ConsoleInput serverCommand = new ConsoleInput(event.getCommand(), this.rconConsoleSource.createCommandSourceStack()); - server.dispatchServerCommand(remoteConsole, serverCommand); ++ ConsoleInput serverCommand = new ConsoleInput(event.getCommand(), wrapper); ++ server.dispatchServerCommand(event.getSender(), serverCommand); + } // Paper - // CraftBukkit end }); + // Paper start + if (waitableArray[0] != null) { @@ -993,17 +998,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + try { + return waitable.get(); + } catch (java.util.concurrent.ExecutionException e) { -+ throw new RuntimeException("Exception processing rcon command " + command, e.getCause()); ++ throw new RuntimeException("Exception processing rcon command " + command.get(), e.getCause()); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); // Maintain interrupted state -+ throw new RuntimeException("Interrupted processing rcon command " + command, e); ++ throw new RuntimeException("Interrupted processing rcon command " + command.get(), e); + } + + } + // Paper end - return this.rconConsoleSource.getCommandResponse(); + return rconConsoleSource.getCommandResponse(); + // CraftBukkit end } - diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch index cab62c9dbc..7df23676f2 100644 --- a/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch @@ -265,9 +265,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import net.minecraft.core.HolderLookup; import net.minecraft.resources.RegistryOps; @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop serverCommandQueue = new java.util.concurrent.ConcurrentLinkedQueue<>(); // Paper - use a proper queuemmands @Nullable private QueryThreadGs4 queryThreadGs4; - public final RconConsoleSource rconConsoleSource; + // public final RemoteControlCommandListener rconConsoleSource; // CraftBukkit - remove field @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface return; } diff --git a/work/Bukkit b/work/Bukkit index 82af5dc60e..6b34da8f0c 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 82af5dc60eae0a6223be15ea4f69c560521c97a9 +Subproject commit 6b34da8f0c34fb308c825d3e12abf9cf5bac6ab9 diff --git a/work/CraftBukkit b/work/CraftBukkit index b76ceb4f5d..db4ba28978 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit b76ceb4f5dbeeedb6e0cff3b4545779b137bc125 +Subproject commit db4ba289785418d608eeca8dec2013e513adf9ad diff --git a/work/Spigot b/work/Spigot index 94e187b577..d2eba2c820 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 94e187b577b93759e4f46e85c892049a6baa3bcc +Subproject commit d2eba2c820b52b742eb542c6d2c4d76e3d743570