From 2dde13e442924adf2836489fa79ad4d418ece9ce Mon Sep 17 00:00:00 2001 From: Eren KARA Date: Sat, 12 Oct 2024 23:53:24 +0300 Subject: [PATCH 1/5] fix entry casing --- .../org/skriptlang/skript/lang/entry/KeyValueEntryData.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java b/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java index 964b3ae76b3..9c7505e200a 100644 --- a/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java +++ b/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java @@ -24,6 +24,8 @@ import org.skriptlang.skript.lang.entry.EntryValidator.EntryValidatorBuilder; import org.eclipse.jdt.annotation.Nullable; +import java.util.Locale; + /** * An entry based on {@link SimpleNode}s containing a key and a value. * Unlike a traditional {@link ch.njol.skript.config.EntryNode}, this entry data @@ -82,7 +84,7 @@ public boolean canCreateWith(Node node) { String key = node.getKey(); if (key == null) return false; - key = ScriptLoader.replaceOptions(key); + key = ScriptLoader.replaceOptions(key).toLowerCase(Locale.ENGLISH); return key.startsWith(getKey() + getSeparator()); } From 2bb5441ed9c594b6c50cf68d800fd07dfd4f19df Mon Sep 17 00:00:00 2001 From: Eren <67760502+erenkarakal@users.noreply.github.com> Date: Sun, 13 Oct 2024 00:31:27 +0300 Subject: [PATCH 2/5] lowercase seperator as well Co-authored-by: _tud <98935832+UnderscoreTud@users.noreply.github.com> --- .../org/skriptlang/skript/lang/entry/KeyValueEntryData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java b/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java index 5d0e7a8877c..e23a26d16e4 100644 --- a/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java +++ b/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java @@ -85,7 +85,7 @@ public boolean canCreateWith(Node node) { if (key == null) return false; key = ScriptLoader.replaceOptions(key).toLowerCase(Locale.ENGLISH); - return key.startsWith(getKey() + getSeparator()); + return key.startsWith((getKey() + getSeparator()).toLowerCase(Locale.ENGLISH)); } } From f33ff56f80dabbe58f6dd722444dfc302b40b656 Mon Sep 17 00:00:00 2001 From: Eren KARA Date: Tue, 29 Oct 2024 16:47:22 +0300 Subject: [PATCH 3/5] use regionMatches instead --- .../skriptlang/skript/lang/entry/KeyValueEntryData.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java b/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java index 9c7505e200a..d23310ff73e 100644 --- a/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java +++ b/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java @@ -24,8 +24,6 @@ import org.skriptlang.skript.lang.entry.EntryValidator.EntryValidatorBuilder; import org.eclipse.jdt.annotation.Nullable; -import java.util.Locale; - /** * An entry based on {@link SimpleNode}s containing a key and a value. * Unlike a traditional {@link ch.njol.skript.config.EntryNode}, this entry data @@ -84,8 +82,9 @@ public boolean canCreateWith(Node node) { String key = node.getKey(); if (key == null) return false; - key = ScriptLoader.replaceOptions(key).toLowerCase(Locale.ENGLISH); - return key.startsWith(getKey() + getSeparator()); + key = ScriptLoader.replaceOptions(key); + String prefix = getKey() + getSeparator(); + return key.regionMatches(true, 0, prefix, 0, prefix.length()); } } From 1558e1e4b86f702730da4191b6a77399acce748b Mon Sep 17 00:00:00 2001 From: Eren KARA Date: Tue, 29 Oct 2024 16:53:57 +0300 Subject: [PATCH 4/5] use regionMatches instead --- .../org/skriptlang/skript/lang/entry/KeyValueEntryData.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java b/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java index e23a26d16e4..d2caf5bf9c7 100644 --- a/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java +++ b/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java @@ -84,8 +84,9 @@ public boolean canCreateWith(Node node) { String key = node.getKey(); if (key == null) return false; - key = ScriptLoader.replaceOptions(key).toLowerCase(Locale.ENGLISH); - return key.startsWith((getKey() + getSeparator()).toLowerCase(Locale.ENGLISH)); + key = ScriptLoader.replaceOptions(key); + String prefix = getKey() + getSeparator(); + return key.regionMatches(true, 0, prefix, 0, prefix.length()); } } From eb75c83bdf867032191aa196d4e1653a6e317d14 Mon Sep 17 00:00:00 2001 From: Eren KARA Date: Tue, 29 Oct 2024 16:54:33 +0300 Subject: [PATCH 5/5] remove import --- .../org/skriptlang/skript/lang/entry/KeyValueEntryData.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java b/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java index d2caf5bf9c7..57c157a9c01 100644 --- a/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java +++ b/src/main/java/org/skriptlang/skript/lang/entry/KeyValueEntryData.java @@ -24,8 +24,6 @@ import org.skriptlang.skript.lang.entry.EntryValidator.EntryValidatorBuilder; import org.jetbrains.annotations.Nullable; -import java.util.Locale; - /** * An entry based on {@link SimpleNode}s containing a key and a value. * Unlike a traditional {@link ch.njol.skript.config.EntryNode}, this entry data