You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-96Lines changed: 35 additions & 96 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,92 +4,26 @@
4
4
</a>
5
5
</p>
6
6
7
-
# Command Framework
7
+
# ⚡ Command Framework
8
8
9
-
Command Framework is a flexible and extensible command framework designed for Bukkit/Spigot and especially Paper forks. It simplifies the process of creating, registering, and managing commands dynamically at runtime—a task that can be challenging due to inherent differences and limitations between Bukkit/Spigot and Paper.
9
+
A modern, flexible command framework for Bukkit/Spigot and especially Paper Minecraft servers.
10
+
Easily create, register, and manage commands at runtime—even on Paper, where this is usually difficult.
10
11
11
12
---
12
13
13
-
## Overview
14
+
## ✨ Features
14
15
15
-
The `me.croabeast.command` package offers a modular command system that provides:
16
-
17
-
-**Robust Registration/Unregistration:**
18
-
Seamlessly register and unregister commands at runtime even on Paper servers, where many traditional Bukkit/Spigot implementations can break. Command Framework addresses the runtime registration challenges posed by Paper.
19
-
20
-
-**Sub-Commands Support:**
21
-
Easily implement command hierarchies with sub-commands. Each sub-command automatically derives its permission node from its parent and can be configured with aliases.
22
-
23
-
-**Dynamic Tab Completion:**
24
-
Build context-sensitive tab completions with the included `TabBuilder` class. You can define both static and dynamic suggestions, and even use predicates and functions to tailor completions based on the command sender or input.
25
-
26
-
-**Permission Handling:**
27
-
Leverage the `Permissible` and `DefaultPermissible` interfaces for robust permission checking. The framework supports wildcard permissions and integrates neatly with the Bukkit permission system.
28
-
29
-
-**Fluent Command Creation:**
30
-
Use the `CommandBuilder` class for a fluent API to quickly create and configure commands, setting properties like overriding behavior, error handling, and custom tab completion strategies.
31
-
32
-
-**Integration with Bukkit/Spigot/Paper:**
33
-
Built on top of Bukkit’s command system, Command Framework seamlessly integrates with the server’s command map and permission system. It is particularly tuned for Paper servers where runtime command management is notoriously challenging.
34
-
35
-
---
36
-
37
-
## Key Components
38
-
39
-
### Permissible & DefaultPermissible
40
-
-**Purpose:** Define basic permission requirements for commands.
41
-
-**Usage:** Implement these interfaces to ensure that only authorized users execute commands.
42
-
43
-
### Executable
44
-
-**Purpose:** Represent the command action that is executed.
45
-
-**Usage:** Return a result using a {@code State} enum to indicate success or failure.
46
-
47
-
### BaseCommand
48
-
-**Purpose:** Establish the core structure of commands, including their names, aliases, and executable actions.
49
-
-**Usage:** Use these interfaces as the foundation for building more complex commands with sub-commands and permissions.
50
-
51
-
### Command
52
-
-**Purpose:** Extend BaseCommand and Completable to provide a complete command interface with tab completion support.
53
-
-**Usage:** Manage sub-commands and wildcard permissions automatically.
54
-
55
-
### SubCommand
56
-
-**Purpose:** Create sub-commands that are automatically linked to a parent command.
57
-
-**Usage:** Easily extend commands with additional functionalities (e.g., a "reload" sub-command) while inheriting permission settings.
58
-
59
-
### TabBuilder
60
-
-**Purpose:** Build and manage tab-completion suggestions.
61
-
-**Usage:** Configure suggestions for specific command arguments with flexible filtering and predicate-based selection.
62
-
63
-
### BukkitCommand
64
-
-**Purpose:** An abstract base class that integrates with Bukkit’s command system.
65
-
-**Usage:** Extend this class for full control over command execution, including runtime registration/unregistration—a common challenge on Paper servers.
66
-
67
-
### CommandBuilder
68
-
-**Purpose:** Provide a fluent API for constructing commands.
69
-
-**Usage:** Use CommandBuilder to quickly create commands with tab completions and error handling, perfect for Paper forks with dynamic runtime command management.
70
-
71
-
---
72
-
73
-
## Why Command Framework Works on Paper Forks
74
-
75
-
Paper forks of Bukkit/Spigot often break traditional command registration methods, especially when attempting dynamic registration and unregistration at runtime. Command Framework was built with these challenges in mind. It:
76
-
77
-
-**Supports Runtime Changes:**
78
-
Enables commands to be registered and unregistered at runtime without issues on Paper.
79
-
80
-
-**Handles Compatibility Issues:**
81
-
Includes workarounds and specialized implementations (e.g., in `BukkitCommand` and `CommandBuilder`) that account for Paper’s modifications to the command system.
82
-
83
-
-**Ensures Stability:**
84
-
Provides robust error handling and permission management even when underlying APIs change between Bukkit/Spigot and Paper.
16
+
- 🔄 **Dynamic Command Registration:** Register/unregister commands at runtime, even on Paper.
17
+
- 🌳 **Sub-Commands:** Build command hierarchies with permissions and aliases.
18
+
- ✨ **Tab Completion:** Context-aware suggestions with `TabBuilder`.
19
+
- 🔐 **Permissions:** Wildcard and custom permission checks.
20
+
- 🧑💻 **Fluent API:** Quickly build commands with `CommandBuilder`.
85
21
86
22
---
87
23
88
-
## Usage Examples
89
-
90
-
### Example: Custom Command by Extending BukkitCommand
24
+
## 🛠️ Quick Example
91
25
92
-
Create a custom command by extending `BukkitCommand`:
26
+
Create and register a simple command with a sub-command:
93
27
94
28
```java
95
29
packagecom.example.myplugin.command;
@@ -125,7 +59,7 @@ public class GreetCommand extends BukkitCommand implements DefaultPermissible {
@@ -155,7 +89,7 @@ public class GreetCommand extends BukkitCommand implements DefaultPermissible {
155
89
}
156
90
```
157
91
158
-
#### Registering the Command
92
+
#### 📝 Registering the Command
159
93
160
94
In your plugin’s main class (extending `JavaPlugin`), register the command:
161
95
@@ -181,14 +115,9 @@ public class MyPlugin extends JavaPlugin {
181
115
182
116
---
183
117
184
-
## Maven / Gradle Installation
185
-
186
-
To include Command Framework to the project, add the following repository and dependency to your build configuration. Replace `${version}` with the desired version tag.
187
-
188
-
### Maven
189
-
190
-
Add the repository and dependency to your `pom.xml`:
118
+
## ⚙️ Installation
191
119
120
+
**Maven:**
192
121
```xml
193
122
<repositories>
194
123
<repository>
@@ -207,10 +136,7 @@ Add the repository and dependency to your `pom.xml`:
207
136
</dependencies>
208
137
```
209
138
210
-
### Gradle
211
-
212
-
Add the repository and dependency to your `build.gradle`:
213
-
139
+
**Gradle:**
214
140
```groovy
215
141
repositories {
216
142
maven {
@@ -223,16 +149,29 @@ dependencies {
223
149
}
224
150
```
225
151
226
-
Replace `${version}` with the appropriate module version.
152
+
Replace `${version}` with the latest version.
227
153
228
154
---
229
155
230
-
## Conclusion
156
+
## ❓ Why Use This?
231
157
232
-
**Command Framework** (the collection of classes in the `me.croabeast.command` package) is designed to streamline command development for Minecraft plugins, particularly on Paper forks where runtime registration can be challenging. Its modular design, support for sub-commands, dynamic tab completion, and robust permission checks make it an ideal choice for modern plugin development.
158
+
- Works reliably on Paper forks where other frameworks fail.
159
+
- Makes complex command trees and tab completions easy.
160
+
- Handles permissions and registration for you.
161
+
162
+
---
163
+
164
+
## 🚀 Get Started
165
+
166
+
1. Add the dependency.
167
+
2. Extend `BukkitCommand` or create your own command class.
168
+
3. Register your command in your plugin's `onEnable()`.
169
+
170
+
---
233
171
234
-
With Command Framework, you can build sophisticated command hierarchies, provide context-sensitive tab completions, and manage command registration and unregistration at runtime—ensuring compatibility and stability even on the latest Paper servers.
172
+
## 🎉 Happy Coding!
235
173
236
-
Happy coding and enjoy building powerful commands with Command Framework!
174
+
Build powerful, modern commands for your Minecraft plugin with ease!
0 commit comments