mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 19:59:11 +00:00
Rework command alias handling, step 1 (#6685)
This PR started out as an effort to decouple Command and CommandMap, but it's turned into a bit more than that. A summary of changes: ## UX - Added `cmdalias create`, `cmdalias delete` and `cmdalias list` commands - `/help` now shows prefixed names such as `pocketmine:help` - Prefixed command name (e.g. `pocketmine:help`) are now visible to Minecraft clients - Permission denied messages are now able to show more useful context when e.g. checking subcommand permissions - Multiple commands claiming an alias make the alias unusable (an error will be shown when used telling the user to pick from the namespaced names), instead of whichever plugin loaded last getting lucky ## API - Added `CommandAliasMap`, which handles mapping of aliases to namespaced command IDs - Added `CommandSender->getCommandAliasMap()` for user-specific aliases - Added `CommandMap->getAliasMap()` for global fallback aliases - `Command` no longer tracks its own registered aliases (now the job of `CommandMap`), breaking circular dependency - Aliases must now be provided to `CommandMap->register()` - Aliases can now be individually registered and unregistered without re-registering/unregistering the whole command using `CommandAliasMap` APIs - Aliases are no longer namespaced, only the main command name (e.g. `pocketmine:?` is now gone while `pocketmine:help` still exists) - `Command` now requires a `$namespace` parameter, which replaces the old `$fallbackPrefix` parameter of `register()`. It should be set to the name of the plugin. Relevant issues - #6508 - #3371 - this PR doesn't implement storage, but allows configuration of per-user aliases during server runtime
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
"pocketmine/callback-validator": "dev-rewrite",
|
||||
"pocketmine/color": "^0.3.0",
|
||||
"pocketmine/errorhandler": "^0.7.0",
|
||||
"pocketmine/locale-data": "~2.26.0",
|
||||
"pocketmine/locale-data": "~2.27.0",
|
||||
"pocketmine/log": "^0.4.0",
|
||||
"pocketmine/math": "dev-major-next as 1.0.0",
|
||||
"pocketmine/nbt": "~1.2.0",
|
||||
|
Reference in New Issue
Block a user