3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-03 01:50:07 +01:00

Cleaned up the Sponge Command Sender chat implementation

Dieser Commit ist enthalten in:
Wyatt Childers 2016-04-04 23:34:20 -04:00
Ursprung 7fb763f7e6
Commit 205e2d212e

Datei anzeigen

@ -26,7 +26,9 @@ import com.sk89q.worldedit.util.auth.AuthorizationException;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.format.TextColor;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.text.serializer.TextSerializers;
import javax.annotation.Nullable;
import java.io.File;
@ -67,28 +69,28 @@ public class SpongeCommandSender implements Actor {
@Override
public void printRaw(String msg) {
for (String part : msg.split("\n")) {
sender.sendMessage(Text.of(part));
sender.sendMessage(TextSerializers.LEGACY_FORMATTING_CODE.deserialize(part));
}
}
@Override
public void print(String msg) {
for (String part : msg.split("\n")) {
sender.sendMessage(Text.of(TextColors.LIGHT_PURPLE, part));
}
sendColorized(msg, TextColors.LIGHT_PURPLE);
}
@Override
public void printDebug(String msg) {
for (String part : msg.split("\n")) {
sender.sendMessage(Text.of(TextColors.GRAY, part));
}
sendColorized(msg, TextColors.GRAY);
}
@Override
public void printError(String msg) {
sendColorized(msg, TextColors.RED);
}
private void sendColorized(String msg, TextColor formatting) {
for (String part : msg.split("\n")) {
sender.sendMessage(Text.of(TextColors.RED, part));
sender.sendMessage(Text.of(formatting, TextSerializers.LEGACY_FORMATTING_CODE.deserialize(part)));
}
}