Jump to content

SLOVED[1.7.10]How to run a Tellraw command


FLUFFY2

Recommended Posts

Hi there!

I can't figure out how to make my tellraw comment to get the clickevent action and open up an url.

My code so far:

ICommand command = new CommandMessageRaw();
ClickEvent clickevent = new ClickEvent(Action.OPEN_URL, "http://www.google.hu");
CommandMessageRaw.func_152373_a(player, command, "Test", this.equals(clickevent)); //Im not sure about the last parameter.

 

The message appears in the chat but its not clickable.

If you can please help me. Thanks!

Link to comment
Share on other sites

I usually open up a browser this way.  Create a class like:

import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

import net.minecraft.client.gui.ScaledResolution;

public class Browser {

public static void browse(String parUrl) {
	// Create Desktop object
    Desktop d=Desktop.getDesktop();

    // Browse a URL, say google.com
    try {
		d.browse(new URI(parUrl));
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (URISyntaxException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

    ScaledResolution sr;
}
}

 

Then you can open browser with:

Browse.browse("http://www.google.hu");

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Thats a good way, but not for me.

I made a mod update detector that now finally works.

If there is an update its have sends a tellraw message what you can click to bring up the mod webpage.

I don't want to force the player to open up a webbrowser every time he/she join to a world.

Thanks for your help trought!

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.