diff --git a/Changelog.txt b/Changelog.txt index e56f2ad71..c67ded6a2 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -8,6 +8,7 @@ Key: - Removal Version 1.5.01-dev + + Added option to config.yml to show the /mcstats scoreboard automatically after logging in + Added support for `MATERIAL|data` format in treasures.yml = Fixed bug where the Updater was running on the main thread. = Fixed bug when players would use /ptp without being in a party diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index a52cf99cd..25662a72d 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -266,6 +266,11 @@ public class Config extends AutoUpdateConfigLoader { public int getMobHealthbarTime() { return config.getInt("Mob_Healthbar.Display_Time", 3); } /* Scoreboards */ + public boolean getPowerLevelTagsEnabled() { return config.getBoolean("Scoreboard.Power_Level_Tags", false); } + public boolean getAllowKeepBoard() { return config.getBoolean("Scoreboard.Allow_Keep", true); } + public boolean getShowStatsAfterLogin() { return config.getBoolean("Scoreboard.Show_Stats_After_Login", false); } + public boolean getScoreboardRainbows() { return config.getBoolean("Scoreboard.Rainbows", false); } + public boolean getRankUseChat() { return config.getBoolean("Scoreboard.Types.Rank.Print", false); } public boolean getRankUseBoard() { return config.getBoolean("Scoreboard.Types.Rank.Board", true); } public int getRankScoreboardTime() { return config.getInt("Scoreboard.Types.Rank.Display_Time", 10); } @@ -291,11 +296,6 @@ public class Config extends AutoUpdateConfigLoader { public boolean getSkillLevelUpBoard() { return config.getBoolean("Scoreboard.Types.Skill.LevelUp_Board", true); } public int getSkillLevelUpTime() { return config.getInt("Scoreboard.Types.Skill.LevelUp_Time", 5); } - public boolean getPowerLevelTagsEnabled() { return config.getBoolean("Scoreboard.Power_Level_Tags", false); } - - public boolean getAllowKeepBoard() { return config.getBoolean("Scoreboard.Allow_Keep", true); } - public boolean getScoreboardRainbows() { return config.getBoolean("Scoreboard.Rainbows", false); } - /* Database Purging */ public int getPurgeInterval() { return config.getInt("Database_Purging.Purge_Interval", -1); } public int getOldUsersCutoff() { return config.getInt("Database_Purging.Old_User_Cutoff", 6); } diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index fa03c0ecb..acf958d08 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -42,6 +42,7 @@ import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.party.ShareHandler; +import com.gmail.nossr50.runnables.commands.McScoreboardKeepTask; import com.gmail.nossr50.runnables.skills.BleedTimerTask; import com.gmail.nossr50.skills.fishing.FishingManager; import com.gmail.nossr50.skills.herbalism.HerbalismManager; @@ -399,6 +400,11 @@ public class PlayerListener implements Listener { player.sendMessage(LocaleLoader.getString("UpdateChecker.Outdated")); player.sendMessage(LocaleLoader.getString("UpdateChecker.NewAvailable")); } + + if (Config.getInstance().getShowStatsAfterLogin()) { + ScoreboardManager.enablePlayerStatsScoreboard(player); + new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, 1 * Misc.TICK_CONVERSION_FACTOR); + } } /** diff --git a/src/main/java/com/gmail/nossr50/runnables/commands/McScoreboardKeepTask.java b/src/main/java/com/gmail/nossr50/runnables/commands/McScoreboardKeepTask.java new file mode 100644 index 000000000..a296fd349 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/runnables/commands/McScoreboardKeepTask.java @@ -0,0 +1,21 @@ +package com.gmail.nossr50.runnables.commands; + +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +import com.gmail.nossr50.util.scoreboards.ScoreboardManager; + +public class McScoreboardKeepTask extends BukkitRunnable { + private Player player; + + public McScoreboardKeepTask(Player player) { + this.player = player; + } + + @Override + public void run() { + if (player.isValid() && ScoreboardManager.isBoardShown(player.getName())) { + ScoreboardManager.keepBoard(player.getName()); + } + } +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 6216c5bfa..271356ff9 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -37,6 +37,9 @@ Scoreboard: # Allow players to use "/mcscoreboard keep" to keep the scoreboard up Allow_Keep: true + # Show the /mcstats scoreboard automatically after logging in + Show_Stats_After_Login: false + # Add some more color on the board :-) Rainbows: false