1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-02-01 13:01:29 +01:00

Added option to disable joining to job through gui

This commit is contained in:
montlikadani 2020-02-06 18:48:20 +01:00
parent 118b6d8459
commit 079b0db08d
3 changed files with 16 additions and 4 deletions

View File

@ -27,7 +27,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
public class GuiManager { public class GuiManager {
public void openJobsBrowseGUI(Player player) { public void openJobsBrowseGUI(final Player player) {
ArrayList<Job> JobsList = new ArrayList<>(); ArrayList<Job> JobsList = new ArrayList<>();
for (Job job : Jobs.getJobs()) { for (Job job : Jobs.getJobs()) {
if (Jobs.getGCManager().getHideJobsWithoutPermission()) if (Jobs.getGCManager().getHideJobsWithoutPermission())
@ -137,7 +137,11 @@ public class GuiManager {
case Left: case Left:
case LeftShift: case LeftShift:
if (Jobs.getGCManager().JobsGUISwitcheButtons) { 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); openJobsBrowseGUI(player);
} else { } else {
openJobsBrowseGUI(player, job); openJobsBrowseGUI(player, job);
@ -152,7 +156,11 @@ public class GuiManager {
if (Jobs.getGCManager().JobsGUISwitcheButtons) { if (Jobs.getGCManager().JobsGUISwitcheButtons) {
openJobsBrowseGUI(player, job); openJobsBrowseGUI(player, job);
} else { } 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); openJobsBrowseGUI(player);
} }
break; break;

View File

@ -107,7 +107,8 @@ public class GeneralConfigManager {
public boolean fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat, public boolean fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat, LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat,
EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment, EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, UseInversedClickToLeave, ShowActionNames; JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, UseInversedClickToLeave, ShowActionNames,
DisableJoiningJobThroughGui;
public boolean FireworkLevelupUse, UseRandom, UseFlicker, UseTrail; public boolean FireworkLevelupUse, UseRandom, UseFlicker, UseTrail;
public String FireworkType; 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.", "This option click type depend from SwitcheButtons option, if true using the left button and inversely.",
"Don't forget to adjust locale file"); "Don't forget to adjust locale file");
UseInversedClickToLeave = c.get("JobsGUI.UseInversedClickToLeave", false); 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?"); c.addComment("JobsGUI.ShowActionNames", "Do you want to show the action names in GUI?");
ShowActionNames = c.get("JobsGUI.ShowActionNames", true); ShowActionNames = c.get("JobsGUI.ShowActionNames", true);
c.addComment("JobsGUI.Rows", "Defines size in rows of GUI"); c.addComment("JobsGUI.Rows", "Defines size in rows of GUI");

View File

@ -349,6 +349,7 @@ public class LanguageManager {
c.get("command.info.gui.rightClick", "&eRight Click to join job"); 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.leftSlots", "&eLeft slots:&f ");
c.get("command.info.gui.working", "&2&nAlready working"); 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.max", "&eMax level:&f ");
c.get("command.info.gui.back", "&e<<< Back"); c.get("command.info.gui.back", "&e<<< Back");