Skip to content

Conversation

CaptainSqrBeard
Copy link

@CaptainSqrBeard CaptainSqrBeard commented Mar 18, 2025

This PR adds two hooks related to console.

Client-side hook onClientConsoleCommand(string[] splitCommand, Command? command) casts when user inputs command in console. If hook returns true value, command will be sent to server, ignoring client's permission check and RelayToServer flag.

  1. string[] splitCommand is split version of command
  2. Command? command is command as Command. Will be nil if command is unregistered

Server-side hook onConsoleCommand(Client client, string[] splitCommand, Command? command, bool passedConsolePermissionCheck, bool passedCommandPermissionCheck) casts when client tries to execute command in console. If hook returns true value, command will be executed, ignoring client permissions.

  1. Client client that executes command
  2. string[] splitCommand is split version of command
  3. Command? command is command as Command. Will be nil if command is unregistered
  4. bool passedConsolePermissionCheck will be true if client has ConsoleCommands permission
  5. bool passedCommandPermissionCheck will be true if client has permission to execute this command. This will be false if command is unregistered.

These two hooks can be used in case if mod adds custom commands. Game tends to delete permissions to unregistered commands which applies to custom commands when they're not initialized yet. With these hooks, mod can check permissions for commands itself, i.e. by using it's own database with permissions.

@CaptainSqrBeard
Copy link
Author

@evilfactory 👉👈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant