From 4d05be6df96f5790d80aa223eae4c428c99ab278 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Thu, 14 Jan 2021 10:37:10 +0100 Subject: [PATCH] Added silent mode option to actionbars Closes #1059 --- .../jobs/config/GeneralConfigManager.java | 7 +++---- .../java/com/gamingmesh/jobs/dao/JobsSQLite.java | 8 ++------ .../gamingmesh/jobs/economy/BufferedEconomy.java | 13 ++----------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index 55483927..cdc38e48 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -95,7 +95,7 @@ public class GeneralConfigManager { applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useBreederFinder, CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat, LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat, - EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment, + EmptyServerAccountActionBar, ActionBarsMessageByDefault, aBarSilentMode, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment, JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, ShowActionNames, DisableJoiningJobThroughGui, FireworkLevelupUse, UseRandom, UseFlicker, UseTrail, UsePerPermissionForLeaving, EnableConfirmation, FilterHiddenPlayerFromTabComplete, jobsInfoOpensBrowse, MonsterDamageUse, useMaxPaymentCurve, @@ -834,6 +834,8 @@ public class GeneralConfigManager { c.addComment("ActionBars.Messages.EnabledByDefault", "When this set to true player will see action bar messages by default", "When false, players will see chat messages instead."); ActionBarsMessageByDefault = c.get("ActionBars.Messages.EnabledByDefault", true); + c.addComment("ActionBars.Messages.SilentMode", "If true, should we mute the payment messages from appearing in chat if actionbar is disabled?"); + aBarSilentMode = c.get("ActionBars.Messages.SilentMode", false); if (Version.isCurrentEqualOrHigher(Version.v1_9_R1)) { c.addComment("BossBar.Enabled", "Enables BossBar feature", "Works only from 1.9 mc version"); @@ -965,9 +967,6 @@ public class GeneralConfigManager { tmat = CMIMaterial.get(c.get("JobsGUI.Filler.Material", "GREEN_STAINED_GLASS_PANE").toUpperCase()); guiFiller = (tmat == null ? CMIMaterial.GREEN_STAINED_GLASS_PANE : tmat).newItemStack(); -// c.addComment("Schedule.Boost.Enable", "Do you want to enable scheduler for global boost?"); -// useGlobalBoostScheduler = c.get("Schedule.Boost.Enable", false); - c.save(); } diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsSQLite.java b/src/main/java/com/gamingmesh/jobs/dao/JobsSQLite.java index 49c6d9cd..39e50e93 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsSQLite.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsSQLite.java @@ -135,15 +135,13 @@ public class JobsSQLite extends JobsDAO { @Override public boolean truncate(String table) { Statement statement = null; - String query = null; try { if (!isTable(table)) { Jobs.consoleMsg("&cTable \"" + table + "\" does not exist."); return false; } statement = getConnection().createStatement(); - query = "DELETE FROM `" + table + "`;"; - statement.executeQuery(query); + statement.executeQuery("DELETE FROM `" + table + "`;"); return true; } catch (SQLException e) { if (!(e.getMessage().toLowerCase().contains("locking") || e.getMessage().toLowerCase().contains("locked")) && @@ -158,15 +156,13 @@ public class JobsSQLite extends JobsDAO { @Override public boolean drop(String table) { Statement statement = null; - String query = null; try { if (!isTable(table)) { Jobs.consoleMsg("&cTable \"" + table + "\" does not exist."); return false; } statement = getConnection().createStatement(); - query = "DROP TABLE IF EXISTS `" + table + "`;"; - statement.executeQuery(query); + statement.executeQuery("DROP TABLE IF EXISTS `" + table + "`;"); return true; } catch (SQLException e) { if (!(e.getMessage().toLowerCase().contains("locking") || e.getMessage().toLowerCase().contains("locked")) && diff --git a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java index 1e5c1c26..6be99c6d 100644 --- a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java +++ b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java @@ -64,16 +64,6 @@ public class BufferedEconomy { pay(new BufferedPayment(player.getPlayer(), payments)); } -// /** -// * Add payment to player's payment buffer -// * @param player - player to be paid -// * @param amount - amount to be paid -// */ -// @Deprecated -// public void pay(JobsPlayer player, double amount, double points, double exp) { -// pay(new BufferedPayment(player.getPlayer(), amount, points, exp)); -// } - /** * Add payment to player's payment buffer * @param payment - payment to be paid @@ -249,7 +239,8 @@ public class BufferedEconomy { * @param payment {@link BufferedPayment} */ public void showPayment(BufferedPayment payment) { - if (payment.getOfflinePlayer() == null || !payment.getOfflinePlayer().isOnline() || !payment.containsPayment()) + if (payment.getOfflinePlayer() == null || !payment.getOfflinePlayer().isOnline() || !payment.containsPayment() + || Jobs.getGCManager().aBarSilentMode) return; UUID playerUUID = payment.getOfflinePlayer().getUniqueId();