From b9a4bb1cd12ee9ca041b2646643484ef10d5908c Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 6 Nov 2024 20:20:36 +1100 Subject: [PATCH] SPIGOT-7948: `Bukkit#dispatchCommand` uses the wrong `CommandListenerWrapper` for Players By: md_5 --- .../bukkit/craftbukkit/command/VanillaCommandWrapper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/paper-server/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java index 9464b04103..fb9656e077 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java @@ -9,7 +9,6 @@ import java.util.Collections; import java.util.List; import net.minecraft.commands.CommandDispatcher; import net.minecraft.commands.CommandListenerWrapper; -import net.minecraft.server.level.EntityPlayer; import net.minecraft.server.level.WorldServer; import net.minecraft.world.entity.vehicle.EntityMinecartCommandBlock; import org.bukkit.Location; @@ -22,6 +21,7 @@ import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftMinecartCommand; +import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.entity.minecart.CommandMinecart; public final class VanillaCommandWrapper extends BukkitCommand { @@ -68,8 +68,8 @@ public final class VanillaCommandWrapper extends BukkitCommand { return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlock().createCommandSourceStack(); } - if (sender instanceof EntityPlayer player) { - return player.createCommandSourceStack(); + if (sender instanceof CraftPlayer player) { + return player.getHandle().createCommandSourceStack(); } return entity.getHandle().createCommandSourceStackForNameResolution((WorldServer) entity.getHandle().level());