CommandHelper

CommandHelper

46.5k Downloads

Unhandled exception in valid script (running mcmmo command on event)

LadyCailinBot opened this issue ยท 2 comments

commented

CMDHELPER-2856 - Reported by Siguza

This line in main.ms (I use or() to run two commands on one event):

bind(player_join, null, null, @event, scriptas(@event[player], or(run(/mctop), run(/mcscoreboard keep))))

causes this error:

[22:21:19 ERROR]: Uh oh! You've found an error in CommandHelper. This is an error caused by your code, so you may be able to find a workaround, but is ultimately an error in CommandHelper itself. The line of code that caused the error was this:
run('/mcscoreboard keep')
on or around /home/molt/mc/plugins/CommandHelper/main.ms:12.
Please report this error to the developers, and be sure to include the version numbers: Server version: 1.7.2-R0.3-SNAPSHOT; CommandHelper version: 3.3.1-SNAPSHOT:2469-fb356bf,master. Here's the stacktrace:
org.bukkit.command.CommandException: Unhandled exception executing command 'mcscoreboard' in plugin mcMMO v1.4.08-dev1-b3426
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:196)
at org.bukkit.craftbukkit.v1_7_R1.CraftServer.dispatchCommand(CraftServer.java:546)
at com.laytonsmith.abstraction.bukkit.BukkitMCServer.dispatchCommand(BukkitMCServer.java:77)
at com.laytonsmith.core.functions.Meta$run.exec(Meta.java:314)
at com.laytonsmith.core.Script.eval(Script.java:308)
at com.laytonsmith.core.Script.seval(Script.java:208)
at com.laytonsmith.core.functions.BasicLogic$or.execs(BasicLogic.java:1405)
at com.laytonsmith.core.Script.eval(Script.java:260)
at com.laytonsmith.core.functions.Meta$scriptas.execs(Meta.java:622)
at com.laytonsmith.core.Script.eval(Script.java:260)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1494)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1454)
at com.laytonsmith.core.events.AbstractEvent.execute(AbstractEvent.java:92)
at com.laytonsmith.core.events.BoundEvent.execute(BoundEvent.java:310)
at com.laytonsmith.core.events.BoundEvent.trigger(BoundEvent.java:268)
at com.laytonsmith.core.events.EventUtils.FireListeners(EventUtils.java:205)
at com.laytonsmith.core.events.EventUtils.TriggerListener(EventUtils.java:193)
at com.laytonsmith.abstraction.bukkit.events.drivers.BukkitPlayerListener.onPlayerJoin(BukkitPlayerListener.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:30)
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:482)
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:467)
at net.minecraft.server.v1_7_R1.PlayerList.c(PlayerList.java:225)
at net.minecraft.server.v1_7_R1.PlayerList.a(PlayerList.java:116)
at net.minecraft.server.v1_7_R1.LoginListener.c(LoginListener.java:87)
at net.minecraft.server.v1_7_R1.LoginListener.a(LoginListener.java:42)
at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:150)
at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134)
at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:657)
at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:259)
at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:540)
at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:446)
at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617)
Caused by: java.lang.NullPointerException
at com.gmail.nossr50.util.scoreboards.ScoreboardManager.isBoardShown(ScoreboardManager.java:391)
at com.gmail.nossr50.commands.McscoreboardCommand.onCommand(McscoreboardCommand.java:41)
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
... 38 more

commented

Comment by PseudoKnight

Pretty sure you can't run a command as the player immediately on player_join.

BTW, you don't need to use or() there. Just put the second command on a new line. You also don't need to use scriptas() when you're running the command as the player in the event.

commented

Comment by LadyCailin

This is actually an underlying bug with the mcMMO plugin, it seems. Regardless, because it's a stacktrace, I've wrapped it in an mscript exception, and provided additional information (including the underlying stack trace if you're in debug mode). This should resolve the issue with CH, though it won't solve your issue.