Mson replacement parent context.

This commit is contained in:
Olof Larsson 2015-09-02 14:50:13 +02:00
parent 6c8a07dc2f
commit 270f2bec05
2 changed files with 4 additions and 4 deletions

View File

@ -721,7 +721,7 @@ public class Mson implements Serializable
MsonReplacement replacer = new MsonReplacement() MsonReplacement replacer = new MsonReplacement()
{ {
@Override @Override
public Mson getReplacement(String match) public Mson getReplacement(String match, Mson parent)
{ {
return replacement; return replacement;
} }
@ -746,11 +746,11 @@ public class Mson implements Serializable
List<Mson> msons = new ArrayList<Mson>(); List<Mson> msons = new ArrayList<Mson>();
StringBuffer currentString = new StringBuffer(); StringBuffer currentString = new StringBuffer();
Matcher matcher = pattern.matcher(getText()); Matcher matcher = pattern.matcher(this.getText());
while (matcher.find()) while (matcher.find())
{ {
String match = matcher.group(0); String match = matcher.group(0);
Mson replacement = replacer.getReplacement(match); Mson replacement = replacer.getReplacement(match, this);
// Add the match // Add the match
if (replacement == null) matcher.appendReplacement(currentString, match); if (replacement == null) matcher.appendReplacement(currentString, match);

View File

@ -2,5 +2,5 @@ package com.massivecraft.massivecore.mson;
public interface MsonReplacement public interface MsonReplacement
{ {
public Mson getReplacement(String match); public Mson getReplacement(String match, Mson parent);
} }