1.8.8 Clickable message

Discussion in 'Spigot Plugin Development' started by Ninjay_, Jul 1, 2021.

  1. Hi everyone, I need to create a clickable message in which to issue an action that executes a method from my code.
    Yes, I know there is TextComponent, but it doesn't have an action to execute a method of code, just execute a command.

    Fictitious example:
    if(player.isClick(text)) {
    rankUp(player); //This is what I need to run
    }
     
  2. You can’t do it that way. Put your method inside a command, and make the player run the command. The client doesn’t have access to your method and clickable text is handled client side.
     
  3. I don't find it interesting to have to create a command just for a function of accepting or denying the player to evolve in rank.
     
  4. ... but you have no choice? Just hide the command from players.
     
  5. In that case, I'll do it on command, but I figured there would be another way to do it.
     
  6. Nope - chat can't talk to the system unless it's by issuing commands. Blame Mojang.
    #LetTheHateFlow
     
    • Funny Funny x 2
  7. Like others have said, what you're trying to achieve is not possible without client-side modifications.

    Consider alternative forms of interaction for your players, such as clicking on blocks in an inventory. That's definitely possible with Spigot.