galaxygames / ovommand
a normal framework virion designed to parse command data for PocketMine - MP
Requires
- php: ^8.2
- muqsit/simple-packet-handler: ^0.1.5
Requires (Dev)
- phpstan/phpstan: ^2.0
- pocketmine/pocketmine-mp: ^5.27.1
This package is not auto-updated.
Last update: 2025-05-08 00:08:16 UTC
README
a feature-rich virion framework to handle commands for PocketMine-MP
📔Docs⠀⠀🔌Demo plugin
📖 Introduction
Ovommand is a command parsing and handling framework for PocketMine-MP. It made it easy for defining, registering, and executing commands with complex parameter structures, validation, and hierarchical organization.
Important
Please note that this project is still at a very early stage and has not yet been released officially, and interfaces may be added or removed without notice. Please do not use Ovommand in a production!
This project is under construction....
Features
-
- Custom command with rich customizability
-
- Custom subcommand/parameters with command enum supports
-
- Parser for complex parameters with syntax checker
-
- Position parameter (
~~ ~
,12 -31 ~123
, etc) - Done?
- Position parameter (
-
- Target parameter (
@a
,@s
, etc...) - Currently unstable
- Target parameter (
-
- Float, Int, Text,... parameter
-
- Json parameter
-
- Default enums support (player list, gamemode, boolean, etc)
-
- Visible/Hidden aliases for subcommands.
-
- Constraints for commands
-
- Auto-generated usage for commands/subcommands
-
- Command namespace (from vanilla addon:
/plugin1:test
)
- Command namespace (from vanilla addon:
-
- Duplicate command name handle (adding counter to the command name)
-
- Attribute supports (temp abandoned)
-
- ?
Requirement
- PHP 8.2 or higher
- PMMP 5.27.0 or higher
- simple-packet-handler 0.1.5 or higher
Getting Started
Contributing
Yes, please...
Note
A. Namespace system
- If plugin A has
namespace: ns
set inplugin.yml
then
a) plugin A hasforce namespace
Issues:
-
-
$returnRaw
inBaseResult
is confusing and useless?
-
-
-
isBlockPos
current do nothing in CoordinateResult
-
-
- Allow users to decide how the subcommand aliases are handled (multiple overloads vs packed enum)
-
- Command namespace system (as vanilla addon) and duplicate command name.
Show useless dumps
Enums system:
Soft Enum | Hard Enum | |
---|---|---|
Can value be read by owner? | YES | YES |
Can value be read by other? (Public) | YES | YES |
Can value be read by other? (Private) | NO | NO |
Can value be written by owner? (Before server starts) | YES | YES |
Can value be written by others? (Private) | NO | NO |
Can value be written by others? (Before server starts, not Protected) | YES | YES |
Can value be written by owner? (After server starts) | YES | NO |
Can value be written by others? (After server starts, not Protected) | YES | NO |
Can value be written by others? (Before server starts, Protected) | NO | NO |
Can value be written by others? (After server starts, Protected) | NO | NO |
Can alias be written by owner? (Before server starts) | YES | YES |
Can alias be written by owner? (After server starts) | YES | NO |
Can alias be written by others? (Before server starts, not Protected) | YES | YES |
Can alias be written by others? (Before server starts, Protected) | NO | NO |
Can alias be written by others? (After server starts, not Protected) | YES | NO |
Can alias be written by others? (After server starts, Protected) | NO | NO |
TODO:
- make reasonable enum that handle it value correctly (string -> value)
- custom enum, parameters, enum-based parameters
- feature rich
- usage messages
- result system (parser), not that good tho :l
- attribute supports (temp abandoned)
- SubCommand doesn't require perms if wanted
-
make syntax parser based on its string pos, not the string itself for the accuracy in catching broken syntaxspoiled - fix a bug where the parser cannot check the correct span leading to this to be valid:
/tp ~~~ a
, where a is not valid but the parser cannot know that because it don't expect that to be a case! - fix broken SYNTAX_PRINT_VANILLA
- fix an issue where it failed to parse the parameter after position parameter that has less than the span! eg: ~~~ a, failed to parse a
Suggest:
- make canParse and parse into one
- empty parameter functionality
- allow parameter to not provide data to the ingame auto-complete
- make overloadId global which will make the code shorter
- template? (temp abandoned)
- move part of Ovommand to BaseCommand
- do subCommand even need description?
- more features to the syntax parser
- rename parsedId & matchedId in Results to rawParsedCount & parsedCount
Discuss:
- Default Enums should have its own register and a version checker!? (temp abandoned)
- the problem with shared data is that if other plugins try to use other plugins enum... the enum might not exist due to plugin loading order!
- Default enums can have duplicated values if the event called more than twice on different plugins!
- Merge onRun() and onSyntaxError()?
- Add supports for private enums and synced properties for soft enums
Self note:
- Soft enums cannot spread out its value using flag 1!
- Two enums, one soft and one hard could have a same name
- Enum name could be set to anything, not just ascii / UTF-8
❌ ✔️ ✅
checked | unchecked | crossed |
---|---|---|
✓ | _ | ✗ |
☑ | ☐ | ☒ |