andrepl / BuildInABox

Carry prefab buildings in enderchests.
3 stars 6 forks source link

NPE after deleting data file #22

Open andrepl opened 11 years ago

andrepl commented 11 years ago

Another strange case is passing a box to my alt and letting him build at my ground with trust. success, but one frontdoor needed to be corrected as it opened asyncronous. So i delete my file and makes a new one. Now i get errors when my alt wants to spawn the box, and the box wont loosen from the ground.

07:06:47 [WARNING] [BuildInABox] Task #3150 for BuildInABox v0.2.1-SNAPSHOT generated an exception java.lang.NullPointerException at com.norcode.bukkit.schematica.Clipboard.copyBlockToWorld(Clipboard.java:624) at com.norcode.bukkit.buildinabox.BuildChest$4.processBlock(BuildChest.java:334) at com.norcode.bukkit.buildinabox.BuildManager$BuildTask.tick(BuildManager.java:90) at com.norcode.bukkit.buildinabox.BuildManager.run(BuildManager.java:41) at org.bukkit.craftbukkit.v1_5_R3.scheduler.CraftTask.run(CraftTask.java:53) at org.bukkit.craftbukkit.v1_5_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:345) at net.minecraft.server.v1_5_R3.MinecraftServer.r(MinecraftServer.java:513) at net.minecraft.server.v1_5_R3.DedicatedServer.r(DedicatedServer.java:226) at net.minecraft.server.v1_5_R3.MinecraftServer.q(MinecraftServer.java:477) at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:410) at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:573)

andrepl commented 11 years ago

https://github.com/andrepl/BuildInABox/issues/20

andrepl commented 11 years ago

Which file did you delete? chests.yml or plans.yml?

fungreenfox commented 11 years ago

none of those. i deleted a hotelhouse by use of "/biab delete hotelkro".

JyeGuru commented 11 years ago

Just want to mention that I had this issue as well - if there are any spawned copies of a template, then they become quite broken after deleting that template. There's also no easy way to tell if there are any copies spawned.

I haven't looked through the code, but I would hope it would be relatively simple to do something like, "on deconstruct, if template no longer exists, call 'make permanent' instead and throw an error."

andrepl commented 11 years ago

https://github.com/andrepl/BuildInABox/commit/1b16489335bd03616b44c95bb444d0c9a6bad651 should handle any interactions with existing chests when their plan is deleted, but I still need to handle the BlockPlace of a BIAB w/ a deleted plan. that's coming soon.

JyeGuru commented 11 years ago

Would it be possible to have the delete routine simply remove the item from player inventories? Even better if it's able to look across the world for any currently-deployed ones and autoperm them.

It's times like these I wish I knew a little more about plugin development so I could look through the code and see what I can do to help.

andrepl commented 11 years ago

it COULD go through player inventories, but it can't check all the chests and other containers in the world, so theres no guarantee it will find/remove all instance of the chest. it can scan for all existing buildings, but that too, is a bit heavy of a task when we can just react on the first interaction of the chest. I will look into that as an option though.