SPIGOT-7945: Bukkit#dispatchCommand throws UnsupportedOperationException

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-11-04 07:25:07 +11:00
parent 83f48fb3c6
commit 8fc0f462c0
2 changed files with 92 additions and 47 deletions

View File

@@ -9,6 +9,7 @@ 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;
@@ -67,6 +68,10 @@ public final class VanillaCommandWrapper extends BukkitCommand {
return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlock().createCommandSourceStack();
}
if (sender instanceof EntityPlayer player) {
return player.createCommandSourceStack();
}
return entity.getHandle().createCommandSourceStackForNameResolution((WorldServer) entity.getHandle().level());
}
if (sender instanceof BlockCommandSender) {