Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.11-SNAPSHOT'
id 'maven-publish'
id 'io.github.juuxel.loom-quiltflower' version '1.10.0'
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

base {
archivesName = "command-aliases"
}

archivesBaseName = project.archives_base_name
version = "${project.mod_version}+mc${project.minecraft_version}-${getVersionMetadata()}"
group = project.maven_group

Expand Down Expand Up @@ -39,7 +45,7 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Permissions API
include(modImplementation("me.lucko:fabric-permissions-api:0.3.1"))
include(modImplementation("me.lucko:fabric-permissions-api:0.3.3"))

// LevelDB
include(implementation("org.iq80.leveldb:leveldb:0.12"))
Expand All @@ -61,10 +67,10 @@ dependencies {
include(implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.1"))

// Math Evaluator
include(implementation("com.fathzer:javaluator:3.0.3"))
include(implementation("com.fathzer:javaluator:3.0.6"))

// Placeholders API
modImplementation include("eu.pb4:placeholder-api:2.4.0-pre.2+1.21")
modImplementation include("eu.pb4:placeholder-api:2.6.4+1.21.5")

//modRuntimeOnly "maven.modrinth:lazydfu:0.1.3"
//modRuntimeOnly "maven.modrinth:sodium:mc1.19-0.4.2"
Expand Down Expand Up @@ -100,7 +106,7 @@ jar {
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = project.archives_base_name
artifactId = project.base.archivesName.get()
from components.java
}
}
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx2G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.15.11
minecraft_version=1.21.5
yarn_mappings=1.21.5+build.1
loader_version=0.17.2

# Mod Properties
mod_version = 1.0.1
Expand All @@ -14,4 +14,4 @@ org.gradle.jvmargs=-Xmx2G

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.100.1+1.21
fabric_version=0.128.2+1.21.5
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginManagement {
repositories {
jcenter()
mavenCentral()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public ClientCustomCommandBuilder(String filePath, CustomCommand commandAliasPar
protected int dispatcherExecute(CustomCommandAction action, CommandDispatcher<FabricClientCommandSource> dispatcher, CommandContext<FabricClientCommandSource> context, String actionCommand) throws CommandSyntaxException {
int state = 0;
if (action.getCommandType() == CommandType.CLIENT) {
context.getSource().getPlayer().sendMessage(Text.literal("/" + actionCommand));
context.getSource().getPlayer().sendMessage(Text.literal("/" + actionCommand), false);
state = Command.SINGLE_SUCCESS;
} else if (action.getCommandType() == CommandType.SERVER) {
state = Objects.requireNonNull(context.getSource().getWorld().getServer()).getCommandManager().getDispatcher().execute(actionCommand, Objects.requireNonNull(context.getSource().getWorld().getServer()).getCommandSource());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,20 @@ private LiteralArgumentBuilder<S> parseCommand(RedirectCommand cmd, CommandDispa
commandBuilder = this.literal(literal).then(commandBuilder);
} else {
if (this.command.getCommandMode() == CommandMode.COMMAND_REDIRECT) {
commandBuilder = this.literal(literal).redirect(redirect);
LiteralArgumentBuilder<S> builder = this.literal(literal)
.executes(context -> dispatcher.execute(redirectTo, context.getSource()));

// Copy children from redirect node to maintain tab completion
redirect.getChildren().forEach(child -> builder.then(child.createBuilder().executes(context -> {
String input = context.getInput();
String args = input.substring(input.indexOf(' ') + 1);
String fullCommand = redirectTo + " " + args;
return dispatcher.execute(fullCommand, context.getSource());
})));

commandBuilder = builder;
} else if (this.command.getCommandMode() == CommandMode.COMMAND_REDIRECT_NOARG) {
commandBuilder = this.literal(literal).executes(redirect.getCommand());
commandBuilder = this.literal(literal).executes(context -> dispatcher.execute(redirectTo, context.getSource()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
import com.mojang.brigadier.context.ParsedArgument;
import com.mojang.brigadier.context.StringRange;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import net.minecraft.SharedConstants;
import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.command.argument.*;
import net.minecraft.command.argument.serialize.ConstantArgumentSerializer;
import net.minecraft.registry.RegistryKeys;

import java.lang.reflect.Field;
Expand Down Expand Up @@ -107,11 +105,6 @@ private void registerArgumentTypes(CommandRegistryAccess registryAccess) {
this.argumentMap.put("minecraft:template_mirror", BlockMirrorArgumentType.blockMirror());
this.argumentMap.put("minecraft:template_rotation", BlockRotationArgumentType.blockRotation());

if (SharedConstants.isDevelopment) {
this.argumentMap.put("minecraft:test_argument", TestFunctionArgumentType.testFunction());
this.argumentMap.put("minecraft:test_class", TestClassArgumentType.testClass());
}

this.argumentMap.put("minecraft:uuid", UuidArgumentType.uuid());

this.argumentMap.put("brigadier:bool", BoolArgumentType.bool());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URI;
import java.nio.file.Path;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
Expand Down Expand Up @@ -127,7 +128,7 @@ protected void registerCommandAliasesCommands(CommandDispatcher<S> dispatcher, C
.append(Text.literal(" v" + modContainer.getMetadata().getVersion()).formatted(Formatting.RED))
.formatted(Formatting.RESET)
.append(Text.literal(", "))
.append(Text.literal("Click here to visit the wiki.").formatted(Formatting.UNDERLINE, Formatting.AQUA).styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://wiki.commandaliases.flashyreese.me/"))))
.append(Text.literal("Click here to visit the wiki.").formatted(Formatting.UNDERLINE, Formatting.AQUA).styled(style -> style.withClickEvent(new ClickEvent.OpenUrl(URI.create("https://wiki.commandaliases.flashyreese.me/")))))
));

return Command.SINGLE_SUCCESS;
Expand Down Expand Up @@ -470,11 +471,11 @@ private TreeNode<File> createDirectoryTree(File directory) {

public String loadAndRenderDirectoryTree(TreeNode<File> tree, Map<String, CommandAlias> commandAliases) {
List<StringBuilder> lines = loadAndRenderDirectoryTreeLines(tree, commandAliases);
String newline = System.getProperty("line.separator");
String newline = System.lineSeparator();
StringBuilder sb = new StringBuilder();
for (StringBuilder line : lines) {
sb.append(line);
if (lines.get(lines.size() - 1) != line) {
if (lines.getLast() != line) {
sb.append(newline);
}
}
Expand Down Expand Up @@ -587,4 +588,4 @@ public Scheduler getScheduler() {
public void setScheduler(Scheduler scheduler) {
this.scheduler = scheduler;
}
}
}
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"commandaliases.mixins.json"
],
"depends": {
"fabricloader": ">=0.15",
"fabricloader": ">=0.17.2",
"fabric": "*",
"minecraft": ">=1.21"
"minecraft": ">=1.21.5"
}
}