Add per-arena setting to enable/disable scoreboards.

This commit is contained in:
garbagemule 2013-06-27 00:05:14 +02:00
parent 97c54855d4
commit 65c5ea05b3
3 changed files with 14 additions and 1 deletions

View File

@ -37,3 +37,4 @@ auto-ready: false
use-class-chests: false
display-waves-as-level: false
display-timer-as-level: false
use-scoreboards: true

View File

@ -45,6 +45,7 @@ import com.garbagemule.MobArena.util.config.ConfigSection;
import com.garbagemule.MobArena.util.inventory.InventoryManager;
import com.garbagemule.MobArena.util.inventory.InventoryUtils;
import com.garbagemule.MobArena.waves.*;
import com.garbagemule.MobArena.ScoreboardManager.NullScoreboardManager;
public class ArenaImpl implements Arena
{
@ -170,7 +171,7 @@ public class ArenaImpl implements Arena
this.timeStrategy = (time != null ? new TimeStrategyLocked(time) : new TimeStrategyNull());
// Scoreboards
this.scoreboard = new ScoreboardManager(this);
this.scoreboard = (settings.getBoolean("use-scoreboards", true) ? new ScoreboardManager(this) : new NullScoreboardManager(this));
}

View File

@ -92,4 +92,15 @@ public class ScoreboardManager {
kills.setDisplaySlot(DisplaySlot.SIDEBAR);
updateWave(0);
}
static class NullScoreboardManager extends ScoreboardManager {
NullScoreboardManager(Arena arena) {
super(arena);
}
void addPlayer(Player player) {}
void removePlayer(Player player) {}
void addKill(Player player) {}
void updateWave(int wave) {}
void initialize() {}
}
}