Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,19 @@ public class PlayerCommandServiceOptions : CommandServiceOptions
/// Defaults to <see cref="Color.White"/>.
/// </summary>
public Color UsageMessageColor { get; set; } = Color.White;

/// <summary>
/// Gets or sets the color used when displaying permission denied messages.
/// Defaults to <see cref="Color.White"/>.
/// </summary>
public Color PermissionDeniedMessageColor { get; set; } = Color.White;

/// <summary>
/// Gets or sets the message displayed when a player attempts to execute
/// a command without sufficient permissions.
/// If <see langword="null"/>, no message is sent.
/// Defaults to "You do not have permission to use this command.".
/// </summary>
public string? PermissionDeniedMessage { get; set; }
= "You do not have permission to use this command.";
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ public virtual bool SendPermissionDenied(Player player, CommandDefinition overlo
ArgumentNullException.ThrowIfNull(player);
ArgumentNullException.ThrowIfNull(overload);

const string message = "You do not have permission to use this command.";
player.SendClientMessage(message);
if (_options.PermissionDeniedMessage is null)
return true;

player.SendClientMessage(_options.PermissionDeniedMessageColor, _options.PermissionDeniedMessage);
return true;
}

Expand Down