forked from MagicBane/Server
Parsing conditions
This commit is contained in:
@@ -28,6 +28,7 @@ public class EffectsParser {
|
||||
public static HashMap<String, EffectEntry> effect_data = new HashMap<>();
|
||||
private static final Pattern EFFECT_REGEX = Pattern.compile("(?<=EFFECTBEGIN)(.+?)(?=EFFECTEND)", Pattern.DOTALL);
|
||||
private static final Pattern SOURCE_REGEX = Pattern.compile("(?<=SOURCEBEGIN)(.+?)(?=SOURCEEND)", Pattern.DOTALL);
|
||||
private static final Pattern CONDITIONS_REGEX = Pattern.compile("(?<=CONDITIONBEGIN)(.+?)(?=CONDITIONEND)", Pattern.DOTALL);
|
||||
private static final Pattern MODS_REGEX = Pattern.compile("(?<=MODSBEGIN)(.+?)(?=MODSEND)", Pattern.DOTALL);
|
||||
private static final Pattern STRSPLIT_REGEX = Pattern.compile("([^\"]\\S*|\"[^\"]*\")\\s*");
|
||||
|
||||
@@ -107,6 +108,16 @@ public class EffectsParser {
|
||||
effectEntry.mods.add(effectModifier);
|
||||
}
|
||||
|
||||
// Parse Conditions
|
||||
|
||||
matcher = CONDITIONS_REGEX.matcher(effectData);
|
||||
|
||||
while (matcher.find()) {
|
||||
String[] condition = matcher.group().split(" ");
|
||||
effectEntry.conditions.put(condition[0].trim(), Float.parseFloat(condition[1]));
|
||||
}
|
||||
|
||||
|
||||
return effectEntry;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user