EssentialsX

EssentialsX

2M Downloads

Could not pass event AsyncPlayerChatEvent to EssentialsChat v2.0.1-b603

Dolphin2Point1 opened this issue · 17 comments

commented

EssentialsX version: 2.0.1-b603
LuckPerms version: 4.1.5
Vault version: 1.5.6-b49
EssentialsXChat version: 2.0.1-b603
EssentialsXSpawn version: 2.0.1-b603
Server software (run /version):
git-Spigot-dbe12b-61ef214 (MC:1.8.3) (Implementing API version: 1.8.3-R0.1-SNAPSHOT)
EssentialsX config (upload plugins/Essentials/config.yml to Gist):
https://gist.github.com/loper12/4deebeae45bfd7df092093bcad174506
Log: https://gist.github.com/loper12/198de80a0f04755616835b2bf29a21d1
Error: Line 329

Details

Describe your issue here.
I keep on getting this chat error message saying:

07.03 07:00:54 [Server] ERROR Could not pass event AsyncPlayerChatEvent to EssentialsChat v2.0.1-b601
07.03 07:00:54 [Server] INFO org.bukkit.event.EventException
07.03 07:00:54 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:305) ~[spigot1.8.jar:git-Spigot-dbe012b-61ef214]
07.03 07:00:54 [Server] INFO at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot1.8.jar:git-Spigot-dbe012b-61ef214]
07.03 07:00:54 [Server] INFO at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot1.8.jar:git-Spigot-dbe012b-61ef214]
07.03 07:00:54 [Server] INFO at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:484) [spigot1.8.jar:git-Spigot-dbe012b-61ef214]
07.03 07:00:54 [Server] INFO at net.minecraft.server.v1_8_R2.PlayerConnection.chat(PlayerConnection.java:1055) [spigot1.8.jar:git-Spigot-dbe012b-61ef214]
07.03 07:00:54 [Server] INFO at net.minecraft.server.v1_8_R2.PlayerConnection.a(PlayerConnection.java:993) [spigot1.8.jar:git-Spigot-dbe012b-61ef214]
07.03 07:00:54 [Server] INFO at net.minecraft.server.v1_8_R2.PacketPlayInChat$1.run(PacketPlayInChat.java:39) [spigot1.8.jar:git-Spigot-dbe012b-61ef214]
07.03 07:00:54 [Server] INFO at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_111]
07.03 07:00:54 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_111]
07.03 07:00:54 [Server] INFO at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
07.03 07:00:54 [Server] INFO at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
07.03 07:00:54 [Server] INFO at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
07.03 07:00:54 [Server] INFO Caused by: java.util.UnknownFormatConversionException: Conversion = '§'
07.03 07:00:54 [Server] INFO at org.bukkit.event.player.AsyncPlayerChatEvent.setFormat(AsyncPlayerChatEvent.java:100) ~[spigot1.8.jar:git-Spigot-dbe012b-61ef214]
07.03 07:00:54 [Server] INFO at com.earth2me.essentials.chat.EssentialsChatPlayerListenerLowest.onPlayerChat(EssentialsChatPlayerListenerLowest.java:61) ~[?:?]
07.03 07:00:54 [Server] INFO at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]
07.03 07:00:54 [Server] INFO at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_111]
07.03 07:00:54 [Server] INFO at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_111]
07.03 07:00:54 [Server] INFO at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_111]
07.03 07:00:54 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ~[spigot1.8.jar:git-Spigot-dbe012b-61ef214]
commented

Please include the full log

commented

Please update to the latest build, then post the full output of /ess version.

commented

@dariasc I added the log.
@md678685 It only says "Essentials reloaded 2.0.1-b601."
I'll try updating my build.
Update: @md678685 The new build worked! Chat Issue persists tho

commented

There isn't any, there is just the default
But it wasn't happening before the factions tag either
And anyway factions works so that someone with no faction is part of the wilderness
Can some one help me?

commented

If this is still an issue, are you using a plugin to inject placeholders into the chat format? EssentialsX Chat currently doesn't support PlaceholderAPI.

commented

Oh. PLS FIX. Actually, you don't have to right now. But pls fix.
Edit: That is a yes.

commented

@loper12 Could you answer the question I asked above?

are you using a plugin to inject placeholders into the chat format?

commented

I had this same error when I tried using AsyncPlayerChatEvent#setFormat as well...

commented

@MajorSkillage Are you using a placeholder injection plugin?
@loper12 I can't help unless you answer the question.

commented

Could you try replacing % with %% in your format? For example, %bob% to %%bob%%.

commented

@md678685 Yeah. I just tried replacing %tag% as a string in my plugin after adding %tag% into essentialschat format, it didn't replace it and just gave an exception. Could it possibly be because in the plugin the two placeholders being used for the username and the message don't get replaced first causing the exception to occur whenever a "%" is used? It's what I'm thinking anyhow, note that the EventPriority was set to LOWEST in my plugin.

commented

An update on this, did some testing and when I use EventPriority.LOWEST it does nothing. When I use EventPriority.NORMAL I tried replacing %tag% with TESTING and it gave me the same error just with "Te" instead. I then tried %%tag%% and {tag} and they both ended up replacing. I'd advise allowing other plugins however to use %placeholder% as there are several out there that use that as their placeholders. Why not just set the format similar to how I do it? You won't get this issue that way.

		String tag = "";
		if(tags.containsKey(e.getPlayer().getUniqueId())){
			tag = tags.get(e.getPlayer().getUniqueId()) + " ";
		}
		toSend = toSend.replace("{name}", e.getPlayer().getName());
		toSend = toSend.replace("{displayname}", "%1$s");
		toSend = toSend.replace("{tag}", tag);
		toSend = ChatColor.translateAlternateColorCodes('&', toSend);
		toSend = toSend.replace("{message}", "%2$s");
		if(e.getPlayer().hasPermission("tags.colorchat")){
			e.setMessage(ChatColor.translateAlternateColorCodes('&', e.getMessage()));
		}
		e.setFormat(toSend);```
commented

@MajorSkillage

The issue you're encountering is not directly an EssentialsX Chat issue, but rather the fact that Java's formatting is doing exactly what it's supposed to do.

If a % symbol is found in the message format string when the server tries to format the message, it will try to turn that into a replacement string. Since %tag doesn't make sense to the formatter, you'll get this exception. If you wanted %tag% to appear in the literal output, you can double up the % symbols to prevent it being interpreted as a format string.

Your issue however is that you're doing your replacement before EssentialsX Chat has even changed the format, so there isn't anything to replace at that point.

Nothing will be changed in EssentialsX Chat, since it was never designed to have to handle tags delimited by % symbols and it would clash with PlaceholderAPI. I would suggest:

commented

@loper12 Without an answer, I can't help you and I'll have to close this ticket.

Are you using a plugin to inject placeholders into the chat format?

If you don't know, can you at least give us a plugin list?

commented

Yes I am using place holders. I am using PlaceholderApi. And this is the list of plugins:
ASyncWorldEdit
ChestShop
Clearlag
CoreProtect
Crazy Auctions
Epic Rename
EssentialsX v2.0.1
EssentialsXChat v2.0.1
EssentialsXSpawn v2.0.1
ExtraContexts
Factions
IP Whitelist
Luckperms
MassiveCore
mcMMO
NoHopperCraft
ObsidianBreaker
PlaceholderAPI
PlayerVaults
PlugMan
SilkSpawners
StackMob
SuperPotions
Vault
ViaVersion
WorldEdit
WorldGuard

commented

@loper12 Your issue is not an EssentialsX issue, as you don't have any plugin installed that can actually replace the placeholders.

You need to install ChatInjector to use and PlaceholderAPI placeholders in your chat format.

Please also update EssentialsX to a newer version.