mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-27 12:46:09 +01:00
Add factionless sidebar.
This commit is contained in:
parent
8926d0b434
commit
76e6fd2765
@ -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()) {
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user