1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-20 23:21:19 +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 void openJobsBrowseGUI(Player player) {
public void openJobsBrowseGUI(final Player player) {
ArrayList<Job> 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;

View File

@ -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");

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.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");