mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-25 18:09:27 +00:00
refactor(bukkit): 优化字体管理器中表情解析逻辑
This commit is contained in:
@@ -200,7 +200,8 @@ public class BukkitFontManager extends AbstractFontManager implements Listener {
|
||||
Component textReplaced = text;
|
||||
Set<String> processedKeywords = new HashSet<>();
|
||||
for (Token token : super.emojiKeywordTrie.tokenize(AdventureHelper.componentToJson(text))) {
|
||||
if (!token.isMatch() || parsedCount.value > Config.maxEmojiParsed()) continue;
|
||||
if (!token.isMatch()) continue;
|
||||
if (parsedCount.value++ > Config.maxEmojiParsed()) return;
|
||||
String keyword = token.getFragment();
|
||||
if (processedKeywords.contains(keyword)) continue;
|
||||
Emoji emoji = super.emojiMapper.get(keyword);
|
||||
@@ -220,7 +221,6 @@ public class BukkitFontManager extends AbstractFontManager implements Listener {
|
||||
});
|
||||
consumer.accept(textReplaced);
|
||||
processedKeywords.add(keyword);
|
||||
parsedCount.value++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user