From 1aa56869c272c2139398a446fa78abe6d80ceefd Mon Sep 17 00:00:00 2001 From: Zrips Date: Wed, 11 Jan 2017 15:29:38 +0200 Subject: [PATCH] Check for correct job when pressing in GUI to join --- com/gamingmesh/jobs/listeners/JobsListener.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/com/gamingmesh/jobs/listeners/JobsListener.java b/com/gamingmesh/jobs/listeners/JobsListener.java index afc38a39..62dcd753 100644 --- a/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/com/gamingmesh/jobs/listeners/JobsListener.java @@ -152,8 +152,9 @@ public class JobsListener implements Listener { } } else if (!Jobs.getGCManager().JobsGUISwitcheButtons && event.getClick() == ClickType.RIGHT || Jobs.getGCManager().JobsGUISwitcheButtons && event.getClick() == ClickType.LEFT) { - if (!joblist.isJobInfo() && slot < joblist.getJobList().size()) { - Bukkit.dispatchCommand(player, "jobs join " + joblist.getJobList().get(slot).getName()); + Job job = Jobs.getGUIManager().getJobBySlot(player, slot); + if (job != null) { + Bukkit.dispatchCommand(player, "jobs join " + job.getName()); player.getOpenInventory().getTopInventory().setContents(Jobs.getGUIManager().CreateJobsGUI(player).getContents()); } }