use of cc.hyperium.mods.levelhead.display.LevelheadDisplay in project Hyperium by HyperiumClient.
the class LevelheadChatRenderer method chat.
@InvokeEvent
public void chat(ServerChatEvent event) {
if (!levelhead.getDisplayManager().getMasterConfig().isEnabled())
return;
LevelheadDisplay chat = Levelhead.getInstance().getDisplayManager().getChat();
if (chat == null || !levelhead.getLevelheadPurchaseStates().isChat() || !chat.getConfig().isEnabled())
return;
List<IChatComponent> siblings = event.getChat().getSiblings();
if (siblings.size() == 0)
return;
IChatComponent chatComponent = siblings.get(0);
if (chatComponent instanceof ChatComponentText) {
ChatStyle style = chatComponent.getChatStyle();
ClickEvent clickEvent = style.getChatClickEvent();
if (clickEvent != null && clickEvent.getAction() == ClickEvent.Action.RUN_COMMAND) {
String value = clickEvent.getValue();
HoverEvent hoverEvent = style.getChatHoverEvent();
if (hoverEvent != null && hoverEvent.getAction() == HoverEvent.Action.SHOW_TEXT) {
String[] split = value.split(" ");
if (split.length == 2) {
String uuid = split[1];
UUID key = UUID.fromString(uuid);
String tag = chat.getTrueValueCache().get(key);
if (tag != null) {
event.setChat(modifyChat(event.getChat(), tag, chat.getConfig()));
} else if (!(chat.getCache().get(key) instanceof NullLevelheadTag)) {
levelhead.fetch(key, chat, false);
}
}
}
}
}
}
Aggregations