diff --git a/bukkit/src/main/java/net/william278/uniform/bukkit/BukkitCommand.java b/bukkit/src/main/java/net/william278/uniform/bukkit/BukkitCommand.java index 75ca8d6..67b4557 100644 --- a/bukkit/src/main/java/net/william278/uniform/bukkit/BukkitCommand.java +++ b/bukkit/src/main/java/net/william278/uniform/bukkit/BukkitCommand.java @@ -46,6 +46,11 @@ public class BukkitCommand extends BaseCommand { super(command); } + private BukkitCommand(@NotNull Command command, @NotNull Uniform uniform) { + super(command); + this.uniform = uniform; + } + public BukkitCommand(@NotNull String name, @NotNull String description, @NotNull List aliases) { super(name, description, aliases); } @@ -117,7 +122,7 @@ public class BukkitCommand extends BaseCommand { @Override public void addSubCommand(@NotNull Command command) { - addSubCommand(new BukkitCommand(command)); + addSubCommand(new BukkitCommand(command, uniform)); } } diff --git a/common/src/main/java/net/william278/uniform/BaseCommand.java b/common/src/main/java/net/william278/uniform/BaseCommand.java index fec0a34..7d3d9ef 100644 --- a/common/src/main/java/net/william278/uniform/BaseCommand.java +++ b/common/src/main/java/net/william278/uniform/BaseCommand.java @@ -43,14 +43,14 @@ public abstract class BaseCommand { private final String name; private final String description; private final List aliases; + private final List> syntaxes = new ArrayList<>(); + private final List> subCommands = new ArrayList<>(); @Nullable private Predicate condition; @Nullable private CommandExecutor defaultExecutor; - private Uniform uniform; - private final List> syntaxes = new ArrayList<>(); - private final List> subCommands = new ArrayList<>(); + protected Uniform uniform; public BaseCommand(@NotNull Command command) { this.name = command.getName(); diff --git a/fabric-1.20.1/src/main/java/net/william278/uniform/fabric/FabricCommand.java b/fabric-1.20.1/src/main/java/net/william278/uniform/fabric/FabricCommand.java index 185a329..bce5e84 100644 --- a/fabric-1.20.1/src/main/java/net/william278/uniform/fabric/FabricCommand.java +++ b/fabric-1.20.1/src/main/java/net/william278/uniform/fabric/FabricCommand.java @@ -31,6 +31,7 @@ import net.minecraft.util.Identifier; import net.minecraft.util.InvalidIdentifierException; import net.william278.uniform.BaseCommand; import net.william278.uniform.Command; +import net.william278.uniform.Uniform; import net.william278.uniform.element.ArgumentElement; import org.jetbrains.annotations.NotNull; @@ -43,6 +44,11 @@ public class FabricCommand extends BaseCommand { super(command); } + private FabricCommand(@NotNull Command command, @NotNull Uniform uniform) { + super(command); + this.uniform = uniform; + } + public FabricCommand(@NotNull String name, @NotNull List aliases) { super(name, aliases); } @@ -80,6 +86,6 @@ public class FabricCommand extends BaseCommand { @Override public void addSubCommand(@NotNull Command command) { - addSubCommand(new FabricCommand(command)); + addSubCommand(new FabricCommand(command, getUniform())); } } diff --git a/fabric-1.20.6/src/main/java/net/william278/uniform/fabric/FabricCommand.java b/fabric-1.20.6/src/main/java/net/william278/uniform/fabric/FabricCommand.java index 96e967f..b58a568 100644 --- a/fabric-1.20.6/src/main/java/net/william278/uniform/fabric/FabricCommand.java +++ b/fabric-1.20.6/src/main/java/net/william278/uniform/fabric/FabricCommand.java @@ -31,6 +31,7 @@ import net.minecraft.util.Identifier; import net.minecraft.util.InvalidIdentifierException; import net.william278.uniform.BaseCommand; import net.william278.uniform.Command; +import net.william278.uniform.Uniform; import net.william278.uniform.element.ArgumentElement; import org.jetbrains.annotations.NotNull; @@ -43,6 +44,11 @@ public class FabricCommand extends BaseCommand { super(command); } + private FabricCommand(@NotNull Command command, @NotNull Uniform uniform) { + super(command); + this.uniform = uniform; + } + public FabricCommand(@NotNull String name, @NotNull List aliases) { super(name, aliases); } @@ -81,6 +87,6 @@ public class FabricCommand extends BaseCommand { @Override public void addSubCommand(@NotNull Command command) { - addSubCommand(new FabricCommand(command)); + addSubCommand(new FabricCommand(command, getUniform())); } } diff --git a/gradle.properties b/gradle.properties index 301469a..3907cde 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,6 @@ javaVersion=17 org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.daemon=true -library_version=1.0 +library_version=1.0.1 library_archive=uniform library_description=Cross-platform wrapper for making Brigadier commands, based on BrigadierWrapper by Tofaa2, itself inspired by emortalmcs command system. \ No newline at end of file diff --git a/paper/src/main/java/net/william278/uniform/paper/LegacyPaperCommand.java b/paper/src/main/java/net/william278/uniform/paper/LegacyPaperCommand.java index 61267a8..090459d 100644 --- a/paper/src/main/java/net/william278/uniform/paper/LegacyPaperCommand.java +++ b/paper/src/main/java/net/william278/uniform/paper/LegacyPaperCommand.java @@ -30,6 +30,7 @@ import lombok.AllArgsConstructor; import net.william278.uniform.BaseCommand; import net.william278.uniform.Command; import net.william278.uniform.CommandUser; +import net.william278.uniform.Uniform; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; @@ -51,6 +52,11 @@ public class LegacyPaperCommand extends BaseCommand aliases) { super(name, aliases); } @@ -61,7 +67,7 @@ public class LegacyPaperCommand extends BaseCommand { super(command); } + private PaperCommand(@NotNull Command command, @NotNull Uniform uniform) { + super(command); + this.uniform = uniform; + } + + public PaperCommand(@NotNull String name, @NotNull List aliases) { super(name, aliases); } @@ -109,7 +116,7 @@ public class PaperCommand extends BaseCommand { @Override public void addSubCommand(@NotNull Command command) { - addSubCommand(new PaperCommand(command)); + addSubCommand(new PaperCommand(command, getUniform())); } } diff --git a/velocity/src/main/java/net/william278/uniform/velocity/VelocityCommand.java b/velocity/src/main/java/net/william278/uniform/velocity/VelocityCommand.java index af47b8b..673b5ec 100644 --- a/velocity/src/main/java/net/william278/uniform/velocity/VelocityCommand.java +++ b/velocity/src/main/java/net/william278/uniform/velocity/VelocityCommand.java @@ -30,6 +30,7 @@ import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.server.RegisteredServer; import net.william278.uniform.BaseCommand; import net.william278.uniform.Command; +import net.william278.uniform.Uniform; import net.william278.uniform.element.ArgumentElement; import org.jetbrains.annotations.NotNull; @@ -42,6 +43,11 @@ public class VelocityCommand extends BaseCommand { super(command); } + private VelocityCommand(@NotNull Command command, @NotNull Uniform uniform) { + super(command); + this.uniform = uniform; + } + public VelocityCommand(@NotNull String name, @NotNull List aliases) { super(name, aliases); } @@ -97,7 +103,7 @@ public class VelocityCommand extends BaseCommand { @Override public void addSubCommand(@NotNull Command command) { - addSubCommand(new VelocityCommand(command)); + addSubCommand(new VelocityCommand(command, getUniform())); } }