From b444b25bc1edb6e5d93d53148a2646f9eb39256d Mon Sep 17 00:00:00 2001 From: drtshock Date: Mon, 1 Sep 2014 14:56:32 -0500 Subject: [PATCH] Add config toggle for Info scoreboard. --- src/main/java/com/massivecraft/factions/FPlayer.java | 11 ++++++++++- src/main/resources/config.yml | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/massivecraft/factions/FPlayer.java b/src/main/java/com/massivecraft/factions/FPlayer.java index 54afa5ee..5a360c27 100644 --- a/src/main/java/com/massivecraft/factions/FPlayer.java +++ b/src/main/java/com/massivecraft/factions/FPlayer.java @@ -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 // ------------------------------- diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index dfd8201b..a08bb75a 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -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}"