Chat Event without overriding Essentials

Discussion in 'Spigot Plugin Development' started by BiastGaming, May 27, 2016.

  1. Does anyone know how I would put a suffix after a player's name without overriding essentials. I dont want to have to make my own prefix manager.
     
  2. You can add an identifier into Essentials' chat format and replace that in the event. I actually have a plugin for this if you look in my profile.
     
    • Agree Agree x 1
  3. Can you give me some example code, would i have to add essentialschat as a buildpath and EssentialsChat.getConfig ?
     
  4. No, use the AsyncPlayerChatEvent and replace the identifiers by getting the format and setting it.
     
  5. but i cant really set it without ruining essentials chat as its a prefix and the format includes the message doesnt it?
     
  6. Yes you can.
     
  7. so heres the layout
    [PREFIX] [PLAYER] [the tag i want to put] > [Message]
     
  8. I explained this to you in your other thread about this topic but obviously you did not listen.
    In essentials config think of a name for your tag placeholder it can just be %tag%
    Now in the chat event you want to do event.setFormat(event.getFormat().replaceAll("%tag%", <your method to get the players tag>));
    That will get the %tag% placeholder you defined in your essentials config and replace it with the players tag however you implement it. You can do this with just about anything you want to not just a tag but statistics etc. Next time please don't make another thread where you are told the same thing and instead ask for clarification on the other one
     
    • Useful Useful x 1