Add factionless sidebar.

This commit is contained in:
drtshock 2015-08-06 16:34:01 -05:00
parent 8926d0b434
commit 76e6fd2765
2 changed files with 21 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.P;
import com.massivecraft.factions.scoreboards.FSidebarProvider;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
@ -11,12 +12,25 @@ public class FDefaultSidebar extends FSidebarProvider {
@Override
public String getTitle(FPlayer fplayer) {
return replaceTags(fplayer, P.p.getConfig().getString("scoreboard.default-title", "i love drt"));
return replaceTags(fplayer, P.p.getConfig().getString("scoreboard.default-title", "{name}"));
}
@Override
public List<String> getLines(FPlayer fplayer) {
List<String> lines = P.p.getConfig().getStringList("scoreboard.default");
if (fplayer.hasFaction()) {
return getOutput(fplayer, "scoreboard.default");
} else if (P.p.getConfig().getBoolean("scoreboard.factionless-enabled", false)) {
return getOutput(fplayer, "scoreboard.factionless");
}
return getOutput(fplayer, "scoreboard.default"); // no faction, factionless-board disabled
}
public List<String> getOutput(FPlayer fplayer, String list) {
List<String> lines = P.p.getConfig().getStringList(list);
if (lines == null || lines.isEmpty()) {
return new ArrayList<String>();
}
ListIterator<String> it = lines.listIterator();
while (it.hasNext()) {

View File

@ -144,6 +144,11 @@ scoreboard:
- "&aBalance"
- "${balance}"
factionless-enabled: false
factionless:
- "Make a new Faction"
- "Use /f create"
# Configration section for warmups.
# Warmup times are in seconds - if a value of 0 is set, there is no warmup.
warmups: