Skip to content

Commit

Permalink
make MUTemplate implement Template so it can be rendered from within …
Browse files Browse the repository at this point in the history
…another template
  • Loading branch information
dags- committed Apr 2, 2019
1 parent 94cb141 commit cbbb880
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group "me.dags"
version "0.3.1-SNAPSHOT"
version "0.3.2-SNAPSHOT"
def spongeAPI = "7.1.0"
def spongeChannel = "SNAPSHOT"
sourceCompatibility = 1.8
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/me/dags/text/MUTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
import org.spongepowered.api.text.transform.SimpleTextFormatter;
import org.spongepowered.api.text.transform.SimpleTextTemplateApplier;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

import static com.google.common.base.Preconditions.checkNotNull;

public class MUTemplate {
public class MUTemplate implements Template {

public static final MUTemplate EMPTY = new MUTemplate(MUSpec.create(), Template.EMPTY, MUPerms.NONE);

Expand All @@ -29,6 +31,11 @@ public MUTemplate(MUSpec spec, Template template, Property.Predicate predicate)
this.predicate = predicate;
}

@Override
public void apply(Object value, Writer writer) throws IOException {
template.apply(value, writer);
}

public Applier with(String key, Object value) {
return applier().with(key, value);
}
Expand Down

0 comments on commit cbbb880

Please sign in to comment.