Skip to content

Commit a35e18d

Browse files
committed
1.1 - Update README.md
1 parent d9fdfd8 commit a35e18d

File tree

1 file changed

+6
-72
lines changed

1 file changed

+6
-72
lines changed

README.md

Lines changed: 6 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -6,90 +6,24 @@
66

77
# ⚡ Command Framework
88

9-
A modern, flexible command framework for Bukkit/Spigot and especially Paper Minecraft servers.
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.
1011
Easily create, register, and manage commands at runtime—even on Paper, where this is usually difficult.
1112

1213
---
13-
1414
## ✨ Features
15-
15+
---
1616
- 🔄 **Dynamic Command Registration:** Register/unregister commands at runtime, even on Paper.
1717
- 🌳 **Sub-Commands:** Build command hierarchies with permissions and aliases.
1818
-**Tab Completion:** Context-aware suggestions with `TabBuilder`.
1919
- 🔐 **Permissions:** Wildcard and custom permission checks.
2020
- 🧑‍💻 **Fluent API:** Quickly build commands with `CommandBuilder`.
21-
22-
---
23-
24-
## 🛠️ Quick Example
25-
26-
Create and register a simple command with a sub-command:
27-
28-
```java
29-
package com.example.myplugin.command;
30-
31-
import me.croabeast.command.BukkitCommand;
32-
import me.croabeast.command.SubCommand;
33-
import me.croabeast.command.TabBuilder;
3421
import me.croabeast.command.DefaultPermissible;
3522
import org.bukkit.command.CommandSender;
3623
import org.bukkit.plugin.Plugin;
37-
import org.jetbrains.annotations.NotNull;
38-
39-
public class GreetCommand extends BukkitCommand implements DefaultPermissible {
40-
41-
/**
42-
* Constructs the GreetCommand with a reference to the owning plugin.
43-
*
44-
* @param plugin the plugin instance.
45-
*/
46-
public GreetCommand(Plugin plugin) {
47-
super(plugin, "greet");
48-
49-
// Set up the main command executable
50-
setPredicate((CommandSender sender, String[] args) -> {
51-
sender.sendMessage("Hello, " + sender.getName() + "!");
52-
return Executable.State.TRUE;
53-
});
54-
55-
// Register a sub-command "reload" with an alias "r"
56-
SubCommand reloadSub = new SubCommand(this, "reload;r");
57-
reloadSub.setPredicate((sender, args) -> {
58-
// Reload logic here
59-
sender.sendMessage("GreetCommand configuration reloaded.");
60-
return true;
61-
});
62-
addSubCommand(reloadSub);
63-
}
64-
65-
/**
66-
* Provides custom tab completion for the command.
67-
*
68-
* @param sender the command sender.
69-
* @param alias the command alias used.
70-
* @param args the arguments passed to the command.
71-
* @return a list of suggestions.
72-
*/
73-
@NotNull
74-
@Override
75-
public java.util.List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, String[] args) {
76-
// Create a simple TabBuilder for suggestions
77-
TabBuilder builder = new TabBuilder();
78-
if (args.length == 1) {
79-
// Suggest "hello" and "hi" when no sub-command is specified
80-
builder.addArgument(1, "hello");
81-
builder.addArgument(1, "hi");
82-
} else if (args.length > 1) {
83-
// Optionally, provide additional suggestions for further arguments
84-
builder.addArgument(args.length, "option1");
85-
builder.addArgument(args.length, "option2");
86-
}
87-
return builder.build(sender, args);
88-
}
89-
}
90-
```
24+
## 🛠️ Quick Example
9125

92-
#### 📝 Registering the Command
26+
Create and register a simple command with a sub-command:
9327

9428
In your plugin’s main class (extending `JavaPlugin`), register the command:
9529

@@ -171,7 +105,7 @@ Replace `${version}` with the latest version.
171105

172106
## 🎉 Happy Coding!
173107

174-
Build powerful, modern commands for your Minecraft plugin with ease!
108+
Build powerful, modern commands for your Minecraft plugin with ease!
175109
Questions? Join our [Discord](https://discord.com/invite/gzzhVqgy3b) 💬
176110

177111
*CroaBeast*

0 commit comments

Comments
 (0)