Solved Embed a Single Word with a Hover Event in Message

Discussion in 'Spigot Plugin Development' started by Dusk_2_Dawn, Jan 9, 2020.

  1. So I am writing a plugin and I want to send the player a message when they complete an achievement. It way something like this:

    You complete the achievement [name]!

    And when you hover over [name] it would show some stuff and have a click event and what-not. The issue for me is not creating the hover and click events, its just having that one word embedded in the message. If I do just plain player.sendMessage(message); it spits out some weird garbled mess of text. If I do player.spigot.sendMessage(message), this works but it only sends that one word and doesn't accept strings, it only accepts BaseComponents.

    So how do I do this?

    NOTE: I do not want the whole message to have a hover event, just the one word
  2. Nevermind, I just figured out how to do it. I created another TextComponent for the base part of the message and send both of them seperated by commas like this:

    player.spigot().sendMessage(message, achievement);