This commit is contained in:
Luca 2021-11-23 19:49:46 +01:00
parent e92e1ea23f
commit b78d4d175a
2 changed files with 13 additions and 5 deletions

View File

@ -103,6 +103,10 @@ public class Game {
}));
}
public void broadcastToOneTeam(String message, GameTeam gameTeam) {
this.teams.stream().filter(team -> team == gameTeam).forEach(team -> team.playingPlayers().forEach(player -> player.sendMessage(CC.translate(message))));
}
public int decrementCountdown() {
return --this.countdown;
}

View File

@ -80,7 +80,7 @@ public class ScoreboardProvider implements BoardAdapter {
green.setPrefix(String.valueOf(ChatColor.GREEN));
PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(player.getUniqueId());
if (playerData.getPlayerState() != PlayerState.PLAYING) {
if (playerData.getPlayerState() != PlayerState.PLAYING && playerData.getPlayerState() != PlayerState.RESPAWNING) {
Objective objective = player.getScoreboard().getObjective(DisplaySlot.BELOW_NAME);
if (objective != null) {
objective.unregister();
@ -134,6 +134,7 @@ public class ScoreboardProvider implements BoardAdapter {
for (UUID teamUUID : team.getPlayingPlayers()) {
Player teamPlayer = this.plugin.getServer().getPlayer(teamUUID);
if (teamPlayer != null) {
String teamPlayerName = teamPlayer.getName();
if (team.getId() == 1) {
if (green.hasEntry(teamPlayerName)) {
@ -266,11 +267,14 @@ public class ScoreboardProvider implements BoardAdapter {
lines.add("&7[" + opposingTeam.getPlayerTeam().getChatColor() + opposingTeam.getPlayerTeam().getSmallName() + "&7] &c&l✗");
}
lines.add(" ");
Player teamAplayer = yourTeam.playingPlayers().collect(Collectors.toList()).get(0);
lines.add(yourTeam.getPlayerTeam().getChatColor() + (teamAplayer != null ? teamAplayer.getName() : "None"));
List<Player> teamAplayers = yourTeam.playingPlayers().collect(Collectors.toList());
List<Player> teamBplayers = opposingTeam.playingPlayers().collect(Collectors.toList());
lines.add(yourTeam.getPlayerTeam().getChatColor() + (teamAplayers.size() > 0 ? teamAplayers.get(0).getName() : "None"));
lines.add("&7VS");
Player teamBplayer = opposingTeam.playingPlayers().collect(Collectors.toList()).get(0);
lines.add(opposingTeam.getPlayerTeam().getChatColor() + (teamBplayer != null ? teamBplayer.getName() : "None"));
lines.add(opposingTeam.getPlayerTeam().getChatColor() + (teamBplayers.size() > 0 ? teamBplayers.get(0).getName() : "None"));
lines.add(" ");
lines.add("&dtilly.rip");
lines.add(CC.scoreboardBar);