Skip to content
Advertisement

Bukkit Chat Clickable Buttons

I’m actually coding a plugin, in a command it prompts a confirmation message and I want to click a button (on the chat text) for confirming and cancellating. I don’t like to copying and pasting code from others, and I don’t want to use classes from others too. I am trying to use TextComponents but I can’t make it work. Here is the command code

JavaScript

It trows me 3 errors:

TextComponent(String) is not public in TextComponent; cannot be accesed from outside package (In the line where I define TextComponent)

Cannot find symbol (In the ClickEvent line)

Package ClickEvent does not exist (In the ClickEvent line)

How can I solve the errors? There is an easier way to do a clickable buttons (without other classes or copying/pasting)?

Advertisement

Answer

You have 2 problems.

  1. You’re missing a dependency. Add the following dependency to your pom.xml:
JavaScript
  1. You have imported java.awt.TextComponent in your InfoCommand class, which is wrong. So remove that import and add these instead:
JavaScript
Advertisement