1.16.5 [solved] nullpointerexception for ItemStack player head

Discussion in 'Spigot Plugin Development' started by AoNoAsgard, Jun 8, 2021.

Thread Status:
Not open for further replies.
  1. hi,
    i'm trying to develop a plugin that uses playerheads, but i'm getting a a NullPointerException error when i'm trying to put an itemStack object in a List of ItemStacks.

    the code can be fuond here : https://github.com/AoNoAsgard/Plugi...noasgard/eastereggs/items/SkullUtilities.java
    in row 45.

    basically i'm creating a list as cache so when i need to drop the head i can just clone it.

    if i'm doing something wrong let me know.
     
  2. Can you post the full error please?
     
  3. Please post full error
     
  4. You are never assigning a value to your field "teste".
     
  5. here the full error

    java.lang.NullPointerException: null
    at it.aonoasgard.eastereggs.items.SkullUtilities.<init>(SkullUtilities.java:45) ~[?:?]
    at it.aonoasgard.eastereggs.inits.JsonInits.initialize(JsonInits.java:13) ~[?:?]
    at it.aonoasgard.eastereggs.Eastereggs.onEnable(Eastereggs.java:16) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:351) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:493) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:407) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.reload(CraftServer.java:880) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at org.bukkit.Bukkit.reload(Bukkit.java:651) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:762) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchServerCommand(CraftServer.java:747) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at net.minecraft.server.v1_16_R3.DedicatedServer.handleCommandQueue(DedicatedServer.java:426) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:395) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1127) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:966) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[spigot-1.16.5.jar:3066-Spigot-bd6b566-d28f36c]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282]
     
  6. ok , i think probably is this, give me time for a quick fix and check...
     
  7. yeah, the error was this...
    i feel so stupid now.

    thanks a lot!
     
Thread Status:
Not open for further replies.