1.16.5 Replacing specific parts of a AsyncPlayerChatEvent#getMessage with hover text

Discussion in 'Spigot Plugin Development' started by Lightcaster5, Jun 5, 2021.

  1. Hey I tried to find a solution for what you need and I think I'm into something, in this post its suggested to use player.spigot().sendMessage() to send also TextComponents, so I think you could cancel the event and send the message to the online players, don't know how good of a solution this is though
     
  2. Listening for AsyncPlayerChat events, CANCELING THEM, and then sending the msg via player#spigot#sendMessage would bypass all plugins that deal will anti advertisement, mute, tempmute, so I'd have to add support for ALL of those plugins. This is why I wanted to use AsyncPlayerChatEvent#setMessage because it would still follow all other plugin rules like chat mute or anti advertising.
     
  3. maybe
    Code (Java):
    @EventHandler(priority = EventPriority.HIGH)
     
    • Like Like x 3
  4. The thing is that I doubt those plugins would work with TextComponent (Asumming that you found some magical way to make AsyncPlayerChatEvent send a TextComponent), seems like you need to manually add support
     
  5. Then you could check if it’s already cancelled by some other event handler (in the case of mutes)

    EDIT: plus would setMessage actually not interfere with anti ads plugins in case they don’t cancel the even but just set the message as you do?