Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite FormattedComponentArgument to use markdown #673

Merged
merged 4 commits into from
Nov 26, 2024
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
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ dependencies {

testImplementation "net.fabricmc:fabric-loader-junit:${project.loader_version}"
testImplementation "org.junit.jupiter:junit-jupiter:${project.junit_version}"
testImplementation "com.code-intelligence:jazzer-junit:${project.jazzer_junit_version}"
}

test {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ org.gradle.jvmargs=-Xmx2G
seedfinding_seed_version=1.171.2
latticg_version=1.07

jazzer_junit_version=0.22.1
junit_version=5.11.3
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.network.chat.MutableComponent;

import static net.earthcomputer.clientcommands.command.arguments.FormattedComponentArgument.*;
import static net.earthcomputer.clientcommands.command.arguments.ExtendedMarkdownArgument.*;
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.*;

public class NoteCommand {

public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher) {
dispatcher.register(literal("cnote")
.then(argument("message", formattedComponent())
.executes(ctx -> note(ctx.getSource(), getFormattedComponent(ctx, "message")))));
.then(argument("message", extendedMarkdown())
.executes(ctx -> note(ctx.getSource(), getExtendedMarkdown(ctx, "message")))));
}

private static int note(FabricClientCommandSource source, MutableComponent message) {
Expand Down

Large diffs are not rendered by default.

This file was deleted.

1 change: 1 addition & 0 deletions src/main/resources/assets/clientcommands/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@

"commands.client.blockpos": "(%s, %s, %s)",
"commands.client.cancel": "Cancel",
"commands.client.componentTooDeeplyNested": "Chat component too deeply nested",
"commands.client.crack": "Crack",
"commands.client.enable": "Enable",
"commands.client.expectedRegex": "Invalid regex %s",
Expand Down
Loading