NpcSpawner lib - spawn basic NPCs

Discussion in 'Resources' started by Redecouverte, Feb 3, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Derek Peterson

    I'm getting NullPointerExceptions from the latest from, is that to be expected?

    [edit] I should note that I'm getting them when I try to initialize NPCManager:

    16:10:46 [SEVERE] null
    	at org.martin.bukkit.npclib.BServer.<init>(
    	at org.martin.bukkit.npclib.BServer.getInstance(
    	at org.martin.bukkit.npclib.NPCManager.<init>(
    	at com.derekpeterson.Plugin.Plugin.<init>(
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
    	at java.lang.reflect.Constructor.newInstance(
    	at org.bukkit.plugin.SimplePluginManager.loadPlugin(
    	at org.bukkit.plugin.SimplePluginManager.loadPlugins(
    	at org.bukkit.craftbukkit.CraftServer.loadPlugins(
    	at org.bukkit.craftbukkit.CraftServer.<init>(
    	at net.minecraft.server.ServerConfigurationManager.<init>(
    	at net.minecraft.server.MinecraftServer.init(
  2. Offline


    Only if you're passing it null... can i see your code?
  3. Offline

    Derek Peterson

    Aha, I found the problem. I was trying to initialize it up by my listeners, which is before plugin.getServer() will work. I declared it up there, and am now initializing it in onEnable, and it's working great! Thank you!

    Is there any way I can get a LivingEntity out of an NPCEntity so I can change its skin using SpoutAPI?
  4. Offline


    NPCEntity is a living entity....
  5. Offline

    Derek Peterson

    java.lang.ClassCastException: org.martin.bukkit.npclib.NPCEntity cannot be cast to org.bukkit.entity.LivingEntity
    at com.derekpeterson.Plugin.Plugin.spawnNpc(
    at com.derekpeterson.Plugin.PluginPlayerListener.onPlayerMove(
    at org.bukkit.plugin.RegisteredListener.callEvent(
    at org.bukkit.plugin.SimplePluginManager.callEvent(
    at net.minecraft.server.NetServerHandler.a(
    at org.getspout.spout.SpoutNetServerHandler.a(
    at net.minecraft.server.Packet10Flying.a(SourceFile:126)
    at net.minecraft.server.NetworkManager.b(
    at net.minecraft.server.NetServerHandler.a(
    at org.getspout.spout.SpoutNetServerHandler.a(
    at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
    at net.minecraft.server.MinecraftServer.h(

    Aha, npcEntity.getBukkitEntity() returns a HumanEntity!

    Ok I do have one final question. Ever since adding this library, I get this message on reloading:

    17:44:19 [SEVERE] Nag author: '<derekpeterson>' of 'NightfallMC' about the following: This plugin is not properly shutting down its async tasks when it is being reloaded.  This may cause conflicts with the newly loaded version of the plugin
    I never had this show up before, could it be something is outdated in the library?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 8, 2016
  6. Offline


    /me nags @Top_Cat to add Spout support :3
  7. Offline


    I can only reply as above, if you're sending it your plugin then it'll work fine...
  8. Offline


    You should know 1.8 broke the npclib :(
    Hope you can fix it!
  9. Offline


    I know, I have other priorities but it will be fixed :)
    sddddgjd likes this.
  10. Offline


    Lolmewn likes this.
  11. Offline


    ah this is great, i was going to post about

    java.lang.NoSuchMethodError: net.minecraft.server.ItemInWorldManager.<init>(Lnet/minecraft/server/WorldServer;)V
  12. Offline


    Sometimes this happens:
    2011-09-16 23:11:46 [SEVERE] java.lang.NullPointerException
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.AxisAlignedBB.b(SourceFile:27)
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.Block.e(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.Block.a(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.World.getEntities(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.Entity.move(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.EntityLiving.a(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.EntityLiving.s(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.EntityMonster.s(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.EntityLiving.s_(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.EntityMonster.s_(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.EntityCreeper.s_(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.World.entityJoinedWorld(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.WorldServer.entityJoinedWorld(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.World.playerJoinedWorld(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.World.cleanUp(
    2011-09-16 23:11:46 [SEVERE] 	at net.minecraft.server.MinecraftServer.h(
    2011-09-16 23:11:46 [SEVERE] 	at
    2011-09-16 23:11:46 [SEVERE] 	at
    2011-09-16 23:11:46 [SEVERE] Unexpected exception
    	at net.minecraft.server.AxisAlignedBB.b(SourceFile:27)
    	at net.minecraft.server.Block.e(
    	at net.minecraft.server.Block.a(
    	at net.minecraft.server.World.getEntities(
    	at net.minecraft.server.Entity.move(
    	at net.minecraft.server.EntityLiving.a(
    	at net.minecraft.server.EntityLiving.s(
    	at net.minecraft.server.EntityMonster.s(
    	at net.minecraft.server.EntityLiving.s_(
    	at net.minecraft.server.EntityMonster.s_(
    	at net.minecraft.server.EntityCreeper.s_(
    	at net.minecraft.server.World.entityJoinedWorld(
    	at net.minecraft.server.WorldServer.entityJoinedWorld(
    	at net.minecraft.server.World.playerJoinedWorld(
    	at net.minecraft.server.World.cleanUp(
    	at net.minecraft.server.MinecraftServer.h(
    Followed shortly by tons of errors regarding line 44 of NPCManager,nullpointerexception apparently!
    Could be bukkit bug though...
  13. Offline


    I know it's not in your priorities,i understand you're busy with Spout and stuff...but is there any way to move npcs right now? I mean,make them move from one location to another...
  14. Offline


    There are pathfinding methods in the lib using A*
  15. Offline


    Sorry,never compiled using craftbukkit do i access it? I have the NPCEntity,but the only method with a capital A seems to be A(),which doesn't seem to do anything...
  16. Offline


    A* is the algorithm not the function name.
    NPCEntity.pathFindTo(location, maxIterations)
  17. Offline

    Lolmewn Retired Staff

    how can I check if a Entity that has been hit is a NPC, and not another player?
  18. Offline


  19. Offline

    Lolmewn Retired Staff

  20. Offline


    Double thanks as this was asked and answered just as I needed it.
  21. Offline


  22. Offline

    Lolmewn Retired Staff

    It seems that whenever an NPC spawns it sais "Read Timed Out".
    The NPC is there, however.
  23. Offline


    you know, you are amazing :D
    this is great :)
  24. Offline


    Hey, I have a bug to report / question to ask.

      if(rand.nextInt(10) == 0)
    Player)npc.getBukkitEntity()).chat("The hive rules all! Kill Kill Kill!");
    Seems to give this exception:
          at org
    at org.bukkit.event.player.PlayerChatEvent.<init>(
    (I'm using java, but the PHP code tag has proper syntax highlighting, so..)

  25. Offline


    Never Mind, I found a work around.
  26. Offline


    Hello, does it make sense to you?
  27. Offline


    Has anybody had errors in these classes:

    BServer and NPCNetworkManager

    they seem to have errors in the methods?
  28. Offline


    Care to be more specific?
  29. Offline


    Sure, here, i think i fixed it by doing the things i say, but i'm not sure it's right?


        public void a(Packet packet) {
    <<<says it must override or implement a supertype, i removed the @Override and it worked>>>


    public void stop() {
    <<<error under the a, and it was referring to the server, to i guessed it stopped it, and i removed the.a for .stop();>>>

    public int getSpawnProtationRadius() {
            return mcServer.spawnProtection;
    <<<just says it cant find any reference of spawnprotection, so i just removed it :p>>>

    I wish i knew more about this, I want it to work for myself and others :p

    in the main class, i had

    public final NPCManager npcmanager = new NPCManager(this);

    but i read you should put it in onEnable, so i put itin, and it won't let me have public, only final.

    Any ideas? :p

    PS. you should write a guide to this ;)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 8, 2016
  30. Offline


    The first issue is because you have not have the latest version of the lib, do NOT remove @Overrides if they are causing errors, they should be dealt with properly ie the correct method name should be found. Removing the annotation breaks things.

    The second issue is that a field cannot be public inside a function and it cannot be final if not defined in the constructor. Basic java, learn it.
Thread Status:
Not open for further replies.

Share This Page