1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-30 21:07:48 +01:00

Check for correct job when pressing in GUI to join

This commit is contained in:
Zrips 2017-01-11 15:29:38 +02:00
parent 6cb0beba8f
commit 1aa56869c2

View File

@ -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());
}
}