Jump to content

[1.7.10] How do you print a clickable URL in chat?


Ms_Raven

Recommended Posts

I've seen a lot of other mods do it but I can't get mine to be clickable (in the sense that it asks to open it in your browser when you click on it). What am I doing wrong?

 

public class LoadingEvent
{
private static String url = "http://missapocalypse.wix.com/fandomcraft";

@SubscribeEvent
public void playerLogsIn(PlayerLoggedInEvent event)
{
	try
	{
		URL site = new URL(url);

		event.player.addChatMessage(new ChatComponentText("You are playing '" +
				EnumChatFormatting.RED + "FandomCraft v4S" + EnumChatFormatting.WHITE +
				",' singleplayer version of the '" + EnumChatFormatting.GREEN +
				"Fable Update" + EnumChatFormatting.WHITE + ".'"));

		event.player.addChatMessage(new ChatComponentText("You can check for updates at "  +
				EnumChatFormatting.GOLD + site));
	}
    catch (MalformedURLException e)
    {
      e.printStackTrace();
    }

}
}

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.