Solved Send message with ClickEvent

Discussion in 'Spigot Plugin Development' started by popbot, May 29, 2020.

Thread Status:
Not open for further replies.
  1. Hello,
    I want to send a message that the player can click on and it executes some command. I've found on Google that I need something like this:
    Code (Java):
    TextComponent message = new TextComponent("Click me");
    message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/command"));
    But when I put it into my IDE (Eclipse), it says that TextComponent cannot be resolved to a type and there is no available import. While I was Googling again, I've found this wiki page describing the API but it seems like it's for Bungeecord not Spigot.

    So, although I find it weird that it was several times recomended for Spigot here on forums, what is the way to do it in Spigot? Thanks!
  2. Spigot uses the component API from Bungeecord, so you can access Bungeecords chat classes via Spigot.
    The required import is
    Hope that helps!
  3. Thanks, but that import does not work...
  4. That is weird, for me it's working fine. I'm using a maven dependency though, maybe your spigot import is wrong?
    • Like Like x 1
  5. I've found the issue, you have to use the -shaded api jar file, than it seems to work.
Thread Status:
Not open for further replies.