JitseB / NPCLib

(Minecraft) NPCLib – Basic non-player character library.
MIT License
197 stars 49 forks source link

Why do I get this error? #131

Closed Mansitoh closed 3 years ago

Mansitoh commented 3 years ago

[12:10:08 INFO]: Mansitoh issued server command: /kit npc add Diamond [12:10:08 WARN]: NPCLib Failed to create NPC. Please report the following stacktrace message java.lang.NullPointerException: Cannot invoke "java.lang.Class.getConstructors()" because "this.npcClass" is null at net.jitse.npclib.NPCLib.createNPC(NPCLib.java:114) [npclib-plugin-2.11-SNAPSHOT.jar:?] at net.frosty.kitmap.kits.NPCKit.createDiamondNPC(NPCKit.java:51) [FrostyKitmap.jar:?] at net.frosty.kitmap.kits.KitsCommand.onCommand(KitsCommand.java:234) [FrostyKitmap.jar:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [Spigot.jar:?] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) [Spigot.jar:?] at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:766) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:1037) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:874) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:65) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:189) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:799) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:312) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:645) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:550) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [Spigot.jar:?]

org.bukkit.command.CommandException: Unhandled exception executing command 'kit' in plugin FrostyKitmapCore v1.0 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[Spigot.jar:?] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) ~[Spigot.jar:?] at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:766) ~[Spigot.jar:?] at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:1037) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:874) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:65) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:189) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:799) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:312) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:645) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:550) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [Spigot.jar:?] Caused by: java.lang.NullPointerException: Cannot invoke "net.jitse.npclib.api.NPC.setLocation(org.bukkit.Location)" because "diamondnpc" is null at net.frosty.kitmap.kits.NPCKit.createDiamondNPC(NPCKit.java:52) ~[?:?] at net.frosty.kitmap.kits.KitsCommand.onCommand(KitsCommand.java:234) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[Spigot.jar:?] ... 13 more

CODE: Main class: private NPCLib npclib; public void onEnable() { ///Kit npc this.npclib = new NPCLib(this); } public NPCLib getNPCLib() { return npclib; }

NPCKit class:

public static void createDiamondNPC(Player p, String name) {

    int skinid = 383272731;
        NPC diamondnpc = plugin.getNPCLib().createNPC(Arrays.asList("test", "test2"));
        diamondnpc.setLocation(p.getLocation());
        diamondnpc.create();
        diamondnpc.show(p);

}

EazyFTW commented 3 years ago

Because you're using 1.7. image

Mooselk commented 3 years ago

Check the legacy branch for the 1.7 version. However it hasn’t been updated in years.

Mansitoh commented 3 years ago

Because you're using 1.7. image

And how can I use it for 1.7?

EazyFTW commented 3 years ago

Check the legacy branch for the 1.7 version. However it hasn’t been updated in years.

Mansitoh commented 3 years ago

Check the legacy branch for the 1.7 version. However it hasn’t been updated in years.

How do I find that? I don't understand that much because I don't speak English

Mooselk commented 3 years ago

Latest legacy release: https://github.com/MinecraftLibraries/NPCLib/releases/tag/v1.0-legacy

Legacy branch: https://github.com/MinecraftLibraries/NPCLib/tree/legacy

Mansitoh commented 3 years ago

Latest legacy release: https://github.com/MinecraftLibraries/NPCLib/releases/tag/v1.0-legacy

Legacy branch: https://github.com/MinecraftLibraries/NPCLib/tree/legacy

Who version supported 1.7?

Mansitoh commented 3 years ago

[16:23:11 INFO]: [NPCLib] Enabled for MC v1_7_R4 [16:23:11 ERROR]: Error occurred while enabling FrostyKitmapCore v1.0 (Is it up to date?) java.lang.ExceptionInInitializerError at net.jitse.npclib.listeners.PacketListener.start(PacketListener.java:61) ~[?:?] at net.jitse.npclib.NPCLib.registerInternal(NPCLib.java:67) ~[?:?] at net.jitse.npclib.NPCLib.(NPCLib.java:57) ~[?:?] at net.frosty.kitmap.kits.NPCKit.(NPCKit.java:56) ~[?:?] at net.frosty.kitmap.HCF.onEnable(HCF.java:122) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316) ~[Spigot.jar:?] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [Spigot.jar:?] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:412) [Spigot.jar:?] at org.bukkit.craftbukkit.v1_7_R4.CraftServer.loadPlugin(CraftServer.java:477) [Spigot.jar:?] at org.bukkit.craftbukkit.v1_7_R4.CraftServer.enablePlugins(CraftServer.java:395) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.MinecraftServer.n(MinecraftServer.java:354) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.MinecraftServer.g(MinecraftServer.java:328) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.MinecraftServer.a(MinecraftServer.java:284) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.DedicatedServer.init(DedicatedServer.java:232) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:495) [Spigot.jar:?] at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [Spigot.jar:?] Caused by: java.lang.IllegalArgumentException: Cannot find field with type interface io.netty.channel.Channel at com.comphenix.tinyprotocol.Reflection.getField(Reflection.java:177) ~[?:?] at com.comphenix.tinyprotocol.Reflection.getField(Reflection.java:175) ~[?:?] at com.comphenix.tinyprotocol.Reflection.getField(Reflection.java:175) ~[?:?] at com.comphenix.tinyprotocol.Reflection.getField(Reflection.java:175) ~[?:?] at com.comphenix.tinyprotocol.Reflection.getField(Reflection.java:175) ~[?:?] at com.comphenix.tinyprotocol.Reflection.getField(Reflection.java:121) ~[?:?] at com.comphenix.tinyprotocol.Reflection.getField(Reflection.java:133) ~[?:?] at com.comphenix.tinyprotocol.TinyProtocol.(TinyProtocol.java:36) ~[?:?] ... 16 more

Mansitoh commented 3 years ago

[16:39:00 ERROR]: [FrostyKitmapCore] [NPCLib] Error in onPacketInAsync(). java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "com.comphenix.tinyprotocol.Reflection$FieldAccessor.get(Object)" is null at net.jitse.npclib.listeners.PacketListener$1.onPacketInAsync(PacketListener.java:59) ~[npclib-plugin-v1.4.jar:?] at com.comphenix.tinyprotocol.LegacyTinyProtocol$PacketInterceptor.channelRead(LegacyTinyProtocol.java:315) [npclib-plugin-v1.4.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at com.comphenix.protocol.injector.netty.ChannelInjector$4.channelRead(ChannelInjector.java:261) [ProtocolLib.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at net.minecraft.util.io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:149) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:100) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:480) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:447) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:341) [Spigot.jar:?] at net.minecraft.util.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [Spigot.jar:?] at java.base/java.lang.Thread.run(Thread.java:832) [?:?]

WHY GIVE ME THAT ERROR? ON NPCInteractEvent

Mansitoh commented 3 years ago

[10:29:55 ERROR]: [FrostyKitmapCore] [NPCLib] Error in onPacketInAsync(). java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "com.comphenix.tinyprotocol.Reflection$FieldAccessor.get(Object)" is null at net.jitse.npclib.listeners.PacketListener$1.onPacketInAsync(PacketListener.java:59) ~[npclib-plugin-v1.4.jar:?] at com.comphenix.tinyprotocol.LegacyTinyProtocol$PacketInterceptor.channelRead(LegacyTinyProtocol.java:315) [npclib-plugin-v1.4.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at com.comphenix.protocol.injector.netty.ChannelInjector$4.channelRead(ChannelInjector.java:261) [ProtocolLib.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at net.minecraft.util.io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:149) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:100) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:480) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:447) [Spigot.jar:?] at net.minecraft.util.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:341) [Spigot.jar:?] at net.minecraft.util.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [Spigot.jar:?] at java.base/java.lang.Thread.run(Thread.java:832) [?:?]

Mooselk commented 3 years ago

It’s super outdated, I’m planning on implementing features from the latest 1.8.8 release at some point.

Mansitoh commented 3 years ago

It’s super outdated, I’m planning on implementing features from the latest 1.8.8 release at some point.

Ok Thanks, I really need it I'm using 1.7

JitseB commented 3 years ago

Closing, 1.7 is no longer supported.

It has a very different structure than 1.8+ versions, therefore drastically increasing the size of the library. Therefore giving me enough reason to take it out of the library.