From 5f5f19fe4a310ff7ea87c4bcd9c0f180355b5e68 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/Build-system-changes.patch | 4 ++-- .../server/Ensure-commands-are-not-ran-async.patch | 4 ++-- ...ands-from-signs-not-firing-command-events.patch | 14 +++++++------- patches/server/Fix-this-stupid-bullshit.patch | 2 +- .../server/Implement-Brigadier-Mojang-API.patch | 4 ++-- .../Multi-Block-Change-API-Implementation.patch | 2 +- ...in-client-crashes-server-lists-and-Mojang.patch | 2 +- ...lConsoleAppender-for-console-improvements.patch | 2 +- work/CraftBukkit | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/patches/server/Build-system-changes.patch b/patches/server/Build-system-changes.patch index 93639e823b..4cd0f991bb 100644 --- a/patches/server/Build-system-changes.patch +++ b/patches/server/Build-system-changes.patch @@ -73,12 +73,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/patches/server/Ensure-commands-are-not-ran-async.patch b/patches/server/Ensure-commands-are-not-ran-async.patch index e7dcba0768..ae1c0f8469 100644 --- a/patches/server/Ensure-commands-are-not-ran-async.patch +++ b/patches/server/Ensure-commands-are-not-ran-async.patch @@ -114,7 +114,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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/Fix-commands-from-signs-not-firing-command-events.patch b/patches/server/Fix-commands-from-signs-not-firing-command-events.patch index 0a22964947..cb9ab59855 100644 --- a/patches/server/Fix-commands-from-signs-not-firing-command-events.patch +++ b/patches/server/Fix-commands-from-signs-not-firing-command-events.patch @@ -116,11 +116,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java @@ -0,0 +0,0 @@ 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/Fix-this-stupid-bullshit.patch b/patches/server/Fix-this-stupid-bullshit.patch index 8db2430796..b0cf296416 100644 --- a/patches/server/Fix-this-stupid-bullshit.patch +++ b/patches/server/Fix-this-stupid-bullshit.patch @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ 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/Implement-Brigadier-Mojang-API.patch b/patches/server/Implement-Brigadier-Mojang-API.patch index 2fa2cc4dc5..35bf1602a0 100644 --- a/patches/server/Implement-Brigadier-Mojang-API.patch +++ b/patches/server/Implement-Brigadier-Mojang-API.patch @@ -117,8 +117,8 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java -@@ -0,0 +0,0 @@ import net.minecraft.commands.CommandSourceStack; - import org.bukkit.command.Command; +@@ -0,0 +0,0 @@ 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 { diff --git a/patches/server/Multi-Block-Change-API-Implementation.patch b/patches/server/Multi-Block-Change-API-Implementation.patch index ced5dc7cd9..f685950e06 100644 --- a/patches/server/Multi-Block-Change-API-Implementation.patch +++ b/patches/server/Multi-Block-Change-API-Implementation.patch @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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; @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.send(packet); } diff --git a/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index c7bf95aadf..b37739d111 100644 --- a/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ 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/Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch index 89637ac447..f4148c923a 100644 --- a/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch @@ -301,7 +301,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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) { @@ -0,0 +0,0 @@ public class Main { System.out.println("Unable to read system info"); } diff --git a/work/CraftBukkit b/work/CraftBukkit index 6da82662bb..401f1ad587 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 6da82662bb8fa7e6f99ef6009e25b4082b102481 +Subproject commit 401f1ad587d77df330becb7aaa22e3751a2ef94e