SteamWar/SpigotCore
Archiviert
13
0
Dieser Commit ist enthalten in:
BuildTools 2019-11-24 19:51:52 +01:00
Ursprung d4dcbfeafa
Commit bc81ef6424

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() {
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;
}