mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 22:16:34 +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.BukkitCommand;
|
||||||
import net.william278.huskhomes.command.Command;
|
import net.william278.huskhomes.command.Command;
|
||||||
import net.william278.huskhomes.command.DisabledCommand;
|
|
||||||
import net.william278.huskhomes.command.PaperCommand;
|
import net.william278.huskhomes.command.PaperCommand;
|
||||||
import net.william278.huskhomes.hook.Pl3xMapHook;
|
import net.william278.huskhomes.hook.Pl3xMapHook;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -44,15 +43,9 @@ public class PaperHuskHomes extends BukkitHuskHomes {
|
|||||||
@Override
|
@Override
|
||||||
public List<Command> registerCommands() {
|
public List<Command> registerCommands() {
|
||||||
return Arrays.stream(BukkitCommand.Type.values())
|
return Arrays.stream(BukkitCommand.Type.values())
|
||||||
.map((type) -> {
|
.map((type) -> type.createCommand(this))
|
||||||
Command command = type.createCommand(this);
|
.filter((command) -> !this.getSettings().isCommandDisabled(command))
|
||||||
if (this.getSettings().isCommandDisabled(command)) {
|
.peek((command) -> new PaperCommand(command, this).register())
|
||||||
command = new DisabledCommand(command.getName(), this);
|
|
||||||
}
|
|
||||||
new PaperCommand(command, this).register();
|
|
||||||
return command;
|
|
||||||
})
|
|
||||||
.filter((command) -> !(command instanceof DisabledCommand))
|
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user