Browse Source

Trim fields before adding to array

feature-config-parsing2
MagicBot 5 months ago
parent
commit
3d6bfcf48f
  1. 4
      src/engine/ConfigParsing/EffectsParser.java

4
src/engine/ConfigParsing/EffectsParser.java

@ -56,6 +56,8 @@ public class EffectsParser {
String firstLine; String firstLine;
ArrayList<String> effectDescription = new ArrayList<>(); ArrayList<String> effectDescription = new ArrayList<>();
// Some effects exist without sources/mods or conditions
// (ACID "MOB" 0)
if (effectData.indexOf('\n') > 0) if (effectData.indexOf('\n') > 0)
firstLine = effectData.substring(0, effectData.indexOf('\n')); firstLine = effectData.substring(0, effectData.indexOf('\n'));
else else
@ -66,7 +68,7 @@ public class EffectsParser {
Matcher matcher = STRSPLIT_REGEX.matcher(firstLine); Matcher matcher = STRSPLIT_REGEX.matcher(firstLine);
while (matcher.find()) while (matcher.find())
effectDescription.add(matcher.group(1)); effectDescription.add(matcher.group(1).trim());
effectEntry.id = effectDescription.get(0); effectEntry.id = effectDescription.get(0);
effectEntry.name = effectDescription.get(1); effectEntry.name = effectDescription.get(1);

Loading…
Cancel
Save