A problem polega na tym. Że gdy komendą /drop otworzę gui od dropu (1 gui) i wybiorę (kliknę) w ikonę od topek topka się otwiera, ale gdy chcę znów otworzyć gui od topek jest error:
Spoiler
An internal error occured while attempting to perform this command
Próbowałem na różne sposoby to naprawić ale zawsze gdy drugi raz chcę otworzyć gui jest error. (Możliwość otworzenia gui odblokowywuje się po reloadzie).
Logi:
Spoiler
[17:04:54] [Server thread/INFO]: K0dX issued server command: /drop
[17:04:54] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'drop' in plugin KP-Drop v1.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1162) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-db6de12-18fbb24]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_121]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_121]
at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot.jar:git-Spigot-db6de12-18fbb24]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
Caused by: java.lang.NullPointerException
at me.k0dx.kdrop.objects.User.get(User.java:120) ~[?:?]
at me.k0dx.kdrop.commands.DropCommand.onCommand(DropCommand.java:80) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
... 15 more
Jeżeli ktoś potrafi mi pomóc to miło by było (Kod na topki zaczerpnięty od @Inder00)
Pytanie
KodziaK 30
Witam. Otóż mam takie GUI:
inv = Bukkit.createInventory(null, 54, ChatUtils.repairColor("&6Informacje o dropach"));{
for(int slot = 0; slot < 54; slot++){
inv.setItem(slot, blank);
}
ItemStack cobble = new ItemStack(Material.COBBLESTONE, 1);{
ItemMeta im = cobble.getItemMeta();
im.setDisplayName(ChatUtils.repairColor("&8☆ &e&lCOBBLESTONE &8☆"));
ArrayList<String> lore = new ArrayList<String>();
lore.add(ChatUtils.repairColor(" &8» &7Status: " + (u.getCobblestone() ? "&a✔" : "&c✖")));;
im.setLore(lore);
cobble.setItemMeta(im);
}
ItemStack turbodrop = new ItemStack(Material.BOOK, 1);{
ItemMeta im = turbodrop.getItemMeta();
im.setDisplayName(ChatUtils.repairColor("&8☆ &e&lTURBODROP &8☆"));
ArrayList<String> lore = new ArrayList<String>();
lore.add(ChatUtils.repairColor(" &8» &6SERWER: " + (Main.turbodrop < System.currentTimeMillis() ? "&c✖" : "&a" + DateUtils.secondsToString((int)(Main.turbodrop - System.currentTimeMillis()) / 1000))));
lore.add(ChatUtils.repairColor(" &8» &6TY: " + (u.getTurboDrop() < System.currentTimeMillis() ? "&c✖" : "&a" + DateUtils.secondsToString((int)(u.getTurboDrop() - System.currentTimeMillis()) / 1000))));
im.setLore(lore);
turbodrop.setItemMeta(im);
}
ItemStack turboexp = new ItemStack(Material.BOOK, 1);{
ItemMeta im = turboexp.getItemMeta();
im.setDisplayName(ChatUtils.repairColor("&8☆ &e&lTURBOEXP &8☆"));
ArrayList<String> lore = new ArrayList<String>();
lore.add(ChatUtils.repairColor(" &8» &6SERWER: " + (Main.turboexp < System.currentTimeMillis() ? "&c✖" : "&a" + DateUtils.secondsToString((int)(Main.turboexp - System.currentTimeMillis()) / 1000))));
lore.add(ChatUtils.repairColor(" &8» &6TY: " + (u.getTurboExp() < System.currentTimeMillis() ? "&c✖" : "&a" + DateUtils.secondsToString((int)(u.getTurboExp() - System.currentTimeMillis()) / 1000))));
im.setLore(lore);
turboexp.setItemMeta(im);
}
ItemStack exp = new ItemStack(Material.EXP_BOTTLE, 1);{
ItemMeta im = exp.getItemMeta();
im.setDisplayName(ChatUtils.repairColor("&8☆ &e&lEXP &8☆"));
ArrayList<String> lore = new ArrayList<String>();
lore.add(ChatUtils.repairColor(" &8» &7Stone: &e" + Main.getInst().getConfig().getInt("config.exp.stone")));
lore.add(ChatUtils.repairColor(" &8» &7Obsydian: &e" + Main.getInst().getConfig().getInt("config.exp.obsydian")));
im.setLore(lore);
exp.setItemMeta(im);
}
inv.setItem(10, top);
inv.setItem(13, stone);
inv.setItem(16, cobble);
inv.setItem(21, skeleton);
inv.setItem(22, zombie);
inv.setItem(23, creeper);
inv.setItem(37, turbodrop);
inv.setItem(43, turboexp);
inv.setItem(49, exp);
}
I część kodu z eventu InventoryClickEvent.
if(e.getCurrentItem().getItemMeta().equals(DropCommand.top.getItemMeta())){
tops = Bukkit.createInventory(null, 9, ChatUtils.repairColor("&6Top poziomu kopania!"));
List<User> users = User.players;
Collections.sort(users, new DropComparator<User>());
for(int i=1; i<=9; i++){
if(i <= users.size()){
User us = users.get(users.size()-i);
if(us.getName() != null){
ItemStack head = new ItemStack(Material.SKULL_ITEM, i, (short)3);
SkullMeta skullmeta = (SkullMeta) head.getItemMeta();
skullmeta.setOwner(u.getName());
skullmeta.setDisplayName(ChatUtils.repairColor("&c" + i + ". &e" + us.getName()));
List<String> lore = new ArrayList<String>();
lore.add(" ");
lore.add(ChatUtils.repairColor("&7Level: &e" + us.getLevel()));
lore.add(ChatUtils.repairColor("&7Punkty: &e" + us.getPoints() + "/" + Main.getInst().getConfig().getInt("config.points-need-to-levelup")));
skullmeta.setLore(lore);
head.setItemMeta(skullmeta);
tops.setItem(i-1, head);
}else{
ItemStack head = new ItemStack(Material.SKULL_ITEM, i, (short)3);
SkullMeta skullmeta = (SkullMeta) head.getItemMeta();
skullmeta.setOwner("Steve");
skullmeta.setDisplayName(ChatUtils.repairColor("&c" + i + ". &e----"));
List<String> lore = new ArrayList<String>();
lore.add(" ");
lore.add(ChatUtils.repairColor("&7Level: &e----"));
lore.add(ChatUtils.repairColor("&7Punkty: &e----"));
skullmeta.setLore(lore);
head.setItemMeta(skullmeta);
tops.setItem(i-1, head);
}
} else {
ItemStack head = new ItemStack(Material.SKULL_ITEM, i, (short)3);
SkullMeta skullmeta = (SkullMeta) head.getItemMeta();
skullmeta.setOwner("Steve");
skullmeta.setDisplayName(ChatUtils.repairColor("&c" + i + ". &e----"));
List<String> lore = new ArrayList<String>();
lore.add(" ");
lore.add(ChatUtils.repairColor("&7Level: &e----"));
lore.add(ChatUtils.repairColor("&7Punkty: &e----"));
skullmeta.setLore(lore);
head.setItemMeta(skullmeta);
tops.setItem(i-1, head);
}
}
e.setCancelled(true);
p.closeInventory();
p.openInventory(tops);
return;
}
A problem polega na tym. Że gdy komendą /drop otworzę gui od dropu (1 gui) i wybiorę (kliknę) w ikonę od topek topka się otwiera, ale gdy chcę znów otworzyć gui od topek jest error:
An internal error occured while attempting to perform this command
Próbowałem na różne sposoby to naprawić ale zawsze gdy drugi raz chcę otworzyć gui jest error. (Możliwość otworzenia gui odblokowywuje się po reloadzie).
Logi:
[17:04:54] [Server thread/INFO]: K0dX issued server command: /drop
[17:04:54] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'drop' in plugin KP-Drop v1.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1162) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-db6de12-18fbb24]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_121]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_121]
at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot.jar:git-Spigot-db6de12-18fbb24]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
Caused by: java.lang.NullPointerException
at me.k0dx.kdrop.objects.User.get(User.java:120) ~[?:?]
at me.k0dx.kdrop.commands.DropCommand.onCommand(DropCommand.java:80) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
... 15 more
Jeżeli ktoś potrafi mi pomóc to miło by było
(Kod na topki zaczerpnięty od @Inder00)
Odnośnik do komentarza
https://skript.pl/temat/21880-komenda-si%C4%99-psuje-po-otworzeniu-innego-gui/Udostępnij na innych stronach
14 odpowiedzi na to pytanie
Rekomendowane odpowiedzi