Fix registering disabled commands on Paper

This commit is contained in:
William committed 2023-07-23 18:15:24 +01:00
1 parent 82e38fe78e
commit 6213ee5b33
1 file changed
+3 -10
@@ -21,7 +21,6 @@ package net.william278.huskhomes;
import net.william278.huskhomes.command.BukkitCommand;
import net.william278.huskhomes.command.Command;
import net.william278.huskhomes.command.DisabledCommand;
import net.william278.huskhomes.command.PaperCommand;
import net.william278.huskhomes.hook.Pl3xMapHook;
import org.jetbrains.annotations.NotNull;
@@ -44,15 +43,9 @@ public class PaperHuskHomes extends BukkitHuskHomes {
@Override
public List<Command> registerCommands() {
return Arrays.stream(BukkitCommand.Type.values())
.map((type) -> {
Command command = type.createCommand(this);
if (this.getSettings().isCommandDisabled(command)) {
command = new DisabledCommand(command.getName(), this);
}
new PaperCommand(command, this).register();
return command;
})
.filter((command) -> !(command instanceof DisabledCommand))
.map((type) -> type.createCommand(this))
.filter((command) -> !this.getSettings().isCommandDisabled(command))
.peek((command) -> new PaperCommand(command, this).register())
.toList();
}