CommandHelper

CommandHelper

46.5k Downloads

world guard functions throw null pointer exceptions

4lfalfa opened this issue ยท 2 comments

commented

i tested with sk_all_regions() but i think other sk functions are also affected
world edit, world guard and command helper on newest development build
here the stacktrace i allways get when calling it

update: i tested some more, it only seems to happen when you call them during initialisation in the main.ms, in a binded event it is fine

09:42:09 [SEVERE] 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:
sk_all_regions()
on or around /home/max/Desktop/minecraft survival/minecraft/plugins/CommandHelper/main.ms:2.
Please report this error to the developers, and be sure to include the version numbers: Server version: 1.5.2-R0.1-SNAPSHOT; CommandHelper version: 1484-5d963a9. Here's the stacktrace:
java.lang.NullPointerException
at com.laytonsmith.core.functions.WorldEdit$sk_all_regions.exec(WorldEdit.java:506)
at com.laytonsmith.core.Script.eval(Script.java:301)
at com.laytonsmith.core.Script.eval(Script.java:262)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1489)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1454)
at com.laytonsmith.core.AliasCore$LocalPackage.compileMS(AliasCore.java:535)
at com.laytonsmith.core.AliasCore.reload(AliasCore.java:317)
at com.laytonsmith.commandhelper.CommandHelperPlugin.onEnable(CommandHelperPlugin.java:175)
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:383)
at org.bukkit.craftbukkit.v1_5_R3.CraftServer.loadPlugin(CraftServer.java:306)
at org.bukkit.craftbukkit.v1_5_R3.CraftServer.enablePlugins(CraftServer.java:288)
at net.minecraft.server.v1_5_R3.MinecraftServer.j(MinecraftServer.java:310)
at net.minecraft.server.v1_5_R3.MinecraftServer.e(MinecraftServer.java:289)
at net.minecraft.server.v1_5_R3.MinecraftServer.a(MinecraftServer.java:249)
at net.minecraft.server.v1_5_R3.DedicatedServer.init(DedicatedServer.java:149)
at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:388)
at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:573)

commented

I've also noticed this. Running latest Jenkins ( as of 3 June )

Edit: I believe the null is coming from
com/laytonsmith/core/Static.java:398 'getWorldEditPlugin'

Although it checks if the value is null and tries another method to fetch the plugin, it will still return null if that fails.
Either checks need to be made each time this method is called or this method needs to provide some other mechanism.

I believe adding a checkPlugin("WorldEdit", t) at the top of any WorldEdit function call might at least provide a more specified error message when this occurs.
I don't think WorldEdit is available at the time of main.ms as it hasn't been fully loaded yet. This could be the cause of the null pointer.

I can't be sure without testing, I'll pull the source tonight and have a look.

@4lfalfa What you could do is use set_timeout with 0 delay. That should fire your WorldEdit code as soon as the event loop kicks in, I've not checked this but I'd imagine no events are called until after everything has loaded.

commented

I opened a bug on the main bug tracker, and I'm closing this issue on github.

http://youtrack.sk89q.com/issue/CMDHELPER-2746