Skip to content

Commit 55450f7

Browse files
committed
Added final keywords, funding.yml and updated Commons
1 parent 652a021 commit 55450f7

File tree

5 files changed

+30
-28
lines changed

5 files changed

+30
-28
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
patreon: despical

README.md renamed to .github/README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# Command Framework
22
[![](https://jitpack.io/v/Despical/CommandFramework.svg)](https://jitpack.io/#Despical/CommandFramework)
3-
[![](https://img.shields.io/badge/JavaDocs-latest-lime.svg)](https://javadoc.jitpack.io/com/github/Despical/CommandFramework/latest/javadoc/index.html)
4-
[![discord](https://img.shields.io/discord/719922452259668000.svg?color=lime&label=Discord)](https://discord.gg/Vhyy4HA)
53
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/Despical/CommandFramework/CommandFramework%20Build)
4+
[![](https://img.shields.io/badge/JavaDocs-latest-lime.svg)](https://javadoc.jitpack.io/com/github/Despical/CommandFramework/latest/javadoc/index.html)
5+
[![discord](https://img.shields.io/discord/719922452259668000.svg?color=lime&label=Discord)](https://discord.com/invite/rVkaGmyszE)
66

77
This framework is very lightweight annotation based command system that works similar to Bukkit's event system. It removes the necessity to
8-
add command to your plugin.yml but will still allow you to set command usage, description, permission, aliases, sender type, cooldown, minimum
8+
add commands to your plugin.yml but will still allow you to set command usage, description, permission, aliases, sender type, cooldown, minimum
99
and maximum argument length through the code and adds bunch of new methods to improve your code.
1010

1111
## Documentation
12-
More information can be found on the [wiki page](https://github.com/Despical/CommandFramework/wiki). The [Javadoc](https://javadoc.jitpack.io/com/github/Despical/CommandFramework/latest/javadoc/index.html) can be browsed. Questions
13-
related to the usage of Command Framework should be posted on my [Discord server](https://discord.com/invite/Vhyy4HA).
12+
More information can be found on the [wiki page](https://github.com/Despical/CommandFramework/wiki). The [Java documentations](https://javadoc.jitpack.io/com/github/Despical/CommandFramework/latest/javadoc/index.html) can be browsed. Questions
13+
related to the usage of Command Framework should be posted on my [Discord server](https://discord.com/invite/rVkaGmyszE).
14+
15+
# Donations
16+
You like the framework? Then [donate](https://www.patreon.com/despical) back me to support the development.
17+
Donations are more like motivation than money and, they are speeding up the development.
1418

1519
## Using Command Framework
1620
The project isn't in the Central Repository yet, so specifying a repository is needed.<br>
@@ -28,7 +32,7 @@ To add this project as a dependency to your project, add the following to your p
2832
<dependency>
2933
<groupId>com.github.Despical</groupId>
3034
<artifactId>CommandFramework</artifactId>
31-
<version>1.0.7</version>
35+
<version>1.0.8</version>
3236
<scope>compile</scope>
3337
</dependency>
3438
```
@@ -41,7 +45,7 @@ repositories {
4145
```
4246
```
4347
dependencies {
44-
compileOnly group: "com.github.Despical", name: "CommandFramework", version: "1.0.7";
48+
compileOnly group: "com.github.Despical", name: "CommandFramework", version: "1.0.8";
4549
}
4650
```
4751

@@ -110,18 +114,15 @@ This code is under [GPL-3.0 License](http://www.gnu.org/licenses/gpl-3.0.html)
110114

111115
See the [LICENSE](https://github.com/Despical/CommandFramework/blob/main/LICENSE) file for required notices and attributions.
112116

113-
## Donations
114-
You like the Command Framework? Then [donate](https://www.patreon.com/despical) back me to support the development.
115-
116-
## ~~Contributing~~ (No more contributing)
117+
## Contributing
117118

118119
I accept Pull Requests via GitHub. There are some guidelines which will make applying PRs easier for me:
119120
+ Ensure you didn't use tabs! Please use spaces for indentation.
120121
+ Respect the code style.
121122
+ Do not increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent.
122123
+ Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
123124

124-
You can learn more about contributing via GitHub in [contribution guidelines](CONTRIBUTING.md).
125+
You can learn more about contributing via GitHub in [contribution guidelines](../CONTRIBUTING.md).
125126

126127
## Known issues
127128
* ~~Sub-commands aren't compatible with tab completions.~~
@@ -133,6 +134,6 @@ You can learn more about contributing via GitHub in [contribution guidelines](CO
133134
If you want to build this project from source code, run the following from Git Bash:
134135
```
135136
git clone https://www.github.com/Despical/CommandFramework && cd CommandFramework
136-
mvn clean package
137+
mvn clean package -Dmaven.javadoc.skip=true
137138
```
138139
Also don't forget to install Maven before building.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Contributing
22

33
When contributing to this repository, please first discuss the change you wish to make via [issue](https://github.com/Despical/CommandFramework/issues/new),
4-
or [Discord](https://discord.com/invite/Vhyy4HA) with the owner of this repository before making a change.
4+
or [Discord](https://discord.com/invite/rVkaGmyszE) with the owner of this repository before making a change.
55

66
Please note we have a code of conduct, please follow it in all your interactions with the project.
77

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>me.despical</groupId>
55
<artifactId>command-framework</artifactId>
6-
<version>1.0.7</version>
6+
<version>1.0.8</version>
77

88
<properties>
99
<java.version>8</java.version>
@@ -48,7 +48,7 @@
4848
<dependency>
4949
<groupId>com.github.Despical</groupId>
5050
<artifactId>Commons</artifactId>
51-
<version>1.3.9</version>
51+
<version>1.5.3</version>
5252
<scope>compile</scope>
5353
</dependency>
5454
</dependencies>

src/main/java/me/despical/commandframework/CommandFramework.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ public CommandFramework(@NotNull Plugin plugin) {
8383
this.plugin = plugin;
8484

8585
if (plugin.getServer().getPluginManager() instanceof SimplePluginManager) {
86-
SimplePluginManager manager = (SimplePluginManager) plugin.getServer().getPluginManager();
86+
final SimplePluginManager manager = (SimplePluginManager) plugin.getServer().getPluginManager();
8787

8888
try {
89-
Field field = SimplePluginManager.class.getDeclaredField("commandMap");
89+
final Field field = SimplePluginManager.class.getDeclaredField("commandMap");
9090
field.setAccessible(true);
9191

9292
commandMap = (CommandMap) field.get(manager);
@@ -112,7 +112,7 @@ public void setAnyMatch(@NotNull Consumer<CommandArguments> anyMatchConsumer) {
112112
*/
113113
public void registerCommands(@NotNull Object instance) {
114114
for (Method method : instance.getClass().getMethods()) {
115-
Command command = method.getAnnotation(Command.class);
115+
final Command command = method.getAnnotation(Command.class);
116116

117117
if (command != null) {
118118
if (method.getParameterTypes().length > 0 && method.getParameterTypes()[0] != CommandArguments.class) {
@@ -137,12 +137,12 @@ private void registerCommand(Command command, Method method, Object instance) {
137137
commands.put(command, me.despical.commons.util.Collections.mapEntry(method, instance));
138138

139139
try {
140-
Constructor<PluginCommand> constructor = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
140+
final Constructor<PluginCommand> constructor = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
141141
constructor.setAccessible(true);
142142

143-
String splittedCommand = command.name().split("\\.")[0];
143+
final String splittedCommand = command.name().split("\\.")[0];
144144

145-
PluginCommand pluginCommand = constructor.newInstance(splittedCommand, plugin);
145+
final PluginCommand pluginCommand = constructor.newInstance(splittedCommand, plugin);
146146
pluginCommand.setTabCompleter(this);
147147
pluginCommand.setExecutor(this);
148148
pluginCommand.setUsage(command.usage());
@@ -167,9 +167,9 @@ private void registerCommand(Command command, Method method, Object instance) {
167167
@Override
168168
public boolean onCommand(@NotNull CommandSender sender, @NotNull org.bukkit.command.Command cmd, @NotNull String label, String[] args) {
169169
for (Map.Entry<Command, Map.Entry<Method, Object>> entry : commands.entrySet()) {
170-
Command command = entry.getKey();
171-
String splitted[] = command.name().split("\\."), allArgs = args.length == 0 ? "" : String.join(".", Arrays.copyOfRange(args, 0, splitted.length - 1));
172-
String cmdName = (command.name().contains(".") ? splitted[0] : cmd.getName()) + (splitted.length == 1 && allArgs.isEmpty() ? "" : "." + allArgs);
170+
final Command command = entry.getKey();
171+
final String splitted[] = command.name().split("\\."), allArgs = args.length == 0 ? "" : String.join(".", Arrays.copyOfRange(args, 0, splitted.length - 1));
172+
final String cmdName = (command.name().contains(".") ? splitted[0] : cmd.getName()) + (splitted.length == 1 && allArgs.isEmpty() ? "" : "." + allArgs);
173173

174174
if (command.name().equalsIgnoreCase(cmdName) || Stream.of(command.aliases()).anyMatch(cmdName::equalsIgnoreCase)) {
175175
if (!sender.hasPermission(command.permission())) {
@@ -198,7 +198,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull org.bukkit.comm
198198
cooldowns.put(sender, System.currentTimeMillis());
199199
}
200200

201-
String[] newArgs = Arrays.copyOfRange(args, splitted.length - 1, args.length);
201+
final String[] newArgs = Arrays.copyOfRange(args, splitted.length - 1, args.length);
202202

203203
if (args.length >= command.min() + splitted.length - 1 && newArgs.length <= (command.max() == -1 ? newArgs.length + 1 : command.max())) {
204204
try {
@@ -226,11 +226,11 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull org.bukkit.comm
226226
@Override
227227
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull org.bukkit.command.Command command, @NotNull String label, String[] args) {
228228
for (Map.Entry<Completer, Map.Entry<Method, Object>> entry : completions.entrySet()) {
229-
Completer completer = entry.getKey();
229+
final Completer completer = entry.getKey();
230230

231231
if (command.getName().equalsIgnoreCase(completer.name()) || Stream.of(completer.aliases()).anyMatch(command.getName()::equalsIgnoreCase)) {
232232
try {
233-
Object instance = entry.getValue().getKey().invoke(entry.getValue().getValue(), new CommandArguments(sender, command, label, args));
233+
final Object instance = entry.getValue().getKey().invoke(entry.getValue().getValue(), new CommandArguments(sender, command, label, args));
234234

235235
return (List<String>) instance;
236236
} catch (IllegalAccessException | InvocationTargetException e) {

0 commit comments

Comments
 (0)