Skip to content

Enhance GM commands configuration with per-account overrides and default settings#6

Merged
Yehonal merged 4 commits intomasterfrom
feat/account-specific-config-and-improvements
Sep 28, 2025
Merged

Enhance GM commands configuration with per-account overrides and default settings#6
Yehonal merged 4 commits intomasterfrom
feat/account-specific-config-and-improvements

Conversation

@Yehonal
Copy link
Collaborator

@Yehonal Yehonal commented Sep 28, 2025

TLDR: Introduce per-account configurations for GM commands, allowing custom GM levels and command lists, along with default settings for accounts without specific overrides. Setting a GM Level (at least 1) is important to make some features to work - such as the keeping the player extra flags permanent after the relog (e.g. gm on/visible flags)

This pull request introduces a major refactor and extension of the GM commands configuration system. The changes provide more granular control over which accounts can use GM commands, their permission levels, and the commands available to them. The configuration file now supports per-account overrides, default levels, and command lists, while the codebase is updated to support these new features with a more robust and flexible structure.

Configuration enhancements:

  • Added support for specifying a default GM level (GmCommandsModule.DefaultLevel) and a default allowed command list (GmCommandsModule.DefaultCommands) in conf/mod_gm_commands.conf.dist. These apply to all managed accounts unless overridden per account. Per-account overrides for both level and allowed commands are now supported.

Codebase refactor and feature additions:

  • Replaced the old LoadAccountIds and LoadAllowedCommands methods with a single Reload method in GMCommands, reflecting the new configuration structure.
  • Introduced per-account configuration via the AccountConfiguration struct, supporting optional GM level and allowed command set for each account.
  • Added logic to normalize and validate command names and account levels, as well as improved error handling for invalid account IDs.
  • Enhanced command permission checking: IsCommandAllowed now considers both the account ID and the specific command, supporting per-account and default command lists.
  • Added methods to associate command metadata and handler information, enabling more detailed permission and command tracking.

@Yehonal Yehonal requested review from Nyeriah and Copilot and removed request for Copilot September 28, 2025 08:59
@Yehonal Yehonal requested review from Copilot and removed request for Nyeriah September 28, 2025 09:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces a comprehensive refactor of the GM commands configuration system, adding per-account overrides and default settings. The changes enable more granular control over GM command permissions by allowing custom GM levels and command lists for individual accounts while providing default fallback settings.

Key changes:

  • Replace simple account ID and command lists with a flexible configuration system supporting per-account overrides
  • Add default GM level and command list configuration options that apply to all managed accounts unless specifically overridden
  • Implement automatic security level management during player login to ensure configured GM levels are applied

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/GmCommands.h Refactored class interface with new account configuration structures and methods for handling per-account settings
src/GmCommands.cpp Complete implementation rewrite with configuration file parsing, account management, and command permission logic
conf/mod_gm_commands.conf.dist Updated configuration file with new default settings and per-account override options

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@chromiecraft chromiecraft deleted a comment from Copilot AI Sep 28, 2025
@Yehonal Yehonal merged commit 38ebd41 into master Sep 28, 2025
3 checks passed
@Helias Helias deleted the feat/account-specific-config-and-improvements branch September 28, 2025 10:35
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.

2 participants