diff --git a/SharedLibraryCore/Commands/NativeCommands.cs b/SharedLibraryCore/Commands/NativeCommands.cs index edd4a5c06..df91d0892 100644 --- a/SharedLibraryCore/Commands/NativeCommands.cs +++ b/SharedLibraryCore/Commands/NativeCommands.cs @@ -239,6 +239,42 @@ namespace SharedLibraryCore.Commands } } + /// + /// Prints out a message to all clients on all servers + /// + public class SayAllCommand : Command + { + public SayAllCommand(CommandConfiguration config, ITranslationLookup translationLookup) : base(config, translationLookup) + { + Name = "sayall"; + Description = _translationLookup["COMMANDS_SAY_ALL_DESC"]; + Alias = "sa"; + Permission = Permission.Moderator; + RequiresTarget = false; + Arguments = new[] + { + new CommandArgument() + { + Name = _translationLookup["COMMANDS_ARGS_MESSAGE"], + Required = true + } + }; + } + + public override Task ExecuteAsync(GameEvent E) + { + string message = _translationLookup["COMMANDS_SAY_ALL_MESSAGE_FORMAT"].FormatExt(E.Origin.Name, E.Data); + + foreach (var server in E.Owner.Manager.GetServers()) + { + server.Broadcast(message, E.Origin); + } + + E.Origin.Tell(_translationLookup["COMMANDS_SAY_SUCCESS"]); + return Task.CompletedTask; + } + } + /// /// Temporarily bans a client ///