cleanup
Dieser Commit ist enthalten in:
Ursprung
d4dcbfeafa
Commit
bc81ef6424
@ -18,11 +18,11 @@ public class SWScoreboard {
|
|||||||
|
|
||||||
ScoreboardCallback callback;
|
ScoreboardCallback callback;
|
||||||
|
|
||||||
public SWScoreboard(Player player, ScoreboardCallback callback) {
|
public SWScoreboard(ScoreboardCallback callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendScoreboard(Player player) {
|
private void sendScoreboard(Player player) {
|
||||||
PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
|
PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
|
||||||
remove.getStrings().write(0, "AAA");
|
remove.getStrings().write(0, "AAA");
|
||||||
remove.getBytes().write(0, (byte) 1);
|
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);
|
PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE);
|
||||||
display.getBytes().write(0, (byte) 1);
|
display.getBytes().write(0, (byte) 1);
|
||||||
display.getStrings().write(0, this.callback.getTitle());
|
display.getStrings().write(0, this.callback.getTitle());
|
||||||
@ -69,28 +69,17 @@ public class SWScoreboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void startPlayerBoards() {
|
public static void startPlayerBoards() {
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getInstance(), new Runnable() {
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getInstance(), () -> {
|
||||||
@Override
|
synchronized (playerBoards) {
|
||||||
public void run() {
|
for(Map.Entry<Player, SWScoreboard> entry : playerBoards.entrySet()) {
|
||||||
synchronized (playerBoards) {
|
entry.getValue().sendScoreboard(entry.getKey());
|
||||||
for(Map.Entry<Player, SWScoreboard> entry : playerBoards.entrySet()) {
|
entry.getValue().display(entry.getKey());
|
||||||
entry.getValue().sendScoreboard(entry.getKey());
|
|
||||||
entry.getValue().display(entry.getKey());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 10, 5);
|
}, 10, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ScoreboardCallback getCallback() {
|
|
||||||
return callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCallback(ScoreboardCallback callback) {
|
|
||||||
this.callback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HashMap<Player, SWScoreboard> getPlayerBoards() {
|
public static HashMap<Player, SWScoreboard> getPlayerBoards() {
|
||||||
return playerBoards;
|
return playerBoards;
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren