Skip to content

Commit

Permalink
Add /tm status command
Browse files Browse the repository at this point in the history
  • Loading branch information
eudaldca committed Jan 9, 2021
1 parent 17e53e4 commit 1c7c0b4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/dev/pgm/events/ready/ReadyCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import dev.pgm.events.config.AppData;
import java.time.Duration;
import java.util.stream.Stream;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -78,6 +79,25 @@ public void unreadyCommand(CommandSender sender, Match match, MatchPlayer player
}
}

@Command(aliases = "status", desc = "Display if teams are ready")
public void status(CommandSender sender, Match match) {
Stream<? extends Party> parties = match.getCompetitors().stream();
if (AppData.observersMustReady())
parties = Stream.concat(Stream.of(match.getDefaultParty()), parties);

parties
.map(
p ->
p.getColor()
+ p.getNameLegacy()
+ ChatColor.RESET
+ " is "
+ (readyParties.isReady(p)
? ChatColor.GREEN + "ready"
: ChatColor.RED + "not ready"))
.forEach(sender::sendMessage);
}

private boolean preConditions(Match match) {
return !match.isRunning() && !match.isFinished();
}
Expand Down

0 comments on commit 1c7c0b4

Please sign in to comment.