ClickEvent doesn't work

Discussion in 'BungeeCord Plugin Development' started by XelfeGamer, May 11, 2015.

  1. Hey i have a problem with ClickEvent and i don't why this happen, HoverEvent work but when i set ClickEvent and i run the command in the game i get kicked from the server, before it works, but when i implement RedisBungee in the plugin it stop works. My code:

    Code (Text):
                        if(getConfig.getStringList("helpers").contains(s.toLowerCase()) || getConfig.getStringList("helpers").contains(s)) {
                            TextComponent message = new TextComponent(ChatColor.translateAlternateColorCodes('&', getConfig.getString("sieshelper").replace("%staff", s).replace("%server", server)));
                            message.setClickEvent( new ClickEvent( ClickEvent.Action.ClickEvent.Action.SUGGEST_COMMAND, "/msg " + s + " " ));
    Somebody know why this happen?
  2. clip


    Add a / before the command.

    Also I suggest using SUGGEST_COMMAND as RUN_COMMAND will execute it with no arguments in your mesage.
  3. Sorry now is the real code
    • Funny Funny x 1
  4. clip


    I am also not sure if you can send the message with sender.sendMessage().

    Someone correct me if im wrong?

    Pretty sure you need to use player.spigot().sendMessage(textcomponent);

    You should also finish building the message before sending it as I see you are attempting to send the same message twice, the first time before you have completed building your TextComponent
    • Funny Funny x 1
  5. It works before but when i implement Redis stop works, and player.spigot().sendmessage its only for Spigot API and i'm working on the Bungee API.
  6. clip


    Ahh! Sorry for that. I just saw the thread but didn't look at what forum it was in (facepalm)
    Well I have no clue on how Redisbungee works as I have never worked with it before :/

    I do think that you "should" build your whole TextComponent before sending it though.
    #6 clip, May 11, 2015
    Last edited: May 11, 2015