Solved Set ClickAction to BaseComponent

Discussion in 'Spigot Plugin Development' started by MaTaMoR_, Apr 3, 2020.

  1. Hi guys! So i'm trying to set a ClickAction to a BaseComponent by using this code:
    Code (Java):

    Player player = (Player) sender;

    BaseComponent[] textComponents = TextComponent.fromLegacyText(color("&bHello this is a message!"));
    for (BaseComponent baseComponent : textComponents) {
        baseComponent.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, ""));

    Though i get the message, i can't click on it, any idea why ?
  2. BananaPuncher714


    You might have to include the proper protocol, like
  3. I'll give it a try, but if you write the link '' in the text itself and the use 'fromLegacyText' the link is detected and works just fine.
    Edit: Okay turns out if you manually set it you have to include the proper protocol, thank you!
    #3 MaTaMoR_, Apr 4, 2020
    Last edited: Apr 4, 2020