Eniripsa96 / SkillAPI

A flexible API for easily creating skills and classes with visual skill trees
112 stars 111 forks source link

NullPointerException while using command 'class attr' #502

Open CharlyZhu opened 4 years ago

CharlyZhu commented 4 years ago

This error occured when command 'class attr' was being used: null org.bukkit.command.CommandException: Unhandled exception executing 'class attr' in class at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:148) ~[spigot.jar:git-Spigot-642f6d2-6103339] at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:648) ~[spigot.jar:git-Spigot-642f6d2-6103339] at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1397) ~[spigot.jar:git-Spigot-642f6d2-6103339] at net.minecraft.server.v1_12_R1.PlayerConnection.chat(PlayerConnection.java:1313) ~[spigot.jar:git-Spigot-642f6d2-6103339] at org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer.chat(CraftPlayer.java:239) ~[spigot.jar:git-Spigot-642f6d2-6103339] at me.skymc.taboomenu.iconcommand.impl.IconCommandOp.execute(IconCommandOp.java:23) ~[?:?] at me.skymc.taboomenu.display.Icon.lambda$null$3(Icon.java:190) ~[?:?] at java.util.ArrayList.forEach(Unknown Source) ~[?:1.8.0_131] at me.skymc.taboomenu.display.Icon.lambda$executeCommand$4(Icon.java:190) ~[?:?] at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) [spigot.jar:git-Spigot-642f6d2-6103339] at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:361) [spigot.jar:git-Spigot-642f6d2-6103339] at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:739) [spigot.jar:git-Spigot-642f6d2-6103339] at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot.jar:git-Spigot-642f6d2-6103339] at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot.jar:git-Spigot-642f6d2-6103339] at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot.jar:git-Spigot-642f6d2-6103339] at java.lang.Thread.run(Unknown Source) [?:1.8.0_131] Caused by: java.lang.NullPointerException at com.sucy.skill.api.player.PlayerData.filter(PlayerData.java:530) ~[?:?] at com.sucy.skill.api.player.PlayerData.openAttributeMenu(PlayerData.java:514) ~[?:?] at com.sucy.skill.cmd.CmdAttribute.execute(CmdAttribute.java:68) ~[?:?] at com.rit.sucy.commands.ConfigurableCommand.execute(ConfigurableCommand.java:550) ~[?:?] at com.rit.sucy.commands.ConfigurableCommand.execute(ConfigurableCommand.java:558) ~[?:?] at com.rit.sucy.commands.ConfigurableCommand.execute(ConfigurableCommand.java:516) ~[?:?] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot.jar:git-Spigot-642f6d2-6103339] ... 15 more

After debugging with your source code, I think the problem comes from the PlayerData class: 512 ItemStack icon = manager.getAttribute(key).getIcon().clone(); 513 ItemMeta meta = icon.getItemMeta(); 514 meta.setDisplayName(filter(meta.getDisplayName(), key)); the icon fetched may not have a display name?