From 081c5500a3331506c8e36e2e239568a3b3c798d2 Mon Sep 17 00:00:00 2001 From: Kam Date: Thu, 1 Jun 2023 20:34:25 -0400 Subject: [PATCH] Remove find Object Colon Index --- .../java/noppes/npcs/util/NBTJsonUtil.java | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/main/java/noppes/npcs/util/NBTJsonUtil.java b/src/main/java/noppes/npcs/util/NBTJsonUtil.java index b6d25a333..8332977c6 100644 --- a/src/main/java/noppes/npcs/util/NBTJsonUtil.java +++ b/src/main/java/noppes/npcs/util/NBTJsonUtil.java @@ -36,7 +36,7 @@ public class NBTJsonUtil { json.cut(1); if(json.startsWith("}")) return; - int index = json.findObjectColonIndex(); + int index = json.indexOf(":"); if(index < 1) throw new JsonException("Expected key after ," ,json); @@ -306,24 +306,6 @@ public class NBTJsonUtil { return "Line: " + lines.length + ", Pos: " + pos + ", Text: " + line; } - public int findObjectColonIndex() { - int trueQuotesAmount = 0; - - for (int i = 0; i < text.length(); i++) { - if (text.charAt(i) == '"') { - if (i > 1 && text.charAt(i-1) != '\\' || i == 0) { - trueQuotesAmount++; - } - } - - if (trueQuotesAmount == 2) { - return text.indexOf(":", i); - } - } - - return -1; - } - public boolean startsWith(String... ss) { for(String s : ss) if(text.startsWith(s))