diff options
Diffstat (limited to 'src/main/java/rosegoldaddons/utils/ChatUtils.java')
-rw-r--r-- | src/main/java/rosegoldaddons/utils/ChatUtils.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/rosegoldaddons/utils/ChatUtils.java b/src/main/java/rosegoldaddons/utils/ChatUtils.java new file mode 100644 index 0000000..4295c77 --- /dev/null +++ b/src/main/java/rosegoldaddons/utils/ChatUtils.java @@ -0,0 +1,30 @@ +package rosegoldaddons.utils; + +import net.minecraft.client.Minecraft; +import net.minecraft.event.ClickEvent; +import net.minecraft.event.HoverEvent; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import org.jetbrains.annotations.NotNull; + +import java.util.Iterator; +import java.util.List; + + +public class ChatUtils { + + /* § */ + + public static void sendMessage(String message) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§f[§aRoseGoldAddons§f] "+message)); + } + + public static ChatStyle createClickStyle(ClickEvent.Action action, String value) { + ChatStyle style = new ChatStyle(); + style.setChatClickEvent(new ClickEvent(action, value)); + style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (IChatComponent)new ChatComponentText(EnumChatFormatting.YELLOW + value))); + return style; + } +} |