How to add a new prefix to an unknown chat format

Discussion in 'Spigot Plugin Development' started by ManuelVonK03, Aug 6, 2018.

  1. Hey everyone,
    I have been working on a Bukkit Party Plugin for the last few days.
    As one of its features, it was supposed to show the name of the party a player is in as a chat prefix. It should NOT replace the former
    chat format. Now, my problem is the following: Since I don't know the chat format (based on other plugins) which is originally used on the server,
    I'm wondering how to realize this idea. I'm aware of the Bukkit AsyncPlayerChatEvent method getFormat(), but when I tried using it,
    I figured out that the chat format it returns is the one from Vanilla Minecraft, it didn't show the prefixes of the other plugins
    (at least not the one of Multiverse which I am using on my development server). Do you know a way to realize this without losing the old
    chat prefixes?
     
  2. Most chat plugins, if not all, do not use the setFormat() method and instead cancel the event and send their own message. So, getting the format would only work if the chat plugin were to set the format, which most do not. Unfortunately, I do not have any clue as to how you would keep the old chat format without the chat plugin setting the format.