Skip to content

Commit b9290bc

Browse files
committed
cleanup
1 parent 2adda3d commit b9290bc

File tree

5 files changed

+17
-27
lines changed

5 files changed

+17
-27
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
<groupId>lol.hyper</groupId>
112112
<artifactId>github-release-api</artifactId>
113113
<version>1.0.1</version>
114+
<scope>provided</scope>
114115
</dependency>
115116
</dependencies>
116117
</project>

src/main/java/lol/hyper/anarchystats/commands/CommandInfo.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.bukkit.ChatColor;
2424
import org.bukkit.command.Command;
2525
import org.bukkit.command.CommandSender;
26+
import org.jetbrains.annotations.NotNull;
2627

2728
public class CommandInfo extends AbstractCommand {
2829

@@ -34,7 +35,7 @@ public CommandInfo(String command, AnarchyStats anarchyStats) {
3435
}
3536

3637
@Override
37-
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
38+
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
3839
if (anarchyStats.config.getBoolean("use-permission-node")) {
3940
if (!sender.hasPermission(anarchyStats.config.getString("permission-node"))) {
4041
sender.sendMessage(ChatColor.RED + "You don't have permission for this command.");

src/main/java/lol/hyper/anarchystats/commands/CommandReload.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.bukkit.command.Command;
2323
import org.bukkit.command.CommandSender;
2424
import org.bukkit.command.TabExecutor;
25+
import org.jetbrains.annotations.NotNull;
2526

2627
import java.util.Collections;
2728
import java.util.List;
@@ -35,7 +36,7 @@ public CommandReload(AnarchyStats anarchyStats) {
3536
}
3637

3738
@Override
38-
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
39+
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
3940
if (args.length == 0) {
4041
sender.sendMessage(ChatColor.GREEN + "AnarchyStats version "
4142
+ anarchyStats.getDescription().getVersion() + ". Created by hyperdefined.");
@@ -54,7 +55,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
5455
}
5556

5657
@Override
57-
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
58+
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
5859
return Collections.singletonList("reload");
5960
}
6061
}

src/main/java/lol/hyper/anarchystats/tools/AbstractCommand.java

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import org.bukkit.Bukkit;
2828
import org.bukkit.command.*;
29+
import org.jetbrains.annotations.NotNull;
2930

3031
import java.lang.reflect.Field;
3132
import java.util.List;
@@ -48,22 +49,6 @@ public AbstractCommand(String command) {
4849
this(command, null, null, null, null);
4950
}
5051

51-
public AbstractCommand(String command, String usage) {
52-
this(command, usage, null, null, null);
53-
}
54-
55-
public AbstractCommand(String command, String usage, String description) {
56-
this(command, usage, description, null, null);
57-
}
58-
59-
public AbstractCommand(String command, String usage, String description, String permissionMessage) {
60-
this(command, usage, description, permissionMessage, null);
61-
}
62-
63-
public AbstractCommand(String command, String usage, String description, List<String> aliases) {
64-
this(command, usage, description, null, aliases);
65-
}
66-
6752
public AbstractCommand(
6853
String command, String usage, String description, String permissionMessage, List<String> aliases) {
6954
this.command = command.toLowerCase();
@@ -93,22 +78,22 @@ final CommandMap getCommandMap() {
9378
} catch (Exception e) {
9479
e.printStackTrace();
9580
}
96-
} else if (cmap != null) {
81+
} else {
9782
return cmap;
9883
}
9984
return getCommandMap();
10085
}
10186

102-
public abstract boolean onCommand(CommandSender sender, Command cmd, String label, String[] args);
87+
public abstract boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args);
10388

104-
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
89+
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
10590
return null;
10691
}
10792

108-
private final class ReflectCommand extends Command {
93+
private static final class ReflectCommand extends Command {
10994
private AbstractCommand exe = null;
11095

111-
protected ReflectCommand(String command) {
96+
private ReflectCommand(String command) {
11297
super(command);
11398
}
11499

@@ -117,15 +102,15 @@ public void setExecutor(AbstractCommand exe) {
117102
}
118103

119104
@Override
120-
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
105+
public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, String[] args) {
121106
if (exe != null) {
122107
return exe.onCommand(sender, this, commandLabel, args);
123108
}
124109
return false;
125110
}
126111

127112
@Override
128-
public List<String> tabComplete(CommandSender sender, String alais, String[] args) {
113+
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alais, String[] args) {
129114
if (exe != null) {
130115
return exe.onTabComplete(sender, this, alais, args);
131116
}

src/main/resources/plugin.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ permissions:
1212
description: Allows the usage of /anarchystats reload
1313
commands:
1414
anarchystats:
15-
usage: /anarchystats
15+
usage: /anarchystats
16+
libraries:
17+
- lol.hyper:github-release-api:1.0.1

0 commit comments

Comments
 (0)