From 8c1985f9c036edc123b3fc124216b40752dd37f0 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 13:08:34 +0000 Subject: [PATCH] Split by regex --- .../intellectualsites/plotsquared/plot/PlotSquared.java | 2 +- .../plotsquared/plot/config/Configuration.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java index a08a8b1c2..fd57be3d8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java @@ -1320,7 +1320,7 @@ import java.util.zip.ZipInputStream; .filter(validArgument -> args.toLowerCase(Locale.ENGLISH).contains(validArgument)) .count(); - String[] split = args.toLowerCase(Locale.ENGLISH).split(","); + String[] split = args.toLowerCase(Locale.ENGLISH).split(",(?![^\\(\\[]*[\\]\\)])"); if (split.length > expected) { // This means we have multi-block block buckets diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java index a4fe5a8b5..dc143f1e4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Configuration.java @@ -66,7 +66,7 @@ public class Configuration { return new BlockBucket(); } final BlockBucket blockBucket = new BlockBucket(); - final String[] parts = string.split(","); + final String[] parts = string.split(",(?![^\\(\\[]*[\\]\\)])"); for (final String part : parts) { String block = part; int chance = -1; @@ -99,7 +99,7 @@ public class Configuration { if (string == null || string.isEmpty()) { return false; } - final String[] parts = string.split(","); + final String[] parts = string.split(",(?![^\\(\\[]*[\\]\\)])"); for (final String part : parts) { String block = part; if (part.contains(":")) {