Solved Essentials Chat PlaceholderAPI compatability?

Discussion in 'Spigot Plugin Help' started by FergyEsHere, May 18, 2020.

  1. hello !

    I'm trying to use my custom plugin which has its own placeholder API extension with essentials chat to display the player's rank before their name. I'm using the chat injector plugin to do this however, it doesnt seem to be working. Does anyone know if there a specific format to follow or should I just use a formatting plugin which doesn't require ChatInjector for placeholders? I have protocollib installed as well for the chat injector dependency.

    I've tried this:

    Code (Text):
    format: '%%occrankup_prisonrank%% <{DISPLAYNAME}> {MESSAGE}'
    which just shows up as plain white text '%occrankup_prisonrank%' before the name and message

    and this:

    Code (Text):
    format: '{%occrankup_prisonrank%} <{DISPLAYNAME}> {MESSAGE}'
    which throws this error:

    Code (Text):
    [20:57:38 ERROR]: Could not pass event AsyncPlayerChatEvent to EssentialsChat v2.17.2.0
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:484) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.PlayerConnection.chat(PlayerConnection.java:1084) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1022) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.PacketPlayInChat$1.run(PacketPlayInChat.java:39) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_252]
            at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
            at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
    Caused by: java.util.UnknownFormatConversionException: Conversion = '}'
            at org.bukkit.event.player.AsyncPlayerChatEvent.setFormat(AsyncPlayerChatEvent.java:100) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
            at com.earth2me.essentials.chat.EssentialsChatPlayerListenerLowest.onPlayerChat(EssentialsChatPlayerListenerLowest.java:60) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_252]
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_252]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_252]
            at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_252]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
            ... 11 more
     
    as well as this:

    Code (Text):
    format: '%occrankup_prisonrank% <{DISPLAYNAME}> {MESSAGE}'
    which also throws this error

    Code (Text):
    [21:01:28 ERROR]: Could not pass event AsyncPlayerChatEvent to EssentialsChat v2.17.2.0
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:484) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.PlayerConnection.chat(PlayerConnection.java:1084) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1022) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.PacketPlayInChat$1.run(PacketPlayInChat.java:39) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_252]
            at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
            at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
    Caused by: java.util.IllegalFormatFlagsException: Flags = ' <'
            at org.bukkit.event.player.AsyncPlayerChatEvent.setFormat(AsyncPlayerChatEvent.java:100) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
            at com.earth2me.essentials.chat.EssentialsChatPlayerListenerLowest.onPlayerChat(EssentialsChatPlayerListenerLowest.java:60) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_252]
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_252]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_252]
            at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_252]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
            ... 11 more
     
    I feel like I'm missing something? I dont know if there's a guide on how to format this properly, other threads iIve seen have said that installing ChatInjector should make this work but I think it's an issue with my formatting.

    thank you :]
     
    • Friendly Friendly x 1
  2. You can´t use PlaceholderAPI In essentials
     
    • Agree Agree x 2
    • Like Like x 1
  3. You have to download ChatInjector and then replace all %% by {} for your placeholders. It is currently the only way to use PAPI in EssXChat
     
    • Like Like x 1
    • Agree Agree x 1
  4. You could try replacing { } with % % (or vice versa), but I wouldn't guarantee that it would work because EssentialsChat doesn't support these placeholders.
    ChatInjector's job is to force these placeholders to work in EssentialsXChat. If it still doesn't work, you may have to use a separate plugin like DeluxeChat.
    (too late :( @Tanguygab )
     
    • Like Like x 1
    • Friendly Friendly x 1
  5. actually, it's not on EssXChat but on every chat message,
    :p
     
    • Friendly Friendly x 1
  6. Thanks for your help guys, I will try out your solutions :)
     
    • Like Like x 1
  7. Surrounding the placeholder with '{}' works fine like so:

    Code (Text):
    {occrankup_prisonrank}