Update the Bukkit adapter to the Spigot API Preview

This commit is contained in:
Matthew Miller
2018-07-12 22:23:03 +10:00
parent 724661d903
commit ca06a05117
29 changed files with 139 additions and 650 deletions

View File

@ -82,7 +82,7 @@ public class CommandRegistration {
public boolean unregisterCommands() {
CommandMap commandMap = getCommandMap();
List<String> toRemove = new ArrayList<String>();
List<String> toRemove = new ArrayList<>();
Map<String, org.bukkit.command.Command> knownCommands = ReflectionUtil.getField(commandMap, "knownCommands");
Set<String> aliases = ReflectionUtil.getField(commandMap, "aliases");
if (knownCommands == null || aliases == null) {

View File

@ -50,7 +50,7 @@ public class CommandsManagerRegistration extends CommandRegistration {
}
public boolean registerAll(List<Command> registered) {
List<CommandInfo> toRegister = new ArrayList<CommandInfo>();
List<CommandInfo> toRegister = new ArrayList<>();
for (Command command : registered) {
List<String> permissions = null;
Method cmdMethod = commands.getMethods().get(null).get(command.aliases()[0]);
@ -59,7 +59,7 @@ public class CommandsManagerRegistration extends CommandRegistration {
if (cmdMethod != null && cmdMethod.isAnnotationPresent(CommandPermissions.class)) {
permissions = Arrays.asList(cmdMethod.getAnnotation(CommandPermissions.class).value());
} else if (cmdMethod != null && childMethods != null && !childMethods.isEmpty()) {
permissions = new ArrayList<String>();
permissions = new ArrayList<>();
for (Method m : childMethods.values()) {
if (m.isAnnotationPresent(CommandPermissions.class)) {
permissions.addAll(Arrays.asList(m.getAnnotation(CommandPermissions.class).value()));