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:
Ursprung
7fb763f7e6
Commit
205e2d212e
@ -26,7 +26,9 @@ import com.sk89q.worldedit.util.auth.AuthorizationException;
|
|||||||
import org.spongepowered.api.command.CommandSource;
|
import org.spongepowered.api.command.CommandSource;
|
||||||
import org.spongepowered.api.entity.living.player.Player;
|
import org.spongepowered.api.entity.living.player.Player;
|
||||||
import org.spongepowered.api.text.Text;
|
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.format.TextColors;
|
||||||
|
import org.spongepowered.api.text.serializer.TextSerializers;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -67,28 +69,28 @@ public class SpongeCommandSender implements Actor {
|
|||||||
@Override
|
@Override
|
||||||
public void printRaw(String msg) {
|
public void printRaw(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
for (String part : msg.split("\n")) {
|
||||||
sender.sendMessage(Text.of(part));
|
sender.sendMessage(TextSerializers.LEGACY_FORMATTING_CODE.deserialize(part));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void print(String msg) {
|
public void print(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
sendColorized(msg, TextColors.LIGHT_PURPLE);
|
||||||
sender.sendMessage(Text.of(TextColors.LIGHT_PURPLE, part));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printDebug(String msg) {
|
public void printDebug(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
sendColorized(msg, TextColors.GRAY);
|
||||||
sender.sendMessage(Text.of(TextColors.GRAY, part));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printError(String msg) {
|
public void printError(String msg) {
|
||||||
|
sendColorized(msg, TextColors.RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendColorized(String msg, TextColor formatting) {
|
||||||
for (String part : msg.split("\n")) {
|
for (String part : msg.split("\n")) {
|
||||||
sender.sendMessage(Text.of(TextColors.RED, part));
|
sender.sendMessage(Text.of(formatting, TextSerializers.LEGACY_FORMATTING_CODE.deserialize(part)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren