Steps how to reproduce:
1. Create plugin that changes chat formatting with the following code:
@EventHandler(priority = EventPriority.NORMAL) public void playerChatFormatting(AsyncPlayerChatEvent e) { e.setFormat(ChatColor.GRAY + e.getPlayer().getName() + ChatColor.WHITE + ": " + e.getMessage()); }
2. Client sends chat message containing percent char, like "I am 100% sure"
3. Event causes error:
[14:24:22] Async Chat Thread - #0/ERROR: Could not pass event AsyncPlayerChatEvent to ******************** v1.0
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:305) ~[spigot-1.8.3.jar:git-Spigot-2ec6f06-7722428]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.8.3.jar:git-Spigot-2ec6f06-7722428]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot-1.8.3.jar:git-Spigot-2ec6f06-7722428]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:484) [spigot-1.8.3.jar:git-Spigot-2ec6f06-7722428]
at net.minecraft.server.v1_8_R2.PlayerConnection.chat(PlayerConnection.java:1061) [spigot-1.8.3.jar:git-Spigot-2ec6f06-7722428]
at net.minecraft.server.v1_8_R2.PlayerConnection.a(PlayerConnection.java:999) [spigot-1.8.3.jar:git-Spigot-2ec6f06-7722428]
at net.minecraft.server.v1_8_R2.PacketPlayInChat$1.run(PacketPlayInChat.java:39) [spigot-1.8.3.jar:git-Spigot-2ec6f06-7722428]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.7.0_71]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_71]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.7.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.7.0_71]
at java.lang.Thread.run(Unknown Source) [?:1.7.0_71]
Caused by: java.util.FormatFlagsConversionMismatchException: Conversion = s, Flags =
at org.bukkit.event.player.AsyncPlayerChatEvent.setFormat(AsyncPlayerChatEvent.java:100) ~[spigot-1.8.3.jar:git-Spigot-2ec6f06-7722428]
at listener.MainListener.playerChatFormatting(MainListener.java:51) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ~[spigot-1.8.3.jar:git-Spigot-2ec6f06-7722428]
... 11 more
Somewhere I read this is due to '%' being an escape character, maybe that helps.