Integrate TabListService to update player colors during the game

This commit is contained in:
akastijn 2026-07-12 21:41:26 +02:00
parent 95219c17bc
commit 7dce9d9f30
2 changed files with 11 additions and 2 deletions

View File

@ -38,13 +38,13 @@ public final class Main extends JavaPlugin {
statService = new StatService(this, round);
playerTeleporterService = PlayerTeleporterService.createSingletonInstance();
roundService = RoundService.createSingletonInstance(round, this, lootService, statService, playerTeleporterService);
tabListService = new TabListService(round, roundService);
roundService.setTabListService(tabListService);
playerService = PlayerService.createSingletonInstance(round, roundService, playerTeleporterService);
bossBarService = BossBarService.createSingletonInstance(round, roundService);
round.setBossBarService(bossBarService);
roundService.setBossBarService(bossBarService);
tabListService = new TabListService(round, roundService);
}
@Override

View File

@ -40,6 +40,8 @@ public class RoundService implements RoundListener {
private final Round round;
@Setter
private BossBarService bossBarService;
@Setter
private TabListService tabListService;
public static RoundService createSingletonInstance(Round round, Main main, LootService lootService, StatService statService, PlayerTeleporterService playerTeleporterService) {
if (instance != null) {
@ -75,6 +77,13 @@ public class RoundService implements RoundListener {
}
}
if (tabListService != null) {
Player player = Bukkit.getPlayer(uuid);
if (player != null) {
tabListService.updatePlayerColor(player);
}
}
if (!roundState.equals(ROUND_STATE.KILL_PHASE) && !roundState.equals(ROUND_STATE.FINALE)) {
return;
}