Development Assistance Custom NPCs

Discussion in 'Plugin Help/Development/Requests' started by benzimmer123, Apr 21, 2015.

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

    benzimmer123

    I am looking to create a custom NPC that can move, attack, sprint and switch items in hand. I done a little bit of research on google but everything is outdated. Anyone got any ideas?
     
  2. Offline

    Totom3

    Citizens 2 is maintained (also available for spigot 1.8) and offers a decent API for developers to extend. Surprised you didn't came across it.
     
  3. Offline

    benzimmer123

    Thanks, just downloaded and added the version 1.7.4 (My server version) to my build path and to my server plugins. Any ideas what is wrong with this? Am I using an outdated version or something? I got this error...

    Code:
    org.bukkit.command.CommandException: Unhandled exception executing command 'p' i
    n plugin PotionPVP v1.0
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spi
    got.jar:git-Spigot-1571]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
    1) ~[spigot.jar:git-Spigot-1571]
            at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServe
    r.java:767) ~[spigot.jar:git-Spigot-1571]
            at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerCon
    nection.java:1010) [spigot.jar:git-Spigot-1571]
            at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java
    :847) [spigot.jar:git-Spigot-1571]
            at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java
    :28) [spigot.jar:git-Spigot-1571]
            at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat
    .java:65) [spigot.jar:git-Spigot-1571]
            at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:184
    ) [spigot.jar:git-Spigot-1571]
            at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java
    :81) [spigot.jar:git-Spigot-1571]
            at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:7
    31) [spigot.jar:git-Spigot-1571]
            at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:2
    89) [spigot.jar:git-Spigot-1571]
            at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:5
    84) [spigot.jar:git-Spigot-1571]
            at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java
    :490) [spigot.jar:git-Spigot-1571]
            at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:6
    28) [spigot.jar:git-Spigot-1571]
    Caused by: java.lang.NoClassDefFoundError: net/citizensnpcs/api/CitizensAPI
            at minecraft.pot.serverbot.BotManager.SpawnNPC(BotManager.java:16) ~[?:?
    ]
            at minecraft.pot.commands.Ping.onCommand(Ping.java:26) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spi
    got.jar:git-Spigot-1571]
            ... 13 more
    Caused by: java.lang.ClassNotFoundException: net.citizensnpcs.api.CitizensAPI
            at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_25]
            at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_25]
            at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_
    25]
            at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_25]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:98) ~[spigot.jar:git-Spigot-1571]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:83) ~[spigot.jar:git-Spigot-1571]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
            at minecraft.pot.serverbot.BotManager.SpawnNPC(BotManager.java:16) ~[?:?
    ]
            at minecraft.pot.commands.Ping.onCommand(Ping.java:26) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spi
    got.jar:git-Spigot-1571]
            ... 13 more
    This is my current code...

    Code:
        public void SpawnNPC(String name, Location l, Entity e) {
            NPCRegistry registry = CitizensAPI.getNPCRegistry(); // Line 16
            NPC npc = registry.createNPC(EntityType.PLAYER, name);
            npc.spawn(l);
            npc.getNavigator().setTarget(e, true);
    }
     
    Last edited: Apr 23, 2015
  4. Offline

    SuperOriginal

    Make sure you have the same Citizens plugin version in your server as you do in your build path, and make sure Citezens is successfully loading. (Depend on it in your plugin.yml)
     
  5. Offline

    benzimmer123

  6. Offline

    Konato_K

    @benzimmer123 You didn't
    Code:
    Caused by: java.lang.NoClassDefFoundError: net/citizensnpcs/api/CitizensAPI
     
  7. Offline

    benzimmer123

    @Konato_K
    This right?
    Code:
    depend: [Citizens]
    EDIT: Both my plugin in my build path and in the server must be the same version as the build path uses the actual plugin as the jar file.
     
    Last edited: Apr 22, 2015
Thread Status:
Not open for further replies.

Share This Page