Skip to content

Commit

Permalink
Use TextSerializers.FORMATTING_CODE instead of TextSerializers.PLAIN
Browse files Browse the repository at this point in the history
  • Loading branch information
ustc-zzzz committed Mar 7, 2019
1 parent b7d348c commit b6745c3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
import me.rojo8399.placeholderapi.PlaceholderService;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.service.ChangeServiceProviderEvent;
import org.spongepowered.api.service.ProviderRegistration;
import org.spongepowered.api.service.ServiceManager;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.TextRepresentable;
import org.spongepowered.api.text.TextTemplate;
import org.spongepowered.api.text.serializer.TextSerializer;
import org.spongepowered.api.text.serializer.TextSerializers;

import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -73,9 +74,10 @@ public String parseJavaScriptLiteral(String text, String functionIdentifier)

public String parseText(Player player, String textToBeReplaced)
{
TextSerializer s = TextSerializers.FORMATTING_CODE;
TextTemplate template = this.toTemplate(textToBeReplaced);
Map<String, Object> placeholders = this.papiService.fillPlaceholders(template, player, player);
return template.apply(Maps.transformValues(placeholders, v -> Text.of(v).toPlain())).build().toPlain();
return template.apply(Maps.transformValues(placeholders, v -> s.serialize(Text.of(v)))).build().toPlain();
}

private TextTemplate toTemplate(String text)
Expand Down

0 comments on commit b6745c3

Please sign in to comment.