From 270f2bec052880e273868715721a2e7f18f90c09 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Wed, 2 Sep 2015 14:50:13 +0200 Subject: [PATCH] Mson replacement parent context. --- src/com/massivecraft/massivecore/mson/Mson.java | 6 +++--- src/com/massivecraft/massivecore/mson/MsonReplacement.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/massivecraft/massivecore/mson/Mson.java b/src/com/massivecraft/massivecore/mson/Mson.java index c4a36a89..770d9bd2 100644 --- a/src/com/massivecraft/massivecore/mson/Mson.java +++ b/src/com/massivecraft/massivecore/mson/Mson.java @@ -721,7 +721,7 @@ public class Mson implements Serializable MsonReplacement replacer = new MsonReplacement() { @Override - public Mson getReplacement(String match) + public Mson getReplacement(String match, Mson parent) { return replacement; } @@ -746,11 +746,11 @@ public class Mson implements Serializable List msons = new ArrayList(); StringBuffer currentString = new StringBuffer(); - Matcher matcher = pattern.matcher(getText()); + Matcher matcher = pattern.matcher(this.getText()); while (matcher.find()) { String match = matcher.group(0); - Mson replacement = replacer.getReplacement(match); + Mson replacement = replacer.getReplacement(match, this); // Add the match if (replacement == null) matcher.appendReplacement(currentString, match); diff --git a/src/com/massivecraft/massivecore/mson/MsonReplacement.java b/src/com/massivecraft/massivecore/mson/MsonReplacement.java index 033c4d57..15fdbe41 100644 --- a/src/com/massivecraft/massivecore/mson/MsonReplacement.java +++ b/src/com/massivecraft/massivecore/mson/MsonReplacement.java @@ -2,5 +2,5 @@ package com.massivecraft.massivecore.mson; public interface MsonReplacement { - public Mson getReplacement(String match); + public Mson getReplacement(String match, Mson parent); }