Hey, trying to open up the pickaxeinv inventory but its throwing out errors, and the stacktrace ends.. doesn't help :/ Anyone able to help me figure out what the issue is?
Class:
Stacktrace:
Class:
Stacktrace:
nopeit should show in console the stacktrace and which line the code is screwing up, check where that is
[11:09:35 INFO]: PurrfectMistake_ issued server command: /etshop
[11:09:36 ERROR]: Could not pass event InventoryClickEvent to MineArch-TokenEnchantGUI v1.0
org.bukkit.event.EventException: null
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[minecraft_server.ja
r:git-Spigot-7754231-94b0980]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[minecraft_server.jar:
git-Spigot-7754231-94b0980]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:499) [minecraft_server.ja
r:git-Spigot-7754231-94b0980]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:484) [minecraft_server.ja
r:git-Spigot-7754231-94b0980]
at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1884) [minecraft_server.jar
:git-Spigot-7754231-94b0980]
at net.minecraft.server.v1_12_R1.PacketPlayInWindowClick.a(SourceFile:33) [minecraft_server.jar:git-S
pigot-7754231-94b0980]
at net.minecraft.server.v1_12_R1.PacketPlayInWindowClick.a(SourceFile:10) [minecraft_server.jar:git-S
pigot-7754231-94b0980]
at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) [minecraft_server.jar:git
-Spigot-7754231-94b0980]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_171]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_171]
at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [minecraft_server.jar:git-Spigot-775423
1-94b0980]
at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748) [minecraft_server.jar:gi
t-Spigot-7754231-94b0980]
at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [minecraft_server.jar:gi
t-Spigot-7754231-94b0980]
at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [minecraft_server.jar:gi
t-Spigot-7754231-94b0980]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [minecraft_server.jar:
git-Spigot-7754231-94b0980]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
Caused by: java.lang.NullPointerException
Code:player.getOpenInventory().getTopInventory().getName();
Try that instead and add this:
Code:if (event.getClickedInventory != null)
else if (e.getSlot() == 13)
{
e.setCancelled(true);
player.openInventory(pickaxeinv(player));
player.sendMessage(player.getOpenInventory().getTopInventory().getName());
if (e.getClickedInventory() != null)
{
//do nothing
}
}
No, check for null hereCode:else if (e.getSlot() == 13) { e.setCancelled(true); player.openInventory(pickaxeinv(player)); player.sendMessage(player.getOpenInventory().getTopInventory().getName()); if (e.getClickedInventory() != null) { //do nothing } }
Same error
((e.getSlot() >= 0) &&
(e.getInventory().getTitle().equals(ChatColor.translateAlternateColorCodes('&',name))))
if(event.getSlotType() == SlotType.OUTSIDE) return;
They're clicking on an item thats in it - pickaxeIt this is happening when someone clicks outside of the actual inventory you can add this:
[DOUBLEPOST=1533518706][/DOUBLEPOST]Code:if(event.getSlotType() == SlotType.OUTSIDE) return;
Also you don't need so many if statements. You only need simple if-else statement and that's it.
same error :/No, check for null here
Code:((e.getSlot() >= 0) && (e.getInventory().getTitle().equals(ChatColor.translateAlternateColorCodes('&',name))))
That is what's probably returning null as the error doesn't show the line.
yeah i added the bukkit runnable.Don't make inventories that way.
Hey, trying to open up the pickaxeinv inventory but its throwing out errors, and the stacktrace ends.. doesn't help :/ Anyone able to help me figure out what the issue is?
Class:
Stacktrace:
if (e.getClickedInventory() == null) return; if (e.getClickedInventory().getName().equalsIgnoreCase(name)) { // if (item == null) return; if (!item.hasItemMeta()) return; }
ah, good eye. I'll fix that nowJust check through clicked Inventories and the item. If what they are clicking is returning the value null, it'll return and wont give you any NPE(s)[DOUBLEPOST=1533520832][/DOUBLEPOST]Why are you also opening inventory in the inventory builder and then using the openInventory code again when command is executed?Code:if (e.getClickedInventory() == null) return; if (e.getClickedInventory().getName().equalsIgnoreCase(name)) { // if (item == null) return; if (!item.hasItemMeta()) return; }
