diff --git a/src/main/java/com/gamingmesh/jobs/Gui/GuiItem.java b/src/main/java/com/gamingmesh/jobs/Gui/GuiItem.java index 7de7be26..81652ef2 100644 --- a/src/main/java/com/gamingmesh/jobs/Gui/GuiItem.java +++ b/src/main/java/com/gamingmesh/jobs/Gui/GuiItem.java @@ -7,7 +7,7 @@ import net.Zrips.CMILib.Container.CMINumber; public class GuiItem { private ItemStack guiItem = null; - private int guiSlot = 0; + private int guiSlot = -1; public ItemStack getGuiItem() { return guiItem; @@ -23,7 +23,7 @@ public class GuiItem { } public GuiItem setGuiSlot(int guiSlot) { - this.guiSlot = CMINumber.clamp(guiSlot, 0, 54); + this.guiSlot = CMINumber.clamp(guiSlot, -1, 54); return this; } diff --git a/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java b/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java index 8e52c80b..cfb1e985 100644 --- a/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java +++ b/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java @@ -168,16 +168,7 @@ public class GuiManager { lore.add(Jobs.getLanguage().getMessage("command.info.gui.rightClick")); } - ItemStack guiItem = job.getGuiItem(); -// ItemMeta meta = guiItem.getItemMeta(); -// meta.setDisplayName(job.getDisplayName()); -// meta.setLore(lore); -// -// if (Jobs.getGCManager().hideItemAttributes) { -// meta.addItemFlags(org.bukkit.inventory.ItemFlag.HIDE_ATTRIBUTES, org.bukkit.inventory.ItemFlag.HIDE_ENCHANTS); -// } -// -// guiItem.setItemMeta(meta); + ItemStack guiItem = job.getGuiItem().clone(); CMIGuiButton button = new CMIGuiButton(job.getGuiSlot() >= 0 ? job.getGuiSlot() : pos, guiItem) { @@ -222,6 +213,7 @@ public class GuiManager { }; button.setName(job.getDisplayName()); + button.clearLore(); button.addLore(lore); if (Jobs.getGCManager().hideItemAttributes) { button.hideItemFlags(); @@ -277,7 +269,7 @@ public class GuiManager { JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, job); JobProgression prog = jPlayer.getJobProgression(job); - ItemStack guiItem = job.getGuiItem(); + ItemStack guiItem = job.getGuiItem().clone(); int level = prog != null ? prog.getLevel() : 1; int numjobs = jPlayer.progression.size(); @@ -499,7 +491,7 @@ public class GuiManager { int numjobs = jPlayer.progression.size(); int level = jPlayer.getJobProgression(job) != null ? jPlayer.getJobProgression(job).getLevel() : 1; - ItemStack guiItem = job.getGuiItem(); + ItemStack guiItem = job.getGuiItem().clone(); int i = 0; for (ActionType actionType : jobsRemained) { List info = job.getJobInfo(actionType); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/browse.java b/src/main/java/com/gamingmesh/jobs/commands/list/browse.java index 2e245ce5..42be65d1 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/browse.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/browse.java @@ -34,7 +34,9 @@ public class browse implements Cmd { try { plugin.getGUIManager().openJobsBrowseGUI((Player) sender); } catch (Throwable e) { + ((Player) sender).closeInventory(); + e.printStackTrace(); } return true; diff --git a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java index f4b18394..83dcfa98 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java @@ -64,6 +64,7 @@ import net.Zrips.CMILib.FileHandler.ConfigReader; import net.Zrips.CMILib.Items.CMIAsyncHead; import net.Zrips.CMILib.Items.CMIItemStack; import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Version.Version; @@ -1245,10 +1246,11 @@ public class ConfigManager { if (!customSkull.isEmpty()) { guiItem = Util.getSkull(customSkull); } - gItem.setGuiSlot(guiSection.getInt("slot", -1)); } + gItem.setGuiItem(guiItem); + job.setGuiItem(gItem); // Permissions diff --git a/src/main/java/com/gamingmesh/jobs/container/Job.java b/src/main/java/com/gamingmesh/jobs/container/Job.java index fbb3c03e..5331c26b 100644 --- a/src/main/java/com/gamingmesh/jobs/container/Job.java +++ b/src/main/java/com/gamingmesh/jobs/container/Job.java @@ -287,7 +287,7 @@ public class Job { } public int getGuiSlot() { - return guiItem == null ? 0 : guiItem.getGuiSlot(); + return guiItem == null ? -1 : guiItem.getGuiSlot(); } /**