use of org.spongepowered.api.text.chat.ChatType in project SpongeCommon by SpongePowered.
the class MixinEntityPlayerMP method sendMessage.
@Override
public void sendMessage(ChatType type, Text message) {
if (this.isFake) {
// Don't bother sending messages to fake players
return;
}
checkNotNull(type, "type");
checkNotNull(message, "message");
ITextComponent component = SpongeTexts.toComponent(message);
if (type == ChatTypes.ACTION_BAR) {
component = SpongeTexts.fixActionBarFormatting(component);
}
this.connection.sendPacket(new SPacketChat(component, (net.minecraft.util.text.ChatType) (Object) type));
}
use of org.spongepowered.api.text.chat.ChatType in project LanternServer by LanternPowered.
the class LanternWorld method sendMessage.
@Override
public void sendMessage(ChatType type, Text message) {
checkNotNull(type, "chatType");
checkNotNull(message, "message");
if (!this.players.isEmpty()) {
final Map<Locale, Message> networkMessages = new HashMap<>();
for (LanternPlayer player : this.players) {
player.getConnection().send(networkMessages.computeIfAbsent(player.getLocale(), locale -> ((LanternChatType) type).getMessageProvider().apply(message, locale)));
}
}
}
Aggregations