From f828084246567eb6536234ad4dc37369327d6dd5 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 11 Jan 2019 01:47:36 -0800 Subject: [PATCH] Added config option to easily disable all scoreboards --- Changelog.txt | 1 + src/main/java/com/gmail/nossr50/config/Config.java | 13 +++++++------ .../gmail/nossr50/database/SQLDatabaseManager.java | 3 ++- src/main/resources/config.yml | 3 +++ 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index da695fb17..bd5447a62 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -19,6 +19,7 @@ Version 2.1.0 + (Config) Added rank settings for the new Woodcutting skill + (Config) Added configurable parameters for the new Tree Feller + (Config) Added classic toggle for Tree Feller + + (Config) Added toggle to disable all scoreboards + (Chat) Added ability for admins to spy on party chat (off unless toggled on) + (Commands) Added new info command /mmoinfo or /mcinfo + (Commands) Added toggle command /mcchatspy diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 7e4341eed..e8b35cbd5 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -293,6 +293,7 @@ public class Config extends AutoUpdateConfigLoader { public int getMobHealthbarTime() { return config.getInt("Mob_Healthbar.Display_Time", 3); } /* Scoreboards */ + public boolean getScoreboardsEnabled() { return config.getBoolean("Scoreboard.Enabled", true); } public boolean getPowerLevelTagsEnabled() { return config.getBoolean("Scoreboard.Power_Level_Tags", false); } public boolean getAllowKeepBoard() { return config.getBoolean("Scoreboard.Allow_Keep", true); } public int getTipsAmount() { return config.getInt("Scoreboard.Tips_Amount", 5); } @@ -301,28 +302,28 @@ public class Config extends AutoUpdateConfigLoader { public boolean getShowAbilityNames() { return config.getBoolean("Scoreboard.Ability_Names", true); } public boolean getRankUseChat() { return config.getBoolean("Scoreboard.Types.Rank.Print", false); } - public boolean getRankUseBoard() { return config.getBoolean("Scoreboard.Types.Rank.Board", true); } + public boolean getRankUseBoard() { return getScoreboardsEnabled() && config.getBoolean("Scoreboard.Types.Rank.Board", true); } public int getRankScoreboardTime() { return config.getInt("Scoreboard.Types.Rank.Display_Time", 10); } public boolean getTopUseChat() { return config.getBoolean("Scoreboard.Types.Top.Print", true); } - public boolean getTopUseBoard() { return config.getBoolean("Scoreboard.Types.Top.Board", true); } + public boolean getTopUseBoard() { return getScoreboardsEnabled() && config.getBoolean("Scoreboard.Types.Top.Board", true); } public int getTopScoreboardTime() { return config.getInt("Scoreboard.Types.Top.Display_Time", 15); } public boolean getStatsUseChat() { return config.getBoolean("Scoreboard.Types.Stats.Print", true); } - public boolean getStatsUseBoard() { return config.getBoolean("Scoreboard.Types.Stats.Board", true); } + public boolean getStatsUseBoard() { return getScoreboardsEnabled() && config.getBoolean("Scoreboard.Types.Stats.Board", true); } public int getStatsScoreboardTime() { return config.getInt("Scoreboard.Types.Stats.Display_Time", 10); } public boolean getInspectUseChat() { return config.getBoolean("Scoreboard.Types.Inspect.Print", true); } - public boolean getInspectUseBoard() { return config.getBoolean("Scoreboard.Types.Inspect.Board", true); } + public boolean getInspectUseBoard() { return getScoreboardsEnabled() && config.getBoolean("Scoreboard.Types.Inspect.Board", true); } public int getInspectScoreboardTime() { return config.getInt("Scoreboard.Types.Inspect.Display_Time", 25); } public boolean getCooldownUseChat() { return config.getBoolean("Scoreboard.Types.Cooldown.Print", false); } - public boolean getCooldownUseBoard() { return config.getBoolean("Scoreboard.Types.Cooldown.Board", true); } + public boolean getCooldownUseBoard() { return getScoreboardsEnabled() && config.getBoolean("Scoreboard.Types.Cooldown.Board", true); } public int getCooldownScoreboardTime() { return config.getInt("Scoreboard.Types.Cooldown.Display_Time", 41); } public boolean getSkillUseBoard() { return config.getBoolean("Scoreboard.Types.Skill.Board", true); } public int getSkillScoreboardTime() { return config.getInt("Scoreboard.Types.Skill.Display_Time", 30); } - public boolean getSkillLevelUpBoard() { return config.getBoolean("Scoreboard.Types.Skill.LevelUp_Board", true); } + public boolean getSkillLevelUpBoard() { return getScoreboardsEnabled() && config.getBoolean("Scoreboard.Types.Skill.LevelUp_Board", true); } public int getSkillLevelUpTime() { return config.getInt("Scoreboard.Types.Skill.LevelUp_Time", 5); } /* Database Purging */ diff --git a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java index d38ba4558..32747b80e 100644 --- a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java @@ -33,7 +33,8 @@ public final class SQLDatabaseManager implements DatabaseManager { private ReentrantLock massUpdateLock = new ReentrantLock(); protected SQLDatabaseManager() { - String connectionString = "jdbc:mysql://" + Config.getInstance().getMySQLServerName() + ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName(); + String connectionString = "jdbc:mysql://" + Config.getInstance().getMySQLServerName() + + ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName(); try { // Force driver to load if not yet loaded diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index e35410c06..85c67133d 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -46,6 +46,8 @@ General: # Settings for the mcMMO scoreboards ### Scoreboard: + # Set this to true to enable scoreboards + Enable: true # Display player's power levels below their names? Power_Level_Tags: false @@ -161,6 +163,7 @@ MySQL: Load: 20 Save: 20 Server: + SSL: false Port: 3306 Address: localhost