Add config toggle for Info scoreboard.

This commit is contained in:
drtshock 2014-09-01 14:56:32 -05:00
parent 09d6102798
commit b444b25bc1
2 changed files with 11 additions and 1 deletions

View File

@ -538,7 +538,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator {
public void sendFactionHereMessage() {
Faction toShow = Board.getFactionAt(getLastStoodAt());
if (!toShow.isWarZone() && !toShow.isNone() && !toShow.isSafeZone() && P.p.getConfig().contains("scoreboard.finfo") && P.p.cmdBase.cmdSB.showBoard(this)) {
if (shouldShowScoreboard(toShow)) {
// Shows them the scoreboard instead of sending a message in chat. Will disappear after a few seconds.
new FInfoBoard(getPlayer(), toShow, true);
} else {
@ -551,6 +551,15 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator {
}
}
/**
* Check if the scoreboard should be shown. Simple method to be used by above method.
* @param toShow Faction to be shown.
* @return true if should show, otherwise false.
*/
private boolean shouldShowScoreboard(Faction toShow) {
return !toShow.isWarZone() && !toShow.isNone() && !toShow.isSafeZone() && P.p.getConfig().contains("scoreboard.finfo") && P.p.getConfig().getBoolean("scoreboard.finfo-enabled", false) && P.p.cmdBase.cmdSB.showBoard(this);
}
// -------------------------------
// Actions
// -------------------------------

View File

@ -27,6 +27,7 @@ scoreboard:
# {online} - online members. {leader} - faction's leader. {open} - shows either true or false if open.
# The title of the scoreboard will be the Faction's tag and colored according to the relation with the player's Faction.
# Commenting this section out will cause the info to appear in chat as the plugin originally did.
finfo-enabled: false # Default to false to keep original functionality.
finfo:
- "&6Power"
- "{power}"