{"id":18647160,"url":"https://github.com/wesjd/commandmanager","last_synced_at":"2025-11-05T06:30:26.927Z","repository":{"id":97974124,"uuid":"52050359","full_name":"WesJD/CommandManager","owner":"WesJD","description":"An annotation based command system for Sponge.","archived":false,"fork":false,"pushed_at":"2016-06-30T02:54:30.000Z","size":2970,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-18T01:37:24.775Z","etag":null,"topics":["annotations","command","sponge","spongepowered"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WesJD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-19T00:49:42.000Z","updated_at":"2016-02-20T04:49:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"54c4d8f7-f50f-4100-9be7-a1a1a3b1d373","html_url":"https://github.com/WesJD/CommandManager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WesJD%2FCommandManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WesJD%2FCommandManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WesJD%2FCommandManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WesJD%2FCommandManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WesJD","download_url":"https://codeload.github.com/WesJD/CommandManager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239449586,"owners_count":19640535,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annotations","command","sponge","spongepowered"],"created_at":"2024-11-07T06:24:57.062Z","updated_at":"2025-11-05T06:30:26.897Z","avatar_url":"https://github.com/WesJD.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CommandManager [![Build Status](https://drone.io/github.com/WesJD/CommandManager/status.png)](https://drone.io/github.com/WesJD/CommandManager/latest)\nAn annotation based command system for [Sponge](https://www.spongepowered.org/).\n\n## Dependencies\nThis relies on [Reflections](https://github.com/ronmamo/reflections) to register classes. There is currently no alternatives to this.\n\n## How to use\n### Initialize the manager and register commands\n```java\n    @Listener\n    public void onServerStarting(GameStartingServerEvent e) {\n        CommandManager.getInstance().initialize(this);\n        CommandManager.getInstance().registerClassesOf(\"my.package.with.command.classes\");\n    }\n```\nCall `CommandManager#initialize(Object plugin)` with your class annotated with `@Plugin` as the parameter. Then call `CommandManager#registerClassesOf(String pkg)` with your package of command classes. They don't all have to be command classes though, they are filtered. You can call `#registerClassesOf` as many times as you would like to reigster different packages. Do note that [Reflections](https://github.com/ronmamo/reflections) will search nested packages too, so it's got you covered.\n\n### Creating a command\n```java\n    @Command(name = \"test\", aliases = \"t;t2\", requiredArgs = 2, usage = \"Put something;Do it again!\", separator = \";\")\n    public void onCmd(CommandSource source) {\n        source.sendMessage(Text.of(\"goat job m8\"));\n    }\n```\nDo be aware that you can create as many commands as you want in one class. Otherwise, `name` is the command name, and `aliases` are the aliases of the command. `aliases` and `uasages` are both split by `separator` that you can set. The default is \", \" (comma space). \n\n`requiredArgs` is the required argument amount. If the source does not supply that amount of arguments, it will find the corresponding usage message (they should be in order). If there isn't a usage supplied, it will simply say \"Not enough arguments.\" \n\nAlso be aware that you do not have to use the required arguments and can handle that yourself like so.\n```java\n    @Command(name = \"test\", aliases = \"t, t2\")\n    public void onCmd(CommandSource source, String[] args) {\n        Arrays.stream(args).forEach(msg -\u003e source.sendMessage(Text.of(msg)));\n    }\n```\n\n### Importing\nEither put the source into your project or shade it in with Maven. \n```xml\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003enet.wesjd\u003c/groupId\u003e\n        \u003cartifactId\u003ecommandmanager\u003c/artifactId\u003e\n        \u003cversion\u003e1.1-SNAPSHOT\u003c/version\u003e\n    \u003c/dependency\u003e\n    ...\n\u003c/dependencies\u003e\n\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ewesjd-repo\u003c/id\u003e\n        \u003curl\u003ehttp://wesjd.net:8081/repository/thirdparty/\u003c/url\u003e\n    \u003c/repository\u003e\n    ...\n\u003c/repositories\u003e\n```\nalternatively, you can download a jar [here](https://drone.io/github.com/WesJD/CommandManager/files).\n\nHope you use this well.\n\n## License\nThis project is registered under the [MIT License](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesjd%2Fcommandmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwesjd%2Fcommandmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesjd%2Fcommandmanager/lists"}