From 67a73b6ea3e46194f45dc7c4a4ee2f22c1349d87 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 26 Jul 2025 07:47:39 +0700 Subject: [PATCH] fix: disallow `-` in snbt without quotes (found out by `*mail read` didn't work) --- .../java/me/chayapak1/chomens_bot/util/SNBTUtilities.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/chayapak1/chomens_bot/util/SNBTUtilities.java b/src/main/java/me/chayapak1/chomens_bot/util/SNBTUtilities.java index 15ed7281..3dc3545c 100644 --- a/src/main/java/me/chayapak1/chomens_bot/util/SNBTUtilities.java +++ b/src/main/java/me/chayapak1/chomens_bot/util/SNBTUtilities.java @@ -106,7 +106,7 @@ public class SNBTUtilities { // don't wrap the string with quotes when not needed // like {abc:def} instead of {abc:'def'} - // or some Advanced ones like `abc123.among.us__69` will also return false + // or some Advanced ones like `abc123.among--.--us__69` will also return false public static boolean needQuotes (final String string) { if ( string == null @@ -120,8 +120,8 @@ public class SNBTUtilities { final char firstChar = string.charAt(0); - // cannot start with digit, '.', or '+' - if (Character.isDigit(firstChar) || firstChar == '.' || firstChar == '+') { + // cannot start with 0-9, '-', '.', or '+' + if (Character.isDigit(firstChar) || firstChar == '.' || firstChar == '-' || firstChar == '+') { return true; }