NPE with enter Shop Message
DrkMatr1984 opened this issue ยท 8 comments
So I got it to create the shop finally, but it seems whenever I go in or out I get this NPE. Take a look.
09.12 19:21:20 [Server] INFO at java.lang.Thread.run(Unknown Source) [?:1.7.0_55]
09.12 19:21:20 [Server] INFO at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:526) [spigot.jar:git-Spigot-d5bf866-917e46a]
09.12 19:21:20 [Server] INFO at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:623) [spigot.jar:git-Spigot-d5bf866-917e46a]
09.12 19:21:20 [Server] INFO at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot.jar:git-Spigot-d5bf866-917e46a]
09.12 19:21:20 [Server] INFO at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:694) [spigot.jar:git-Spigot-d5bf866-917e46a]
09.12 19:21:20 [Server] INFO at org.bukkit.craftbukkit.v1_8_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350) [spigot.jar:git-Spigot-d5bf866-917e46a]
09.12 19:21:20 [Server] INFO at org.bukkit.craftbukkit.v1_8_R1.scheduler.CraftTask.run(CraftTask.java:71) ~[spigot.jar:git-Spigot-d5bf866-917e46a]
09.12 19:21:20 [Server] INFO at regalowl.hyperconomy.shop.HyperShopManager$2.run(HyperShopManager.java:142) ~[?:?]
09.12 19:21:20 [Server] INFO at regalowl.hyperconomy.shop.ServerShop.updatePlayerStatus(ServerShop.java:381) ~[?:?]
09.12 19:21:20 [Server] INFO at regalowl.hyperconomy.shop.ServerShop.inShop(ServerShop.java:216) ~[?:?]
09.12 19:21:20 [Server] INFO at regalowl.hyperconomy.shop.ServerShop.inShop(ServerShop.java:212) ~[?:?]
09.12 19:21:20 [Server] INFO java.lang.NullPointerException
I think maybe it all stems from this now that I'm getting this error. Something in SimpleDataManager not parsing the YML correctly.
10.12 13:03:31 [Server] INFO [13:03:31 WARN]: at java.util.TimerThread.run(Unknown Source)
10.12 13:03:31 [Server] INFO [13:03:31 WARN]: at java.util.TimerThread.mainLoop(Unknown Source)
10.12 13:03:31 [Server] INFO [13:03:31 WARN]: at regalowl.hyperconomy.simpledatalib.file.YamlHandler$SaveTask.run(YamlHandler.java:87)
10.12 13:03:31 [Server] INFO [13:03:31 WARN]: at regalowl.hyperconomy.simpledatalib.file.YamlHandler.saveYamls(YamlHandler.java:53)
10.12 13:03:31 [Server] INFO [13:03:31 WARN]: at regalowl.hyperconomy.simpledatalib.file.YamlHandler.saveYaml(YamlHandler.java:44)
10.12 13:03:31 [Server] INFO [13:03:31 WARN]: at regalowl.hyperconomy.simpledatalib.file.FileConfiguration.save(FileConfiguration.java:76)
10.12 13:03:31 [Server] INFO [13:03:31 WARN]: at regalowl.hyperconomy.simpledatalib.org.yaml.snakeyaml.Yaml.dump(Yaml.java:221)
10.12 13:03:31 [Server] INFO [13:03:31 WARN]: at regalowl.hyperconomy.simpledatalib.org.yaml.snakeyaml.Yaml.dumpAll(Yaml.java:237)
10.12 13:03:31 [Server] INFO [13:03:31 WARN]: java.lang.LinkageError: loader constraint violation: when resolving method "regalowl.hyperconomy.simpledatalib.org.yaml.snakeyaml.emitter.Emitter.(Ljava/io/Writer;Lregalowl/hyperconomy/simpledatalib/org/yaml/snakeyaml/DumperOptions;)V" the class loader (instance of org/bukkit/plugin/java/PluginClassLoader) of the current class, regalowl/hyperconomy/simpledatalib/org/yaml/snakeyaml/Yaml, and the class loader (instance of org/bukkit/plugin/java/PluginClassLoader) for resolved class, regalowl/hyperconomy/simpledatalib/org/yaml/snakeyaml/emitter/Emitter, have different Class objects for the type ib.org.yaml.snakeyaml.emitter.Emitter.(Ljava/io/Writer;Lregalowl/hyperconomy/simpledatalib/org/yaml/snakeyaml/DumperOptions;)V used in the signature
Ok I added this to test it out
public boolean inShop(HLocation l) {
if(l != null)
return inShop(l.getBlockX(), l.getBlockY(), l.getBlockZ(), l.getWorld());
return false;
}
@OverRide
public boolean inShop(HyperPlayer hp) {
if(hp != null)
return inShop(hp.getLocation());
return false;
}
I'm not sure which one was returning null, but I only get the leave shop message in game. The Welcome to shop message never shows up at all, so I assume that's where the NPE was coming from. Hope this helps!
Thanks for all the info. Could you try the latest dev build and see if this is fixed? (#459)
No problem, I love this plugin! Like I said If HyperMerchant guy doesn't update soon I'll be updating his plugin and adding a pull-request, so I need this! I''m glad you're still working on this plugin. Anyway, just loaded it in and had the same error at first, but I deleted all data inside the Hyperconomy plugin folder and it seems fixed for now. I'm super tired so I will create a shop and test it out in the morning! Thanks!
Ok, I set up the shop again. Still getting the same NPE when going in or out of the shop, although the shop functions fine. More details after log here :
12.12 05:10:30 [Server] INFO at java.lang.Thread.run(Unknown Source) [?:1.7.0_55]
12.12 05:10:30 [Server] INFO at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:526) [spigot.jar:git-Spigot-d5bf866-917e46a]
12.12 05:10:30 [Server] INFO at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:623) [spigot.jar:git-Spigot-d5bf866-917e46a]
12.12 05:10:30 [Server] INFO at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot.jar:git-Spigot-d5bf866-917e46a]
12.12 05:10:30 [Server] INFO at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:694) [spigot.jar:git-Spigot-d5bf866-917e46a]
12.12 05:10:30 [Server] INFO at org.bukkit.craftbukkit.v1_8_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350) [spigot.jar:git-Spigot-d5bf866-917e46a]
12.12 05:10:30 [Server] INFO at org.bukkit.craftbukkit.v1_8_R1.scheduler.CraftTask.run(CraftTask.java:71) ~[spigot.jar:git-Spigot-d5bf866-917e46a]
12.12 05:10:30 [Server] INFO at regalowl.hyperconomy.shop.HyperShopManager$2.run(HyperShopManager.java:142) ~[?:?]
12.12 05:10:30 [Server] INFO at regalowl.hyperconomy.shop.ServerShop.updatePlayerStatus(ServerShop.java:381) ~[?:?]
12.12 05:10:30 [Server] INFO at regalowl.hyperconomy.shop.ServerShop.inShop(ServerShop.java:216) ~[?:?]
12.12 05:10:30 [Server] INFO at regalowl.hyperconomy.shop.ServerShop.inShop(ServerShop.java:212) ~[?:?]
12.12 05:10:30 [Server] INFO java.lang.NullPointerException
12.12 05:10:30 [Server] INFO [05:10:30 WARN]: [HyperConomy] Task #194 for HyperConomy v0.975.1 generated an exception
This time however, I got the "Welcome to " message immediately after setting p1 and giving shop a name, then "You have left the shop" right after walking away from p1 like usual. But as soon as I defined p2, it started throwing the NPE's and not displaying either of those two messages, and continues to throw the NPEs as long as you are inside shop boundaries or go in or out.
Thanks for your help! And btw, this was with a fresh install.
Dev build #463 should fix the null errors in inShop(). Did the LinkageError related to YAML loading go away?
Yep, it definitely did. Thanks for all of your help. I'll let you know if I run across any more bugs while testing your latest build. You can go ahead and close the ticket now if you want and I'll open a new one if I run into anything!