SteamWar/SpigotCore
Archiviert
13
0

WIP: scoreboard #12

Geschlossen
Lixfel möchte 22 Commits von scoreboard nach master mergen
Nur Änderungen aus Commit bc81ef6424 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -18,11 +18,11 @@ public class SWScoreboard {
ScoreboardCallback callback;
public SWScoreboard(Player player, ScoreboardCallback callback) {
public SWScoreboard(ScoreboardCallback callback) {
this.callback = callback;
}
public void sendScoreboard(Player player) {
private void sendScoreboard(Player player) {
PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
remove.getStrings().write(0, "AAA");
remove.getBytes().write(0, (byte) 1);
@ -56,7 +56,7 @@ public class SWScoreboard {
}
public void display(Player player) {
private void display(Player player) {
PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE);
display.getBytes().write(0, (byte) 1);
display.getStrings().write(0, this.callback.getTitle());
@ -69,28 +69,17 @@ public class SWScoreboard {
}
public static void startPlayerBoards() {
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getInstance(), new Runnable() {
@Override
public void run() {
synchronized (playerBoards) {
for(Map.Entry<Player, SWScoreboard> entry : playerBoards.entrySet()) {
entry.getValue().sendScoreboard(entry.getKey());
entry.getValue().display(entry.getKey());
}
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getInstance(), () -> {
synchronized (playerBoards) {
for(Map.Entry<Player, SWScoreboard> entry : playerBoards.entrySet()) {
entry.getValue().sendScoreboard(entry.getKey());
entry.getValue().display(entry.getKey());
}
}
}, 10, 5);
}
public ScoreboardCallback getCallback() {
return callback;
}
public void setCallback(ScoreboardCallback callback) {
this.callback = callback;
}
public static HashMap<Player, SWScoreboard> getPlayerBoards() {
return playerBoards;
}