Improve Scoreboard (And tps rendering)
Dieser Commit ist enthalten in:
Ursprung
587a0fabc7
Commit
90b3c7669b
@ -20,11 +20,11 @@
|
||||
package de.steamwar.bausystem.world;
|
||||
|
||||
import de.steamwar.bausystem.commands.CommandFreeze;
|
||||
import de.steamwar.bausystem.commands.CommandInfo;
|
||||
import de.steamwar.bausystem.commands.CommandTNT;
|
||||
import de.steamwar.bausystem.tracer.TraceManager;
|
||||
import de.steamwar.bausystem.tracer.recorder.RecordManager;
|
||||
import de.steamwar.bausystem.tracer.recorder.TNTRecorder;
|
||||
import de.steamwar.core.TPSWatcher;
|
||||
import de.steamwar.scoreboard.SWScoreboard;
|
||||
import de.steamwar.scoreboard.ScoreboardCallback;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -44,7 +44,7 @@ public class BauScoreboard implements Listener {
|
||||
SWScoreboard.createScoreboard(player, new ScoreboardCallback() {
|
||||
@Override
|
||||
public HashMap<String, Integer> getData() {
|
||||
return render(sidebar(player));
|
||||
return sidebar(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,16 +54,7 @@ public class BauScoreboard implements Listener {
|
||||
});
|
||||
}
|
||||
|
||||
private HashMap<String, Integer> render(List<String> strings) {
|
||||
HashMap<String, Integer> data = new HashMap<>();
|
||||
String[] elements = strings.toArray(new String[0]);
|
||||
for (int i = elements.length - 1; i >= 0; i--) {
|
||||
data.put(elements[i], elements.length - i - 1);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private List<String> sidebar(Player p) {
|
||||
private HashMap<String, Integer> sidebar(Player p) {
|
||||
List<String> strings = new ArrayList<>();
|
||||
strings.add("§1");
|
||||
strings.add("§eUhrzeit§8: §7" + new SimpleDateFormat("HH:mm:ss").format(Calendar.getInstance().getTime()));
|
||||
@ -81,8 +72,13 @@ public class BauScoreboard implements Listener {
|
||||
}
|
||||
|
||||
strings.add("§4");
|
||||
strings.add("§eTPS§8: §7" + CommandInfo.getTps()[0]);
|
||||
return strings;
|
||||
strings.add("§eTPS§8: §7" + TPSWatcher.getTPS());
|
||||
|
||||
int i = strings.size();
|
||||
HashMap<String, Integer> result = new HashMap<>();
|
||||
for(String s : strings)
|
||||
result.put(s, i--);
|
||||
return result;
|
||||
}
|
||||
|
||||
private long traceTicks() {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren