CommandHelper

CommandHelper

46.5k Downloads

pbed() Core Error if missing or obstructed

LadyCailinBot opened this issue ยท 1 comments

commented

CMDHELPER-2953 - Reported by gfrung4

I created the following command:

msg(pbed_location())

When I ran it the following core error resulted:

{cut Core Error}
[08:13:40] [Server thread/INFO]: gfrung4 issued server command: /pbed
[08:13:41] [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:
pbed_location()
on or around C:\vanilla\plugins\CommandHelper\aliases.msa:650.
Please report this error to the developers, and be sure to include the version numbers:
Server version: 1.7.9-R0.1;
CommandHelper version: 3.3.1-SNAPSHOT:2713-d909165,master;
Loaded extensions and versions:
Core (version 3.3.1);
Here's the stacktrace:
java.lang.NullPointerException
at com.laytonsmith.abstraction.bukkit.BukkitMCLocation.getX(BukkitMCLocation.java:38)
at com.laytonsmith.core.ObjectGenerator.location(ObjectGenerator.java:96)
at com.laytonsmith.core.functions.PlayerManagement$pbed_location.exec(PlayerManagement.java:3966)
at com.laytonsmith.core.Script.eval(Script.java:352)
at com.laytonsmith.core.Script.eval(Script.java:321)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1857)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1814)
at com.laytonsmith.core.Script.run(Script.java:193)
at com.laytonsmith.core.AliasCore.alias(AliasCore.java:167)
at com.laytonsmith.commandhelper.CommandHelperListener.runAlias(CommandHelperListener.java:92)
at com.laytonsmith.commandhelper.CommandHelperListener.onPlayerCommandPreprocess(CommandHelperListener.java:137)
at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:292)
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501)
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486)
at net.minecraft.server.v1_7_R3.PlayerConnection.handleCommand(PlayerConnection.java:949)
at net.minecraft.server.v1_7_R3.PlayerConnection.a(PlayerConnection.java:817)
at net.minecraft.server.v1_7_R3.PacketPlayInChat.a(PacketPlayInChat.java:28)
at net.minecraft.server.v1_7_R3.PacketPlayInChat.handle(PacketPlayInChat.java:47)
at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:157)
at net.minecraft.server.v1_7_R3.ServerConnection.c(SourceFile:134)
at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:667)
at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:260)
at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:558)
at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:469)
at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628)
{cut}

I did some farther testing and found out that the command actually checks if the player's bed is "missing or obstructed" and will result in this error if it is. I reset my bed and then the error was gone. When I broke the bed, or surrounded my bed with blocks (so it was obstructed), this error resulted.

It seems that the location returned is NOT the location of the actual bed block, but a location near the bed that Minecraft calculates (likely the location where the player would respawn after death). If that location cannot be found, the error pops out!

This should at least fail more gracefully if the bed is obstructed, but it would be nice to be able to get the player's bed location even if the player couldn't spawn there. Maybe a way to check if it is obstructed? Like pbed_obstructed() return boolean if bed is obstructed or not?

  • Rickster
commented

Comment by PseudoKnight

Fixed the error in build 2812