capture_runas core errors
LadyCailinBot opened this issue ยท 7 comments
CMDHELPER-3122 - Reported by PseudoKnight
Certain commands will cause core errors. Vanilla commands cause IllegalArgumentExceptions and CH registered commands cause NPEs. I'm not sure if they're related. I suspect it has something to do with the exceptions overhaul, but I'm not familiar with how the capture_runas system works.
[22:05:13] [Server thread/ERROR]: Uh oh! You've found an error in Core.
This is an error caused while running your code, so you may be able to find a workaround, but is ultimately an error in Core itself.
The line of code that caused the error was this:
capture_runas('PseudoKnight', '/time set day')
on or around Interpreter:1.
Please report this error to the developers, and be sure to include the version numbers:
Server version: 1.8.8-R0.1-SNAPSHOT;
CommandHelper version: 3.3.2-SNAPSHOT;
Loaded extensions and versions:
CHPerms (version 2.0.0);
CHSpigot (version 1.4.3);
CHCitizens (version 1.1.5);
CHStargate (version 1.0.2);
CHNaughty (version 2.0.1);
CHDynmap (version 1.1.3);
CHVirtualChests (version 1.0.5);
SKCompat (version 2.0.0);
Core (version 3.3.2);
Here's the stacktrace:
org.bukkit.command.CommandException: Unhandled exception executing 'time set day' in org.bukkit.craftbukkit.v1_8_R3.command.VanillaCommandWrapper(time)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149)
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:665)
at com.laytonsmith.abstraction.bukkit.BukkitMCServer.dispatchAndCaptureCommand(BukkitMCServer.java:173)
at com.laytonsmith.core.functions.Meta$capture_runas.exec(Meta.java:666)
at com.laytonsmith.core.Script.eval(Script.java:375)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1976)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1933)
at com.laytonsmith.commandhelper.CommandHelperInterpreterListener.execute(CommandHelperInterpreterListener.java:155)
at com.laytonsmith.commandhelper.CommandHelperInterpreterListener.textLine(CommandHelperInterpreterListener.java:127)
at com.laytonsmith.commandhelper.CommandHelperInterpreterListener$1.run(CommandHelperInterpreterListener.java:66)
at com.laytonsmith.abstraction.bukkit.BukkitConvertor$1.call(BukkitConvertor.java:264)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftFuture.run(CraftFuture.java:89)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:349)
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:781)
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378)
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713)
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Cannot make CraftPlayer{name=PseudoKnight} a vanilla command listener
at org.bukkit.craftbukkit.v1_8_R3.command.VanillaCommandWrapper.getListener(VanillaCommandWrapper.java:160)
at org.bukkit.craftbukkit.v1_8_R3.command.VanillaCommandWrapper.execute(VanillaCommandWrapper.java:42)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:142)
... 17 more
[22:05:39] [Server thread/ERROR]: Uh oh! You've found an error in Core.
This is an error caused while running your code, so you may be able to find a workaround, but is ultimately an error in Core itself.
The line of code that caused the error was this:
capture_runas('PseudoKnight', '/timer')
on or around Interpreter:1.
Please report this error to the developers, and be sure to include the version numbers:
Server version: 1.8.8-R0.1-SNAPSHOT;
CommandHelper version: 3.3.2-SNAPSHOT;
Loaded extensions and versions:
CHPerms (version 2.0.0);
CHSpigot (version 1.4.3);
CHCitizens (version 1.1.5);
CHStargate (version 1.0.2);
CHNaughty (version 2.0.1);
CHDynmap (version 1.1.3);
CHVirtualChests (version 1.0.5);
SKCompat (version 2.0.0);
Core (version 3.3.2);
Here's the stacktrace:
org.bukkit.command.CommandException: Unhandled exception executing command 'timer' in plugin CommandHelper v3.3.2-SNAPSHOT
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:142)
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:665)
at com.laytonsmith.abstraction.bukkit.BukkitMCServer.dispatchAndCaptureCommand(BukkitMCServer.java:173)
at com.laytonsmith.core.functions.Meta$capture_runas.exec(Meta.java:666)
at com.laytonsmith.core.Script.eval(Script.java:375)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1976)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1933)
at com.laytonsmith.commandhelper.CommandHelperInterpreterListener.execute(CommandHelperInterpreterListener.java:155)
at com.laytonsmith.commandhelper.CommandHelperInterpreterListener.textLine(CommandHelperInterpreterListener.java:127)
at com.laytonsmith.commandhelper.CommandHelperInterpreterListener$1.run(CommandHelperInterpreterListener.java:66)
at com.laytonsmith.abstraction.bukkit.BukkitConvertor$1.call(BukkitConvertor.java:264)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftFuture.run(CraftFuture.java:89)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:349)
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:781)
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378)
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713)
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.laytonsmith.abstraction.bukkit.BukkitMCCommand.handleCustomCommand(BukkitMCCommand.java:259)
at com.laytonsmith.commandhelper.CommandHelperPlugin.onCommand(CommandHelperPlugin.java:590)
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
... 18 more
Comment by PseudoKnight
Okay, this is more critical than I thought. --One-- both of those makes the injected player get stuck and every script that runs into that player will give player exceptions. (until the player relogs)
Comment by PseudoKnight
Could I at least partially address this by catching exceptions from dispatchCommand in dispatchAndCaptureCommand, then putting the injected player cleanup in finally{}? That would at least contain the problem.
Comment by LadyCailin
This whole mechanism is based on lots of hacky assumptions. There's no real way to do what this function is trying to do, at least not in this general way, so feel free to hack more at it.
Ideally, instead of proxying Players, we would hack into the packet level, and intercept all messages being sent to the player. Still not 100%, because we are still catching ALL output to the player, whether it's the result of the command they just ran or not. So this function is fundamentally flawed from the get go, so I'm not opposed to doing whatever works.
Comment by Sebdomsan54
Question what if you took the player that the runas is targeting make a clone of there permissions stats and so forth gave that new "player" a name that would not be in use and then run then command as the clone ... is that even possible?
Comment by PseudoKnight
That's what it's doing, more or less:
The error above is occurring on dispatchCommand(), interrupting it before it has a chance to uninject the proxy player.