@@ -624,12 +624,15 @@ public Integer[] numArgs() {
624624
625625 @ Override
626626 public String docs () {
627- return "void {message, [permission] | message, [players]} Broadcasts a message to all or some players."
628- + " If permission is given, only players with that permission will see the broadcast."
627+ return "void {message, [permission] | message, [players]} Broadcasts a message to all or some players"
628+ + " and/or console."
629+ + " If permission is given, only players with that permission will see the broadcast. On Bukkit"
630+ + " servers, console will only receive the broadcast when permission is 'bukkit.broadcast'."
629631 + " If an array is given, only online players in the list will see the broadcast."
632+ + " Console will receive the broadcast only when the array contains case-insensitive '~console'."
630633 + " Offline players in the list will be ignored."
631- + " If permission/players is null, all players will see the broadcast."
632- + " Throws a CREFormatException when the given players array is associative." ;
634+ + " If permission/players is null, all players and console will see the broadcast."
635+ + " Throws CREFormatException when the given players array is associative." ;
633636 }
634637
635638 @ Override
@@ -670,10 +673,14 @@ public Construct exec(Target t, Environment env, Construct... args) throws Confi
670673 // Get the player recipients from the array.
671674 Set <MCCommandSender > recipients = new HashSet <>();
672675 for (Construct p : array .asList ()) {
673- try {
674- recipients .add (Static .GetPlayer (p , t ));
675- } catch (CREPlayerOfflineException cre ) {
676- // Ignore offline players.
676+ if (p .val ().equalsIgnoreCase ("~console" )) {
677+ recipients .add (server .getConsole ());
678+ } else {
679+ try {
680+ recipients .add (Static .GetPlayer (p , t ));
681+ } catch (CREPlayerOfflineException cre ) {
682+ // Ignore offline players.
683+ }
677684 }
678685 }
679686
0 commit comments