diff --git a/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java b/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java index e26cc86f..e062c254 100644 --- a/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java +++ b/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java @@ -27,7 +27,7 @@ import com.gamingmesh.jobs.container.JobsPlayer; public class GuiManager { - public void openJobsBrowseGUI(Player player) { + public void openJobsBrowseGUI(final Player player) { ArrayList JobsList = new ArrayList<>(); for (Job job : Jobs.getJobs()) { if (Jobs.getGCManager().getHideJobsWithoutPermission()) @@ -137,7 +137,11 @@ public class GuiManager { case Left: case LeftShift: if (Jobs.getGCManager().JobsGUISwitcheButtons) { - Jobs.getCommandManager().onCommand(player, null, "jobs", new String[] { "join", job.getName() }); + if (!Jobs.getGCManager().DisableJoiningJobThroughGui) { + Jobs.getCommandManager().onCommand(player, null, "jobs", new String[] { "join", job.getName() }); + } else { + player.sendMessage(Jobs.getLanguage().getMessage("command.info.gui.cantJoin")); + } openJobsBrowseGUI(player); } else { openJobsBrowseGUI(player, job); @@ -152,7 +156,11 @@ public class GuiManager { if (Jobs.getGCManager().JobsGUISwitcheButtons) { openJobsBrowseGUI(player, job); } else { - Jobs.getCommandManager().onCommand(player, null, "jobs", new String[] { "join", job.getName() }); + if (!Jobs.getGCManager().DisableJoiningJobThroughGui) { + Jobs.getCommandManager().onCommand(player, null, "jobs", new String[] { "join", job.getName() }); + } else { + player.sendMessage(Jobs.getLanguage().getMessage("command.info.gui.cantJoin")); + } openJobsBrowseGUI(player); } break; diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index c9122112..cc28eb4c 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -107,7 +107,8 @@ public class GeneralConfigManager { public boolean fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat, LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat, EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment, - JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, UseInversedClickToLeave, ShowActionNames; + JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, UseInversedClickToLeave, ShowActionNames, + DisableJoiningJobThroughGui; public boolean FireworkLevelupUse, UseRandom, UseFlicker, UseTrail; public String FireworkType; @@ -997,6 +998,8 @@ public class GeneralConfigManager { "This option click type depend from SwitcheButtons option, if true using the left button and inversely.", "Don't forget to adjust locale file"); UseInversedClickToLeave = c.get("JobsGUI.UseInversedClickToLeave", false); + c.addComment("JobsGUI.DisableJoiningJobThroughGui", "Allows players to join a specified job via GUI."); + DisableJoiningJobThroughGui = c.get("JobsGUI.DisableJoiningJobThroughGui", false); c.addComment("JobsGUI.ShowActionNames", "Do you want to show the action names in GUI?"); ShowActionNames = c.get("JobsGUI.ShowActionNames", true); c.addComment("JobsGUI.Rows", "Defines size in rows of GUI"); diff --git a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java index 2ceabda4..c6c9280d 100644 --- a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java @@ -349,6 +349,7 @@ public class LanguageManager { c.get("command.info.gui.rightClick", "&eRight Click to join job"); c.get("command.info.gui.leftSlots", "&eLeft slots:&f "); c.get("command.info.gui.working", "&2&nAlready working"); + c.get("command.info.gui.cantJoin", "&cYou can't join to the selected job."); c.get("command.info.gui.max", "&eMax level:&f "); c.get("command.info.gui.back", "&e<<< Back");