namespace Minecraft.Server.FourKit.Event.Player; using Minecraft.Server.FourKit.Entity; /// /// Called early in the command handling process. This event is only for very /// exceptional cases and you should not normally use it. /// /// If a PlayerCommandPreprocessEvent is cancelled, the command will not /// be executed in the server, but will still pass to other plugins. /// public class PlayerCommandPreprocessEvent : PlayerEvent, Cancellable { private string _message; private bool _cancel; internal PlayerCommandPreprocessEvent(Player player, string message) : base(player) { _message = message; _cancel = false; } /// public bool isCancelled() => _cancel; /// public void setCancelled(bool cancel) { _cancel = cancel; } /// /// Gets the command that the player is attempting to send. All commands /// begin with a special character; implementations do not consider the /// first character when executing the content. /// /// Message the player is attempting to send. public string getMessage() => _message; /// /// Sets the command that the player will send. All commands begin with a /// special character; implementations do not consider the first character /// when executing the content. /// /// New message that the player will send. /// If command is null or empty. public void setMessage(string command) { if (string.IsNullOrEmpty(command)) throw new ArgumentException("Command may not be null or empty", nameof(command)); _message = command; } }