CommandHelper

CommandHelper

46.5k Downloads

Error when using tame_mob(null, @horse_entity_id)

LadyCailinBot opened this issue · 5 comments

commented

CMDHELPER-2962 - Reported by pr4xt3roy

I was trying to untame a horse

  @player = player()
  @player_entity_id = pinfo(@player, 13)
  @horse_entity_id = get_entity_vehicle(@player_entity_id)
  tame_mob(null, @horse_entity_id)

and I got the following error:

2014-08-01 04:22:38 [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:
@horse_entity_id = 8090844
tame_mob(null, @horse_entity_id)
on or around /media/msm/servers/caprica/plugins/CommandHelper/LocalPackages/horse_protection/auto_include.ms:111.
Please report this error to the developers, and be sure to include the version numbers:
Server version: 1.7.9-R0.3-SNAPSHOT;
CommandHelper version: 3.3.1-SNAPSHOT:2732-826f6a6,master;
Loaded extensions and versions:
CHGriefPrevention (version 1.1.0);
Core (version 3.3.1);
Here's the stacktrace:
java.lang.NullPointerException
commented

Comment by PseudoKnight

David Buxó fixed it in build 2823.

commented

Comment by LadyCailin

You've left off the most important part of the stacktrace! I can figure it out without this, this time though, but for future reference, the line numbers and stuff are pretty important ;)

commented

Comment by pr4xt3roy

oopsie! my bad. I'll enable debugging next time to see a complete stacktrace.

commented

Comment by LadyCailin

The full stacktrace will be displayed, regardless of debug mode. You just didn't copy it.

commented

Comment by David.Buxó

tame_mob expects a player context

NullPointerException rise here:
457 String player = environment.getEnv(CommandHelperEnvironment.class).GetPlayer().getName();
If GetPlayer() is null, getName() throws the exception.

java.lang.NullPointerException
at com.laytonsmith.core.functions.Minecraft$tame_mob.exec(Minecraft.java:457)
at com.laytonsmith.core.Script.eval(Script.java:353)
at com.laytonsmith.core.Script.eval(Script.java:322)
at com.laytonsmith.core.Script.seval(Script.java:240)
at com.laytonsmith.core.functions.BasicLogic$_if.execs(BasicLogic.java:84)
at com.laytonsmith.core.Script.eval(Script.java:312)
at com.laytonsmith.core.functions.DataHandling$foreach.execs(DataHandling.java:732)
at com.laytonsmith.core.Script.eval(Script.java:312)
at com.laytonsmith.core.Procedure.execute(Procedure.java:213)
at com.laytonsmith.core.Procedure.cexecute(Procedure.java:164)
at com.laytonsmith.core.Script.eval(Script.java:281)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1908)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1865)
at com.laytonsmith.core.constructs.CClosure.execute(CClosure.java:161)
at com.laytonsmith.core.functions.Scheduling$set_interval$1.run(Scheduling.java:281)
at com.laytonsmith.abstraction.bukkit.BukkitConvertor$1.call(BukkitConvertor.java:307)
at org.bukkit.craftbukkit.v1_8_R1.scheduler.CraftFuture.run(CraftFuture.java:89)
at org.bukkit.craftbukkit.v1_8_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350)
at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:694)
at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316)
at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:623)
at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:526)
at java.lang.Thread.run(Thread.java:744)