mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-21 07:41:30 +01:00
SPIGOT-7458: Exception when Entity CommandSender executes Vanilla command
By: md_5 <git@md-5.net>
This commit is contained in:
parent
ce7d1f4f83
commit
cc7d27cb4a
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user