use of me.tigerhix.lib.scoreboard.type.ScoreboardHandler in project LandLord by SpatiumPrinceps.
the class LandMap method displayMap.
/**
* core method for actually displaying the Map
*
* @param p the player, who asked for a map
* @return a reference to the scoreboard
*/
private SimpleScoreboard displayMap(Player p) {
Scoreboard board = ScoreboardLib.createScoreboard(p).setHandler(new ScoreboardHandler() {
LangManager messages = plugin.getLangManager();
@Override
public String getTitle(Player p) {
return messages.getRawString("Commands.LandMap.header");
}
@Override
public List<Entry> getEntries(Player player) {
if (!currDir.equals(getPlayerDirection(mapViewer)) || !currChunk.equals(mapViewer.getLocation().getChunk())) {
currDir = getPlayerDirection(mapViewer);
}
EntryBuilder eb = new EntryBuilder();
String[] mapData = buildMap(p);
for (String aMapData : mapData) {
// Not sure what this part does. It works without lol
/*if (mapData[i].length() < 21) {
for (int f = 0; f < (21 - mapData[i].length()); f++) {
mapData[i] += ChatColor.RESET;
}
}*/
eb.next(aMapData);
}
return eb.build();
}
}).setUpdateInterval(plugin.getConfig().getLong("Map.refreshRate", 10));
SimpleScoreboard simpleScoreboard = (SimpleScoreboard) board;
simpleScoreboard.activate();
this.scoreboard = simpleScoreboard;
return simpleScoreboard;
}
Aggregations