TextComponent/BaseComponent events no longer working.

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major
    • None
    • Affects Version/s: None
    • CraftBukkit version 4466-Spigot-aa90801-0f147ef (MC: 1.21.5) (Implementing API version 1.21.5-R0.1-SNAPSHOT)
    • Yes

       

      Component events such as HoverEvent and ClickEvent are no longer working in this release.

      Any text styling that is set on the component will still be present, but any event that is added to the component won't be set.

       

      Here is some example code that I have been using for a while. (Also tested in 1.21.4)

      TextComponent tip = new TextComponent(
          new ComponentBuilder()
              .append("[").color(ChatColor.DARK_GRAY)
              .append("PRO TIP").color(ChatColor.LIGHT_PURPLE).bold(true)
              .append("").reset().retain(FormatRetention.EVENTS)
              .append("]").color(ChatColor.DARK_GRAY)
              .create());
      tip.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
          new ComponentBuilder()
              .append("Hover over the icon next to the command").color(ChatColor.GRAY)
              .append("\n")
              .append("to view the required permissions.")
              .append("\n\n")
              .append("You can also click on and hover over the commands!").color(ChatColor.GRAY)
              .append("\n")
              .append("COMMAND LEGEND: ").color(ChatColor.YELLOW).bold(true)
              .append("").reset()
              .append("<> = Required, [] = Optional").color(ChatColor.GRAY)
              .create())); 
      
      BaseComponent[] test = new ComponentBuilder()
          .append("Hugs Commands").bold(true).color(ChatColor.of(PluginConstants.DEFAULT_PREFIX_COLOR_HEX))
          .append(" >>").bold(true).color(ChatColor.DARK_GRAY)
          .append(" ").reset()
          .append("Viewing help page ").color(ChatColor.of("#67cbf8"))
          .append("(").color(ChatColor.DARK_GRAY)
          .append("1").color(ChatColor.WHITE)
          .append("/").color(ChatColor.GRAY)
          .append("2").color(ChatColor.WHITE)
          .append(")").color(ChatColor.DARK_GRAY)
          .append(" ")
          .append(tip)
          .create();
      
      sender.spigot().sendMessage(test);

       

      Here is another example using click events.

      ComponentBuilder website = new ComponentBuilder("[VISIT SITE]").color(ChatColor.of(PRIMARY_COLOR)).bold(true)
          .event(new ClickEvent(Action.OPEN_URL, PluginConstants.PLUGIN_SOURCE_CODE_LINK))
          .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click me to visit the site!").color(ChatColor.AQUA).create()));
      
      BaseComponent[] sourceCodeBook = new ComponentBuilder()
          .append("           ").append("Hugs").color(ChatColor.of(PRIMARY_COLOR)).bold(true).append("").reset()
          .append("\n")
          .append("      ").append("Source Code")
          .append("\n\n")
          .append("Consider contributing to the development!")
          .append("\n\n\n")
          .append("    ").append(website.create()).append("").reset()
          .create();

       

      These examples work in older versions of Spigot, but have ceased to in this release.

            Assignee:
            md_5
            Reporter:
            Nothixal
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: