1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 12:05:16 +01:00

Added option to leave from job in jobs GUI

This commit is contained in:
montlikadani 2019-09-20 16:20:43 +02:00
parent 5d856f0fbc
commit 1513e32afc
4 changed files with 16 additions and 5 deletions

View File

@ -17,3 +17,6 @@
- Fix bone meals dupping issue when interacted with seeds
- Should fixed issue when the JobsPrePaymentEvent getJob method always returns null
- Fixed income dupping issue and repair action not work correctly.
- Updated translations to the latest
- Jobs toggles will not be saved from now instantly when get income
- Added option to leave from job in jobs GUI.

View File

@ -124,7 +124,7 @@
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.10.3</version>
<version>2.10.4</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -105,7 +105,7 @@ public class GeneralConfigManager {
public boolean fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat,
EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, ShowActionNames;
JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, UseInversedClickToLeave, ShowActionNames;
public boolean FireworkLevelupUse, UseRandom, UseFlicker, UseTrail;
public String FireworkType;
@ -969,9 +969,13 @@ public class GeneralConfigManager {
JobsGUIOpenOnBrowse = c.get("JobsGUI.OpenOnBrowse", true);
c.addComment("JobsGUI.ShowChatBrowse", "Do you want to show chat information when performing /jobs browse command?");
JobsGUIShowChatBrowse = c.get("JobsGUI.ShowChatBrowse", true);
c.addComment("JobsGUI.SwitcheButtons", "With true left mouse button will join job and right will show more info",
"With false left mouse button will show more info, right will join job", "Don't forget to adjust locale file");
c.addComment("JobsGUI.SwitcheButtons", "With true left mouse button will join job and right will show more info.",
"With false left mouse button will show more info, right will join job or inversely.", "Don't forget to adjust locale file!");
JobsGUISwitcheButtons = c.get("JobsGUI.SwitcheButtons", false);
c.addComment("JobsGUI.UseInversedClickToLeave", "Do you want to use the left/right click button to leave from job?",
"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.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

@ -265,7 +265,11 @@ public class JobsListener implements Listener {
Jobs.getGCManager().JobsGUISwitcheButtons && event.getClick() == ClickType.LEFT) {
Job job = Jobs.getGUIManager().getJobBySlot(player, slot);
if (job != null) {
Bukkit.dispatchCommand(player, "jobs join " + job.getName());
if (Jobs.getGCManager().UseInversedClickToLeave && Jobs.getPlayerManager().getJobsPlayer(player).isInJob(job)) {
Bukkit.dispatchCommand(player, "jobs leave " + job.getName());
} else {
Bukkit.dispatchCommand(player, "jobs join " + job.getName());
}
player.getOpenInventory().getTopInventory().setContents(Jobs.getGUIManager().CreateJobsGUI(player).getContents());
}
}