From 3b895f36fdc7591c661ee9088d4813a6fed0bb3f Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 29 Jul 2022 09:11:11 +0200 Subject: [PATCH] Updated Upstream (CraftBukkit) 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 CraftBukkit Changes: 401f1ad58 Re-enable outdated build delay 40eaff8a5 SPIGOT-7125: Command execution exceptions are not logged 639814683 SPIGOT-7123: NullPointerException thrown by Player#chat method --- patches/server/0003-Build-system-changes.patch | 6 +++--- ...lient-crashes-server-lists-and-Mojang.patch | 4 ++-- ...047-Ensure-commands-are-not-ran-async.patch | 6 +++--- ...soleAppender-for-console-improvements.patch | 6 +++--- .../server/0149-Fix-this-stupid-bullshit.patch | 4 ++-- .../0298-Implement-Brigadier-Mojang-API.patch | 10 +++++----- ...-from-signs-not-firing-command-events.patch | 18 +++++++++--------- ...Multi-Block-Change-API-Implementation.patch | 4 ++-- work/CraftBukkit | 2 +- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/patches/server/0003-Build-system-changes.patch b/patches/server/0003-Build-system-changes.patch index 88123fd4a..14cca4fbd 100644 --- a/patches/server/0003-Build-system-changes.patch +++ b/patches/server/0003-Build-system-changes.patch @@ -67,18 +67,18 @@ index d10ff4a52c22033e2adb2a4e7f2cee98a13ea6c5..5d8a84341ab5be52b5c37737e3f82590 exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class") } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 541af13a11533030447c565df0ef02855775cfe5..f264607eb3df1f247c7c36d328405900b52df38e 100644 +index 96df36c550cfdb63db773ab998a212c7eacc724a..eca7833e722a876be29806c92b18b6b58aab5725 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -190,7 +190,7 @@ public class Main { } - if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { + if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { - Date buildDate = new Date(Integer.parseInt(Main.class.getPackage().getImplementationVendor()) * 1000L); + Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -14); + deadline.add(Calendar.DAY_OF_YEAR, -7); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java index 93046379d0cefd5d3236fc59e698809acdc18f80..774556a62eb240da42e84db4502e2ed43495be17 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/patches/server/0021-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/0021-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index e41dbdf3a..b24c0768f 100644 --- a/patches/server/0021-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/0021-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -32,11 +32,11 @@ index a9d9bc91b150597275d9b15f21dc00b49c5e3b28..ae2912c8cb89208a7bbbcdb6e6f143eb private final String bukkitVersion = Versioning.getBukkitVersion(); private final Logger logger = Logger.getLogger("Minecraft"); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 155087d30e826205088ad9d449b33d4b29dca716..8962c8669802dabd6a7bc5b6e506f5d921becea2 100644 +index f64a690ed3173f78ed60b0262c0c868d97a803d5..ce104a63cd56f3343a0f58b0d7bcd47d885beb7f 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -221,12 +221,25 @@ public class Main { - deadline.add(Calendar.DAY_OF_YEAR, -14); + deadline.add(Calendar.DAY_OF_YEAR, -7); if (buildDate.before(deadline.getTime())) { System.err.println("*** Error, this build is outdated ***"); - System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); diff --git a/patches/server/0047-Ensure-commands-are-not-ran-async.patch b/patches/server/0047-Ensure-commands-are-not-ran-async.patch index e35f558c1..73aaeb3a5 100644 --- a/patches/server/0047-Ensure-commands-are-not-ran-async.patch +++ b/patches/server/0047-Ensure-commands-are-not-ran-async.patch @@ -107,14 +107,14 @@ index 415393e965c7253412ec4d893c3e62ad14dd69f2..846c5144fefd1dfd1bbd8e6f82bd9248 return true; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 62a4ae1ee2a0784787b6f45bff6393630e1d4219..f4ce3bf0b7c285d5c98c34290f64d317f13da68d 100644 +index 82a640887a75c360539c1787dbbb32750f6b1379..69d2a0422f1066f7f52e7c81fa6c99019bb6dbfc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -461,7 +461,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void chat(String msg) { if (this.getHandle().connection == null) return; -- this.getHandle().connection.chat(msg, null, false); +- this.getHandle().connection.chat(msg, PlayerChatMessage.system(new ChatMessageContent(msg)), false); + // Paper start - improve chat handling + if (ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) { + this.getHandle().connection.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); @@ -127,7 +127,7 @@ index 62a4ae1ee2a0784787b6f45bff6393630e1d4219..f4ce3bf0b7c285d5c98c34290f64d317 + this.getHandle().connection.chat(msg, PlayerChatMessage.unsigned(net.minecraft.network.chat.MessageSigner.create(this.getUniqueId()), new net.minecraft.network.chat.ChatMessageContent(msg)), false); + } + } -+ // Paper end ++ // Paper en } @Override diff --git a/patches/server/0133-Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/0133-Use-TerminalConsoleAppender-for-console-improvements.patch index e0996ddbe..eca14c202 100644 --- a/patches/server/0133-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/0133-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -222,7 +222,7 @@ index 5b2980866ae3cd78f1852b0ad396ff1967ddfc16..9411e5664c0067f976018fe19b1e7403 System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream()); System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream()); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 4d029c6beb0637f87d1d0a265e00b2d5be677b6c..2e583b600e7a7ef94639a27ce719effcf0b9e141 100644 +index 03a19b3869eea9a59f4003a81ab488603347cd4a..258eee0f5310224b089895745ff11e482fc36dca 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -160,8 +160,7 @@ public abstract class PlayerList { @@ -262,7 +262,7 @@ index be392b054d3fe86118265cbe65067e83b37f36e8..ad469e105871105a3918f9213bc9f272 @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 d7766aaaaa9fd69aae162046cbd2410f8bfeb14c..c59c72e36db34820ddaf881086a65ec36d79f58d 100644 +index 04e7295ab4ec7e417ebb272f5f1b26721dfbb476..a2fda01d1995c655ae562436b49a1be90129e7bb 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -12,7 +12,7 @@ import java.util.logging.Level; @@ -301,7 +301,7 @@ index d7766aaaaa9fd69aae162046cbd2410f8bfeb14c..c59c72e36db34820ddaf881086a65ec3 + System.setProperty(TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper } - if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { + if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { @@ -247,7 +258,7 @@ public class Main { System.out.println("Unable to read system info"); } diff --git a/patches/server/0149-Fix-this-stupid-bullshit.patch b/patches/server/0149-Fix-this-stupid-bullshit.patch index 1a754ae1a..0a6c46fbe 100644 --- a/patches/server/0149-Fix-this-stupid-bullshit.patch +++ b/patches/server/0149-Fix-this-stupid-bullshit.patch @@ -31,12 +31,12 @@ index e359919de57f97d18667df1b2f1bf54a19a49c2f..c5822637e48fad4ca4e8cf210431b5ea Bootstrap.isBootstrapped = true; if (Registry.REGISTRY.keySet().isEmpty()) { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index c59c72e36db34820ddaf881086a65ec36d79f58d..beb12dcc620d902594dbe6ba2893062fadb97dc5 100644 +index a2fda01d1995c655ae562436b49a1be90129e7bb..2febe4c031cbd03a9d61dae64fbfa9312e5b752c 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -239,10 +239,12 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -14); + deadline.add(Calendar.DAY_OF_YEAR, -7); if (buildDate.before(deadline.getTime())) { - System.err.println("*** Error, this build is outdated ***"); + // Paper start - This is some stupid bullshit diff --git a/patches/server/0298-Implement-Brigadier-Mojang-API.patch b/patches/server/0298-Implement-Brigadier-Mojang-API.patch index 3578f0784..bd060fd3a 100644 --- a/patches/server/0298-Implement-Brigadier-Mojang-API.patch +++ b/patches/server/0298-Implement-Brigadier-Mojang-API.patch @@ -82,7 +82,7 @@ index 685e04b1f17938d49cd126bcfe2f488f21afbea2..54bf5558c9048c215aee518874f3d96a event.getPlayer().getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2205849e8aaa161c5772b39d9368765a552a5a94..4ce4cba4f105c9abcad29173be38bb36feb1d061 100644 +index 67399b8881ff24b3465ae23aa6008639abcb4d8e..ed272499b40a96efd83f1a09a063e4d65dbe48e8 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -832,8 +832,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -114,11 +114,11 @@ index 2205849e8aaa161c5772b39d9368765a552a5a94..4ce4cba4f105c9abcad29173be38bb36 // Paper end - async tab completion } diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java -index 21971d52fa8ed92c946c519ba93a39aceae10f5f..0bba36d18d56a4dc2d6c6fb7969e5e6f0e1da404 100644 +index 83d81b9371902b0302d13e53b31c15fac4e67966..9e4a660bdeaa70536bd8aeb90aa4a6a979f3f061 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java -@@ -17,7 +17,7 @@ import net.minecraft.commands.CommandSourceStack; - import org.bukkit.command.Command; +@@ -20,7 +20,7 @@ import org.bukkit.command.CommandException; + import org.bukkit.command.CommandSender; import org.bukkit.craftbukkit.CraftServer; -public class BukkitCommandWrapper implements com.mojang.brigadier.Command, Predicate, SuggestionProvider { @@ -126,7 +126,7 @@ index 21971d52fa8ed92c946c519ba93a39aceae10f5f..0bba36d18d56a4dc2d6c6fb7969e5e6f private final CraftServer server; private final Command command; -@@ -28,10 +28,19 @@ public class BukkitCommandWrapper implements com.mojang.brigadier.Command register(CommandDispatcher dispatcher, String label) { diff --git a/patches/server/0676-Fix-commands-from-signs-not-firing-command-events.patch b/patches/server/0676-Fix-commands-from-signs-not-firing-command-events.patch index 01d4a6921..db3b70bf7 100644 --- a/patches/server/0676-Fix-commands-from-signs-not-firing-command-events.patch +++ b/patches/server/0676-Fix-commands-from-signs-not-firing-command-events.patch @@ -112,15 +112,15 @@ index 831db5ee21938d71e99bf9d17b92a6ca15531740..def4fdd2c7e4f925fa128692a744e5d1 public DyeColor getColor() { diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java -index 0bba36d18d56a4dc2d6c6fb7969e5e6f0e1da404..a246a0bd9e57fb0703ba756e8aa1109f1674c0e8 100644 +index 9e4a660bdeaa70536bd8aeb90aa4a6a979f3f061..2476727cd60034c4df2db36b9ed808e72d7b686f 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java -@@ -50,7 +50,7 @@ public class BukkitCommandWrapper implements com.mojang.brigadier.Command context) throws CommandSyntaxException { -- return this.server.dispatchCommand(context.getSource().getBukkitSender(), context.getInput()) ? 1 : 0; -+ return this.server.dispatchCommand(context.getSource().getBukkitSender(), context.getRange().get(context.getInput())) ? 1 : 0; // Paper - actually use the StringRange from context - } - - @Override + try { +- return this.server.dispatchCommand(sender, context.getInput()) ? 1 : 0; ++ return this.server.dispatchCommand(sender, context.getRange().get(context.getInput())) ? 1 : 0; // Paper - actually use the StringRange from context + } catch (CommandException ex) { + sender.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command"); + this.server.getLogger().log(Level.SEVERE, null, ex); diff --git a/patches/server/0835-Multi-Block-Change-API-Implementation.patch b/patches/server/0835-Multi-Block-Change-API-Implementation.patch index 4461d730d..bd05825fe 100644 --- a/patches/server/0835-Multi-Block-Change-API-Implementation.patch +++ b/patches/server/0835-Multi-Block-Change-API-Implementation.patch @@ -25,7 +25,7 @@ index 82ea4fabd5732052a286d50bcff8bbcc2c4aa7d7..652bea6868a03a5315965f79c76172fb public void write(FriendlyByteBuf buf) { buf.writeLong(this.sectionPos.asLong()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 7112eb5f32faceb371b73a0ee82cf7b23b977f3a..8b1c5d035b6cfe7aec1321d637bb88375c8213fd 100644 +index 9f6a26f1fb53c14b68ce7bc2a69a59cabd00de7f..fca6ccabd527bb05d2f89bf1278b46a85f397318 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -29,6 +29,7 @@ import java.util.logging.Logger; @@ -35,7 +35,7 @@ index 7112eb5f32faceb371b73a0ee82cf7b23b977f3a..8b1c5d035b6cfe7aec1321d637bb8837 +import net.minecraft.core.SectionPos; // Paper import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; - import net.minecraft.network.chat.ChatSender; + import net.minecraft.network.chat.ChatMessageContent; @@ -882,6 +883,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.send(packet); } diff --git a/work/CraftBukkit b/work/CraftBukkit index 6da82662b..401f1ad58 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 6da82662bb8fa7e6f99ef6009e25b4082b102481 +Subproject commit 401f1ad587d77df330becb7aaa22e3751a2ef94e