9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-30 12:29:13 +00:00

Allow Non-ASCII character in unquoted string of command argument (#274)

* Allow non-ascii character in unquoted string of command argument
This commit is contained in:
hayanesuru
2025-04-03 04:10:13 +08:00
committed by GitHub
parent 96c6601300
commit 402672a380

View File

@@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: hayanesuru <mc@jvavav.com>
Date: Tue, 1 Apr 2025 11:56:43 +0800
Subject: [PATCH] Allow non-ascii character in unquoted string of command
argument
diff --git a/com/mojang/brigadier/StringReader.java b/com/mojang/brigadier/StringReader.java
index c1465df63a48e08ec9ccd6889be4f2f8d13d7552..347fe2f719507e7bba412bcd4a45a4d78a665c62 100644
--- a/com/mojang/brigadier/StringReader.java
+++ b/com/mojang/brigadier/StringReader.java
@@ -167,11 +167,20 @@ public class StringReader implements ImmutableStringReader {
}
public static boolean isAllowedInUnquotedString(final char c) {
+ // Leaf start - Allow non-ascii character in unquoted string of command argument
+ /*
return c >= '0' && c <= '9'
|| c >= 'A' && c <= 'Z'
|| c >= 'a' && c <= 'z'
|| c == '_' || c == '-'
|| c == '.' || c == '+';
+ */
+ return c != ' ' && c != ':'
+ && c != '[' && c != ']'
+ && c != '{' && c != '}'
+ && c != ',' && c != SYNTAX_ESCAPE
+ && !isQuotedStringStart(c);
+ // Leaf end - Allow non-ascii character in unquoted string of command argument
}
public String readUnquotedString() {