From 6213ee5b333008b04b09982fc02a2d9bcabea37d Mon Sep 17 00:00:00 2001 From: William Date: Sun, 23 Jul 2023 18:15:24 +0100 Subject: [PATCH] Fix registering disabled commands on Paper --- .../net/william278/huskhomes/PaperHuskHomes.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/paper/src/main/java/net/william278/huskhomes/PaperHuskHomes.java b/paper/src/main/java/net/william278/huskhomes/PaperHuskHomes.java index 318ad74d..a5ca4235 100644 --- a/paper/src/main/java/net/william278/huskhomes/PaperHuskHomes.java +++ b/paper/src/main/java/net/william278/huskhomes/PaperHuskHomes.java @@ -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 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(); }