[SPIGOT-1129] Spawning a LeashHitch with World#spawn(Location, LeashHitch.class) throws a NPE when no block is next to the fence post Created: 12/Aug/15 Updated: 30/Jun/16 Resolved: 30/Jun/16 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Dominik | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 1 |
Labels: | 1.8, LeashHitch, NPE, Spigot, bug, entity | ||
Environment: |
Windows 7 64 bit, Java 1.8.0_51-b16 |
Attachments: |
![]() ![]() |
Plugin: | my own plugin |
Description |
Whenever I want to spawn a LeashHitch on a fence and there is no block besides the fence block I get a NPE. LeashHitch hitch = null; try { hitch = loc.getWorld().spawn(loc, LeashHitch.class); } catch(Exception ex) { ex.printStackTrace(); } java.lang.NullPointerException
at org.bukkit.craftbukkit.v1_8_R3.CraftWorld.createEntity(CraftWorld.java:1083)
at org.bukkit.craftbukkit.v1_8_R3.CraftWorld.spawn(CraftWorld.java:1137)
at org.bukkit.craftbukkit.v1_8_R3.CraftWorld.spawn(CraftWorld.java:862)
at skill.chopping.TreeInstance.buildTree(TreeInstance.java:362)
at skill.chopping.TreeInstance.<init>(TreeInstance.java:106)
at skill.chopping.TreeInstanceManager.addTreeInstanceFromResultSet(TreeInstanceManager.java:70)
at skill.chopping.TreeInstanceManager.loadFromDatabase(TreeInstanceManager.java:47)
at skill.chopping.TreeInstanceManager.<init>(TreeInstanceManager.java:26)
at skill.Chopping.setUpTrees(Chopping.java:147)
at skill.Chopping.<init>(Chopping.java:61)
at skill.SkillManager.registerSkills(SkillManager.java:85)
at skill.SkillManager.<init>(SkillManager.java:42)
at main.UnleashedSkills.setUpSkills(UnleashedSkills.java:216)
at main.UnleashedSkills.onEnable(UnleashedSkills.java:58)
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321)
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340)
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405)
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:356)
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:316)
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:742)
at org.bukkit.Bukkit.reload(Bukkit.java:534)
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141)
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:642)
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(CraftServer.java:628)
at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:404)
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:368)
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:657)
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:560)
at java.lang.Thread.run(Unknown Source)
I attached 2 images showing the result of running the posted code at 2 different locations, one location has another block to the side, the other location has no blocks to the side. |
Comments |
Comment by md_5 [ 13/Aug/15 ] |
Sorry misread slightly. |
Comment by Dominik [ 13/Aug/15 ] |
What exatly do you mean by that? Leashing some animal to a fence with no blocks to the side also works in vanilla minecraft: |
Comment by md_5 [ 13/Aug/15 ] |
Not surprised. |
Comment by SpigotMC [ 12/Aug/15 ] |
Your build is not the latest and therefore may be the reason you are having this issue. Spigot is 14 version(s) behind. CraftBukkit is 32 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue. |