Posted March 11, 20169 yr I'm making a update checker that tells the user in the chat when theres a new version of the mod. What I what is a link to my download page, and I know I can do this to make a link: ChatStyle link = new ChatStyle(); link.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://minecraft.curseforge.com/projects/dimensionalcore/files")); link.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.AQUA + "Download the latest version of DimensionalCore"))); link.setColor(EnumChatFormatting.BLUE); event.player.addChatMessage(new ChatComponentText("[Download]" + EnumChatFormatting.RESET + " A new version of DimensionalCore is available:").setChatStyle(link)); But I only want the link to be on the [Download] part not the whole thing. How to make the link only work on the [Download] part?
March 11, 20169 yr Author I changed my code to this: ChatStyle link = new ChatStyle(); link.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://minecraft.curseforge.com/projects/dimensionalcore/files")); link.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.AQUA + "Download the latest version of DimensionalCore"))); link.setColor(EnumChatFormatting.BLUE); IChatComponent button = new ChatComponentText("[Download]").setChatStyle(link); IChatComponent text = new ChatComponentText(EnumChatFormatting.RESET + " A new version of DimensionalCore is available:").setChatStyle(new ChatStyle()); event.player.addChatMessage(button.appendSibling(text)); But it still does the same thing. What am I doing wrong?
March 11, 20169 yr Author How would I do that? I tried: ChatStyle link = new ChatStyle(); ChatStyle nolink = new ChatStyle(); nolink.setChatClickEvent(null)); nolink.setChatHoverEvent(null))); link.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://minecraft.curseforge.com/projects/dimensionalcore/files")); link.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.AQUA + "Download the latest version of DimensionalCore"))); link.setColor(EnumChatFormatting.BLUE); IChatComponent button = new ChatComponentText("[Download]").setChatStyle(link); IChatComponent text = new ChatComponentText(EnumChatFormatting.RESET + " A new version of DimensionalCore is available:").setChatStyle(nolink); And: ChatStyle link = new ChatStyle(); ChatStyle nolink = new ChatStyle(); nolink.setParentStyle(null); link.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://minecraft.curseforge.com/projects/dimensionalcore/files")); link.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.AQUA + "Download the latest version of DimensionalCore"))); link.setColor(EnumChatFormatting.BLUE); IChatComponent button = new ChatComponentText("[Download]").setChatStyle(link); IChatComponent text = new ChatComponentText(EnumChatFormatting.RESET + " A new version of DimensionalCore is available:").setChatStyle(nolink);
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.