1.15.2 How to send message with Promt on Links

Discussion in 'Spigot Plugin Development' started by Armagidon, Feb 2, 2020.

  1. In chat when you send message with link, by clicking on this link you can go to this site! But how to send the same with sendMessage (BaseComponent)? I'm making my chat manager with message editing, I'm sending by sendMessage to all recipients and when someone delete / edit message it resends. Thanks!
     
  2. Your message doesn't really make sense, but would p#spigot()#sendMessage(BaseComponent); work?

    EDIT: Or if you mean sending a clickable link as a base component, there's
    Code (Text):
     BaseComponent.setClickEvent();
    ClickEvent.Action.OPEN_URL;
     
  3. No, I mean smth like this
     

    Attached Files:

  4. Firstly, next time you ask a question, do pay attention to the way you ask it. I would like to answer your question! Unfortunately, it's very unclear and we don't exactly know what you want to achieve.

    That said, you need to know that any text in the chat with an URL format [http(s)://www.*.*] is by default clickable and then will send you to the corresponding site. If your goal is to send an URL in the chat using TextComponent from Chat API, you simply need to do the following.

    Code (Java):
    TextComponent component = new TextComponent("https://www.google.com");
    player.spigot().sendMessage(component);
     
    • Agree Agree x 1
  5. I'm making my chat manager! When someone send message event cancels and message automatically formating then it sending to recipients.
    I can't separate links and message! I've just checked on that It still doesn't work, when I click on message with url nothing happens! I know that in LuckPerms it works, but how to make the same, I couldn't find where it send message, which I need. Maybe there is some parameter in packet or something to make my message clickable. Though if I will use regexes I will perhaps can do that.