From b0d8230b5ad49f39afeec1b82a651c676135fe5a Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Thu, 26 Aug 2021 11:41:22 -0500 Subject: [PATCH] [ci skip] Cleanup diff in Async command map building (#6492) --- .../server/Async-command-map-building.patch | 34 +++---------------- .../Implement-Brigadier-Mojang-API.patch | 10 +++--- ...tize-ResourceLocation-error-logging.patch} | 0 3 files changed, 10 insertions(+), 34 deletions(-) rename patches/server/{Sanitize-resourcelocation-error-logging.patch => Sanitize-ResourceLocation-error-logging.patch} (100%) diff --git a/patches/server/Async-command-map-building.patch b/patches/server/Async-command-map-building.patch index 292c80fe03..3942d884c9 100644 --- a/patches/server/Async-command-map-building.patch +++ b/patches/server/Async-command-map-building.patch @@ -26,47 +26,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }); + } + -+ private void sendAsync(ServerPlayer entityplayer) { ++ private void sendAsync(ServerPlayer player) { + // Paper end - Async command map building Map, CommandNode> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues RootCommandNode vanillaRoot = new RootCommandNode(); -- RootCommandNode vanilla = player.server.vanillaCommandDispatcher.getDispatcher().getRoot(); -+ RootCommandNode vanilla = entityplayer.server.vanillaCommandDispatcher.getDispatcher().getRoot(); - map.put(vanilla, vanillaRoot); -- this.fillUsableCommands(vanilla, vanillaRoot, player.createCommandSourceStack(), (Map) map); -+ this.fillUsableCommands(vanilla, vanillaRoot, entityplayer.createCommandSourceStack(), (Map) map); - - // Now build the global commands in a second pass - RootCommandNode rootcommandnode = new RootCommandNode(); - - map.put(this.dispatcher.getRoot(), rootcommandnode); -- this.fillUsableCommands(this.dispatcher.getRoot(), rootcommandnode, player.createCommandSourceStack(), (Map) map); -+ this.fillUsableCommands(this.dispatcher.getRoot(), rootcommandnode, entityplayer.createCommandSourceStack(), (Map) map); - - Collection bukkit = new LinkedHashSet<>(); +@@ -0,0 +0,0 @@ public class Commands { for (CommandNode node : rootcommandnode.getChildren()) { bukkit.add(node.getName()); } + // Paper start - Async command map building + MinecraftServer.getServer().execute(() -> { -+ runSync(entityplayer, bukkit, rootcommandnode); ++ runSync(player, bukkit, rootcommandnode); + }); + } -- PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit)); -+ private void runSync(ServerPlayer entityplayer, Collection bukkit, RootCommandNode rootcommandnode) { ++ private void runSync(ServerPlayer player, Collection bukkit, RootCommandNode rootcommandnode) { + // Paper end - Async command map building -+ PlayerCommandSendEvent event = new PlayerCommandSendEvent(entityplayer.getBukkitEntity(), new LinkedHashSet<>(bukkit)); + PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit)); event.getPlayer().getServer().getPluginManager().callEvent(event); - // Remove labels that were removed during the event -@@ -0,0 +0,0 @@ public class Commands { - } - } - // CraftBukkit end -- player.connection.send(new ClientboundCommandsPacket(rootcommandnode)); -+ entityplayer.connection.send(new ClientboundCommandsPacket(rootcommandnode)); - } - - private void fillUsableCommands(CommandNode tree, CommandNode result, CommandSourceStack source, Map, CommandNode> resultNodes) { diff --git a/patches/server/Implement-Brigadier-Mojang-API.patch b/patches/server/Implement-Brigadier-Mojang-API.patch index 42ad6c4c98..966cd4c8ab 100644 --- a/patches/server/Implement-Brigadier-Mojang-API.patch +++ b/patches/server/Implement-Brigadier-Mojang-API.patch @@ -68,16 +68,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 bukkit.add(node.getName()); } // Paper start - Async command map building -+ new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent(entityplayer.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper ++ new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper MinecraftServer.getServer().execute(() -> { - runSync(entityplayer, bukkit, rootcommandnode); + runSync(player, bukkit, rootcommandnode); }); @@ -0,0 +0,0 @@ public class Commands { - private void runSync(ServerPlayer entityplayer, Collection bukkit, RootCommandNode rootcommandnode) { + private void runSync(ServerPlayer player, Collection bukkit, RootCommandNode rootcommandnode) { // Paper end - Async command map building -+ new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent(entityplayer.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper - PlayerCommandSendEvent event = new PlayerCommandSendEvent(entityplayer.getBukkitEntity(), new LinkedHashSet<>(bukkit)); ++ new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper + PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit)); 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 diff --git a/patches/server/Sanitize-resourcelocation-error-logging.patch b/patches/server/Sanitize-ResourceLocation-error-logging.patch similarity index 100% rename from patches/server/Sanitize-resourcelocation-error-logging.patch rename to patches/server/Sanitize-ResourceLocation-error-logging.patch