Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException at mytown.protection.ProtectionManager.getFlagValueAtLocation(ProtectionManager.java:258) #508

Open
kratz74 opened this issue Sep 13, 2016 · 7 comments

Comments

@kratz74
Copy link

kratz74 commented Sep 13, 2016

NPE in mytown.protection.ProtectionManager.getFlagValueAtLocation is being thrown during world generation:

[20:53:48] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.entity.living.LivingSpawnEvent$CheckSpawn@5e3cd0af:
java.lang.NullPointerException
        at mytown.protection.ProtectionManager.getFlagValueAtLocation(ProtectionManager.java:258) ~[ProtectionManager.class:?]
        at mytown.protection.ProtectionManager.checkExist(ProtectionManager.java:122) ~[ProtectionManager.class:?]
        at mytown.protection.ProtectionHandlers.checkSpawn(ProtectionHandlers.java:461) ~[ProtectionHandlers.class:?]
        at cpw.mods.fml.common.eventhandler.ASMEventHandler_94_ProtectionHandlers_checkSpawn_CheckSpawn.invoke(.dynamic) ~[?:?]
        at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?]
        at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:?]
        at net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(ForgeEventFactory.java:112) [ForgeEventFactory.class:?]
        at drzhark.customspawner.CustomSpawner.performWorldGenSpawning(CustomSpawner.java:790) [CustomSpawner.class:?]
        at drzhark.customspawner.EventHooks.peformCustomWorldGenSpawning(EventHooks.java:51) [EventHooks.class:?]
        at cpw.mods.fml.common.eventhandler.ASMEventHandler_47_EventHooks_peformCustomWorldGenSpawning_Populate.invoke(.dynamic) [?:?]
        at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) [ASMEventHandler.class:?]
        at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:?]
        at net.minecraftforge.event.terraingen.TerrainGen.populate(TerrainGen.java:36) [TerrainGen.class:?]
        at net.minecraft.world.gen.ChunkProviderGenerate.func_73153_a(ChunkProviderGenerate.java:429) [aqz.class:?]
        at net.minecraft.world.gen.ChunkProviderServer.func_73153_a(ChunkProviderServer.java:279) [ms.class:?]
        at net.minecraft.world.chunk.Chunk.func_76624_a(Chunk.java:1055) [apx.class:?]
        at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:190) [ms.class:?]
        at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:131) [ms.class:?]
        at net.minecraft.world.gen.ChunkProviderServer.func_73158_c(ChunkProviderServer.java:101) [ms.class:?]
        at net.minecraft.server.MinecraftServer.func_71222_d(MinecraftServer.java:265) [MinecraftServer.class:?]
        at net.minecraft.server.MinecraftServer.func_71247_a(MinecraftServer.java:235) [MinecraftServer.class:?]
        at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:258) [lt.class:?]
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:387) [MinecraftServer.class:?]
        at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) [li.class:?]
[20:53:48] [Server thread/ERROR] [FML]: Index: 3 Listeners:
[20:53:48] [Server thread/ERROR] [FML]: 0: NORMAL
[20:53:48] [Server thread/ERROR] [FML]: 1: ASM: lotr.common.LOTREventHandler@2d40cf05 onEntitySpawnAttempt(Lnet/minecraftforge/event/entity/living/LivingSpawnEvent$CheckSpawn;)V
[20:53:48] [Server thread/ERROR] [FML]: 2: ASM: drzhark.customspawner.EventHooks@4c70a0ca onLivingSpawn(Lnet/minecraftforge/event/entity/living/LivingSpawnEvent$CheckSpawn;)V
[20:53:48] [Server thread/ERROR] [FML]: 3: ASM: mytown.protection.ProtectionHandlers@116f976f checkSpawn(Lnet/minecraftforge/event/entity/living/LivingSpawnEvent$CheckSpawn;)V

After fixing this there is another one

[21:07:58] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.entity.living.LivingSpawnEvent$CheckSpawn@70be1c88:
java.lang.NullPointerException
        at mytown.protection.ProtectionManager.checkExist(ProtectionManager.java:123) ~[ProtectionManager.class:?]
        at mytown.protection.ProtectionHandlers.checkSpawn(ProtectionHandlers.java:461) ~[ProtectionHandlers.class:?]
        at cpw.mods.fml.common.eventhandler.ASMEventHandler_91_ProtectionHandlers_checkSpawn_CheckSpawn.invoke(.dynamic) ~[?:?]
        at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?]
        at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:?]
        at net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(ForgeEventFactory.java:112) [ForgeEventFactory.class:?]
        at drzhark.customspawner.CustomSpawner.performWorldGenSpawning(CustomSpawner.java:790) [CustomSpawner.class:?]
        at drzhark.customspawner.EventHooks.peformCustomWorldGenSpawning(EventHooks.java:51) [EventHooks.class:?]
        at cpw.mods.fml.common.eventhandler.ASMEventHandler_52_EventHooks_peformCustomWorldGenSpawning_Populate.invoke(.dynamic) [?:?]
        at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) [ASMEventHandler.class:?]
        at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:?]
        at net.minecraftforge.event.terraingen.TerrainGen.populate(TerrainGen.java:36) [TerrainGen.class:?]
        at net.minecraft.world.gen.ChunkProviderGenerate.func_73153_a(ChunkProviderGenerate.java:400) [aqz.class:?]
        at net.minecraft.world.gen.ChunkProviderServer.func_73153_a(ChunkProviderServer.java:279) [ms.class:?]
        at net.minecraft.world.chunk.Chunk.func_76624_a(Chunk.java:1055) [apx.class:?]
        at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:190) [ms.class:?]
        at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:131) [ms.class:?]
        at net.minecraft.world.gen.ChunkProviderServer.func_73158_c(ChunkProviderServer.java:101) [ms.class:?]
        at net.minecraft.server.MinecraftServer.func_71222_d(MinecraftServer.java:265) [MinecraftServer.class:?]
        at net.minecraft.server.MinecraftServer.func_71247_a(MinecraftServer.java:235) [MinecraftServer.class:?]
        at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:258) [lt.class:?]
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:387) [MinecraftServer.class:?]
        at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) [li.class:?]
[21:07:58] [Server thread/ERROR] [FML]: Index: 3 Listeners:
[21:07:58] [Server thread/ERROR] [FML]: 0: NORMAL
[21:07:58] [Server thread/ERROR] [FML]: 1: ASM: lotr.common.LOTREventHandler@37f9cae9 onEntitySpawnAttempt(Lnet/minecraftforge/event/entity/living/LivingSpawnEvent$CheckSpawn;)V
[21:07:58] [Server thread/ERROR] [FML]: 2: ASM: drzhark.customspawner.EventHooks@437a2b5 onLivingSpawn(Lnet/minecraftforge/event/entity/living/LivingSpawnEvent$CheckSpawn;)V
[21:07:58] [Server thread/ERROR] [FML]: 3: ASM: mytown.protection.ProtectionHandlers@6c7b22a6 checkSpawn(Lnet/minecraftforge/event/entity/living/LivingSpawnEvent$CheckSpawn;)V

I got them after adding CustomMobSpawner and MoCreatures into modpack and generating new world.

@kratz74
Copy link
Author

kratz74 commented Sep 13, 2016

fix.zip
Here is diff that removed NPEs in my environment.
I'm not sure with exact meaning of null value in

if (flagValueAtLocation != null && !flagValueAtLocation) {

so maybe this condition needs to be fixed.

Again, this is another show stopper, now on server side, so please have a look at it ASAP.
Thanks.

@Eufranio
Copy link

Try deleting the database

@kratz74
Copy link
Author

kratz74 commented Sep 13, 2016

Yes, it may help. But having NPE in the code is not good anyway. Code in checkExist is wrong because getFlagValueAtLocation returns Boolean instance and implicit cast to boolean in if expression causes NPE when it returns null.
Also getFlagValueAtLocation can return null even without my changes.

@Eufranio
Copy link

I think they won't fix, the project seems to be abandoned :/

@kratz74
Copy link
Author

kratz74 commented Sep 13, 2016

There is some commit activity from the end of July and last release is from April 2016 so it does not look like dead code. I use modified versions of this old mod for 1.6.4 and current code for 1.7.10 so I believe there is a chance to see this fixed. Also I gave them an idea how to fix it so it should be simple.
Edit: I found MyTown as best one to satisfy my current needs for residence protection so hope it won't die soon.

@Eufranio
Copy link

Same :/

@kratz74
Copy link
Author

kratz74 commented Oct 7, 2017

https://github.com/kratz74/MyTown2 is my fork with few things fixed including this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants