66import dev .pgm .events .utils .Parties ;
77import dev .pgm .events .utils .Response ;
88import java .time .Duration ;
9- import org .bukkit .Bukkit ;
10- import org .bukkit .ChatColor ;
9+ import javax .annotation .Nullable ;
1110import tc .oc .pgm .api .match .Match ;
1211import tc .oc .pgm .api .match .MatchPhase ;
1312import tc .oc .pgm .api .party .Party ;
1413import tc .oc .pgm .api .player .MatchPlayer ;
1514import tc .oc .pgm .events .CountdownStartEvent ;
15+ import tc .oc .pgm .lib .net .kyori .adventure .text .TextComponent ;
16+ import tc .oc .pgm .lib .net .kyori .adventure .text .format .NamedTextColor ;
1617import tc .oc .pgm .match .ObserverParty ;
1718import tc .oc .pgm .start .StartCountdown ;
1819import tc .oc .pgm .start .StartMatchModule ;
20+ import tc .oc .pgm .util .named .NameStyle ;
1921
2022public class ReadyManagerImpl implements ReadyManager {
2123
@@ -36,16 +38,16 @@ public void createMatchStart(Match match, Duration duration) {
3638 }
3739
3840 @ Override
39- public void ready (Party party ) {
41+ public void ready (Party party , @ Nullable MatchPlayer player ) {
4042 Match match = party .getMatch ();
4143
42- if ( party . isNamePlural ()) {
43- Bukkit . broadcastMessage (
44- party . getColor () + party .getNameLegacy () + ChatColor . RESET + " are now ready." );
45- } else {
46- Bukkit . broadcastMessage (
47- party . getColor () + party . getNameLegacy () + ChatColor . RESET + " is now ready." );
48- }
44+ TextComponent . Builder message =
45+ text ()
46+ . append ( party .getName ())
47+ . append ( text ( " marked as " ). append ( text ( "ready" , NamedTextColor . GREEN )));
48+ if ( player != null ) message . append ( text ( " by " ). append ( player . getName ( NameStyle . COLOR )));
49+
50+ match . sendMessage ( message );
4951
5052 parties .ready (party );
5153 if (allReady (match )) {
@@ -54,16 +56,16 @@ public void ready(Party party) {
5456 }
5557
5658 @ Override
57- public void unready (Party party ) {
59+ public void unready (Party party , @ Nullable MatchPlayer player ) {
5860 Match match = party .getMatch ();
5961
60- if ( party . isNamePlural ()) {
61- Bukkit . broadcastMessage (
62- party . getColor () + party .getNameLegacy () + ChatColor . RESET + " are now unready." );
63- } else {
64- Bukkit . broadcastMessage (
65- party . getColor () + party . getNameLegacy () + ChatColor . RESET + " is now unready." );
66- }
62+ TextComponent . Builder message =
63+ text ()
64+ . append ( party .getName ())
65+ . append ( text ( " marked as " ). append ( text ( "unready" , NamedTextColor . RED )));
66+ if ( player != null ) message . append ( text ( " by " ). append ( player . getName ( NameStyle . COLOR )));
67+
68+ match . sendMessage ( message );
6769
6870 if (allReady (match ) && system .unreadyShouldCancel ()) {
6971 // check if unready should cancel
0 commit comments