diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index a7d27daa..9ba4a6fa 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -12,10 +12,6 @@ load: STARTUP # when they check for the presence of a service provider, before LuckPerms has enabled. loadbefore: [Vault] -# These are all soft dependencies for the migration feature. We check to see if these plugins are enabled -# when setting up LuckPerms commands. That way, commands only appear if the corresponding plugin is loaded. -softdepend: [PermissionsEx, GroupManager, PowerfulPerms, zPermissions, bPermissions] - commands: luckperms: description: Manage permissions diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/MainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/MainCommand.java index 3685877d..39b833c5 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/MainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/MainCommand.java @@ -23,7 +23,6 @@ package me.lucko.luckperms.common.commands; import lombok.Getter; -import lombok.NonNull; import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.Util; @@ -42,7 +41,7 @@ public abstract class MainCommand extends BaseCommand { private final String usage; private final int minArgs; // equals 1 if the command doesn't take a mid argument, e.g. /lp user sub-command.... - public MainCommand(String name, String description, String usage, int minArgs, @NonNull List> children) { + public MainCommand(String name, String description, String usage, int minArgs, List> children) { super(name, description, null, Predicates.alwaysFalse(), null, children); this.usage = usage; this.minArgs = minArgs; @@ -85,7 +84,6 @@ public abstract class MainCommand extends BaseCommand { T t = getTarget(name, plugin, sender); if (t != null) { CommandResult result; - try { result = sub.execute(plugin, sender, t, strippedArgs, label); } catch (CommandException e) { diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/migration/MigrationMainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/migration/MigrationMainCommand.java index 531b5268..a378b55c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/migration/MigrationMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/migration/MigrationMainCommand.java @@ -22,7 +22,6 @@ package me.lucko.luckperms.common.commands.migration; -import com.google.common.collect.ImmutableList; import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.sender.Sender; @@ -32,13 +31,17 @@ import me.lucko.luckperms.common.constants.Message; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; public class MigrationMainCommand extends MainCommand { + private List> commands = null; + public MigrationMainCommand() { - super("Migration", "Migration commands", "/%s migration", 1, ImmutableList.copyOf(getAvailableCommands())); + super("Migration", "Migration commands", "/%s migration", 1, null); } + @SuppressWarnings("unchecked") private static List> getAvailableCommands() { List> l = new ArrayList<>(); @@ -85,6 +88,22 @@ public class MigrationMainCommand extends MainCommand { return l.stream().collect(Collectors.toList()); } + @SuppressWarnings("deprecation") + @Deprecated + @Override + public synchronized Optional>> getChildren() { + if (commands == null) { + commands = getAvailableCommands(); + } + + return Optional.of(commands); + } + + @SuppressWarnings("deprecation") + public List> getSubCommands() { + return getChildren().orElse(null); + } + @Override public boolean isAuthorized(Sender sender) { return sender.getUuid().equals(Constants.getConsoleUUID()); @@ -106,8 +125,8 @@ public class MigrationMainCommand extends MainCommand { } @Override - protected Void getTarget(String target, LuckPermsPlugin plugin, Sender sender) { - return null; + protected Object getTarget(String target, LuckPermsPlugin plugin, Sender sender) { + return new Object(); } @Override