package net.t2code.t2codelib.SPIGOT.api.messages; import net.md_5.bungee.api.chat.ClickEvent; import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class T2ChoverModule { public static void modulePlayer(String text, String hover, String action, String actionValue, Player player) { modulePlayer((text != null ? text : "null") + "/*/" + (hover != null ? hover : "null") + "/*/" + (action != null ? action : "null") + "/*/" + (actionValue != null ? actionValue : "null"), player); } public static void modulePlayer(String msg, Player player) { if (msg.contains("/*/")) { t2cmodule(msg, player); return; } T2CminiMessage.sendPlayerMiniMessage(msg, player); } public static void moduleSender(String msg, CommandSender sender) { T2CminiMessage.sendSenderMiniMessage(msg, sender); } public static void moduleConsole(String msg) { if (T2CodeLibMain.getMmIsLoad()) { T2CminiMessage.sendConsoleMiniMessage(msg); return; } Bukkit.getConsoleSender().sendMessage(msg); } private static void t2cmodule(String msg, Player player) { String[] split = msg.split("/\\*/"); int i = split.length; String text = null; String hover = null; String action = null; String actionValue = null; if (i > 0) text = split[0]; if (i > 1) hover = split[1]; if (i > 2) action = split[2]; if (i > 3) actionValue = split[3]; T2CtextBuilder textBuilder = new T2CtextBuilder(text); if (hover != null && !hover.equals("null")) { textBuilder.addHover(hover); } if (action != null && actionValue != null && !action.equals("null") && !actionValue.equals("null")) { textBuilder.addClickEvent(ClickEvent.Action.valueOf(action.toUpperCase()), actionValue); } player.spigot().sendMessage(textBuilder.build()); } }