mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
Fix registering disabled commands on Paper
This commit is contained in:
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();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user