Commit 38ebd41
authored
Enhance GM commands configuration with per-account overrides and default settings (#6)
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.1 parent 7514e2f commit 38ebd41
File tree
5 files changed
+550
-44
lines changed- .github
- conf
- src
5 files changed
+550
-44
lines changedThis file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | | - | |
30 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
31 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
32 | 42 | | |
33 | 43 | | |
34 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
0 commit comments