From 1513e32afcfe77fd70a1f5d3aa2672e46e4e112a Mon Sep 17 00:00:00 2001 From: montlikadani Date: Fri, 20 Sep 2019 16:20:43 +0200 Subject: [PATCH] Added option to leave from job in jobs GUI --- Changelog.txt | 3 +++ pom.xml | 2 +- .../gamingmesh/jobs/config/GeneralConfigManager.java | 10 +++++++--- .../com/gamingmesh/jobs/listeners/JobsListener.java | 6 +++++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index d6177030..9acbe6bb 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -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. diff --git a/pom.xml b/pom.xml index e4a80934..269064d5 100644 --- a/pom.xml +++ b/pom.xml @@ -124,7 +124,7 @@ me.clip placeholderapi - 2.10.3 + 2.10.4 provided diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index f1055b0e..e66bb3ca 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -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"); diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java index 6bc34810..ac1a41da 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java @@ -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()); } }