Skip to content

Commit c05b7a3

Browse files
committed
Add /tm status command
Signed-off-by: Eudald Cardona <me@eudald.me>
1 parent 17e53e4 commit c05b7a3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/main/java/dev/pgm/events/ready/ReadyCommands.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import dev.pgm.events.config.AppData;
44
import java.time.Duration;
5+
import java.util.stream.Stream;
56
import net.md_5.bungee.api.ChatColor;
67
import org.bukkit.Bukkit;
78
import org.bukkit.command.CommandSender;
@@ -78,6 +79,25 @@ public void unreadyCommand(CommandSender sender, Match match, MatchPlayer player
7879
}
7980
}
8081

82+
@Command(aliases = "status", desc = "Display if teams are ready")
83+
public void status(CommandSender sender, Match match) {
84+
Stream<? extends Party> parties = match.getCompetitors().stream();
85+
if (AppData.observersMustReady())
86+
parties = Stream.concat(Stream.of(match.getDefaultParty()), parties);
87+
88+
parties
89+
.map(
90+
p ->
91+
p.getColor()
92+
+ p.getNameLegacy()
93+
+ ChatColor.RESET
94+
+ " is "
95+
+ (readyParties.isReady(p)
96+
? ChatColor.GREEN + "ready"
97+
: ChatColor.RED + "not ready"))
98+
.forEach(sender::sendMessage);
99+
}
100+
81101
private boolean preConditions(Match match) {
82102
return !match.isRunning() && !match.isFinished();
83103
}

0 commit comments

Comments
 (0)