mirror of
https://github.com/System-End/Discord-MC-Chat.git
synced 2026-04-20 00:25:18 +00:00
非Discord服务器内自定义表情符号也能高亮显示
This commit is contained in:
parent
8e41e4d402
commit
7113bca037
1 changed files with 3 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ package top.xujiayao.mcdiscordchat.minecraft.mixins;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.vdurmont.emoji.EmojiManager;
|
||||
import net.dv8tion.jda.api.entities.Emote;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.utils.MarkdownSanitizer;
|
||||
|
|
@ -95,6 +96,8 @@ public abstract class MixinServerPlayNetworkHandler {
|
|||
if (!emotes.isEmpty()) {
|
||||
contentToDiscord = StringUtils.replaceIgnoreCase(contentToDiscord, (":" + emoteName + ":"), emotes.get(0).getAsMention());
|
||||
contentToMinecraft = StringUtils.replaceIgnoreCase(contentToMinecraft, (":" + emoteName + ":"), (Formatting.YELLOW + ":" + emoteName + ":" + Formatting.WHITE));
|
||||
} else if (EmojiManager.getForAlias(emoteName) != null) {
|
||||
contentToMinecraft = StringUtils.replaceIgnoreCase(contentToMinecraft, (":" + emoteName + ":"), (Formatting.YELLOW + ":" + emoteName + ":" + Formatting.WHITE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -115,8 +118,6 @@ public abstract class MixinServerPlayNetworkHandler {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO Change colour for emoji too
|
||||
|
||||
json.getAsJsonArray("with").add(contentToMinecraft);
|
||||
Text finalText = Text.Serializer.fromJson(json.toString());
|
||||
server.getPlayerManager().broadcast(finalText, MessageType.CHAT, player.getUuid());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue