Added option to open /mcstats after logging in

Added #1033
This commit is contained in:
TfT_02 2014-04-06 13:27:30 +02:00
parent 79a1ef5d3e
commit 56e625a9df
5 changed files with 36 additions and 5 deletions

View File

@ -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

View File

@ -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); }

View File

@ -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);
}
}
/**

View File

@ -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());
}
}
}

View File

@ -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