13
0
geforkt von Mirrors/Paper

SPIGOT-7458: Exception when Entity CommandSender executes Vanilla command

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2023-08-12 16:22:19 +10:00
Ursprung ce7d1f4f83
Commit cc7d27cb4a

Datei anzeigen

@ -20,9 +20,9 @@ import org.bukkit.command.ProxiedCommandSender;
import org.bukkit.command.RemoteConsoleCommandSender;
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.Player;
import org.bukkit.entity.Entity;
import org.bukkit.entity.minecart.CommandMinecart;
public final class VanillaCommandWrapper extends BukkitCommand {
@ -64,15 +64,16 @@ public final class VanillaCommandWrapper extends BukkitCommand {
}
public static CommandListenerWrapper getListener(CommandSender sender) {
if (sender instanceof Player) {
return ((CraftPlayer) sender).getHandle().createCommandSourceStack();
if (sender instanceof Entity) {
if (sender instanceof CommandMinecart) {
return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlock().createCommandSourceStack();
}
return ((CraftEntity) sender).getHandle().createCommandSourceStack();
}
if (sender instanceof BlockCommandSender) {
return ((CraftBlockCommandSender) sender).getWrapper();
}
if (sender instanceof CommandMinecart) {
return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlock().createCommandSourceStack();
}
if (sender instanceof RemoteConsoleCommandSender) {
return ((DedicatedServer) MinecraftServer.getServer()).rconConsoleSource.createCommandSourceStack();
}