kangarko / ChatControl-Red

Issue tracker and documentation for the next generation ChatControl Red, the most advanced chat management plugin.
43 stars 22 forks source link

1.8.8, 1.12.2, 1.17.1, 1.20.1: NullPointerException - MvdWPlaceholderAPI placeholders failed #2631

Closed gre3x closed 2 months ago

gre3x commented 3 months ago

"/version ChatControlRed" - plugin version

10.25.2

Are you using MySQL?

Yes

Are you using BungeeCord?

Yes

Error log (if applicable)

https://paste.gg/p/anonymous/ce385dd1e3524899af2bbd08cf22988d

"/chc debug" output (strongly recommended)

debug.zip

Information about the issue/bug

I'm unsure on the cause, but after upgradting from version 10.24.5 to the latest version, all my servers (versions 1.12.2, 1.17.1, and 1.20.1) are getting errors in console about NullPointerException and "MvdWPlaceholderAPI placeholders failed!". This issue did not happen when using version 10.24.5.

Although I do have MvdWPlaceholderAPI installed, the placeholders I use in my chat formats are all using the normal PlaceHolderAPI and not MvdWPlaceholderAPI. So I'm not sure how this error is happening. (note that it does not always happen for some reason?)

Additionally, this error seems to be happening even for format sections that don't event have any placeholders in them? Like /tell CalOfTyr (see error logs below)

Here is an example of the full error in console:

05.04 05:13:23 [Server] Server thread/[ERROR] ChatControlRed 10.25.2 encountered a NullPointerException! Please check your error.log and report this issue with the information in that file. Running Paper 1.12.2-R0.1-SNAPSHOT and Java 1.8.0_292
05.04 05:13:23 [Server] Server thread/[INFO] java.lang.NullPointerException
05.04 05:13:23 [Server] Server thread/[INFO] [ChatControlRed] ?7!-----------------------------------------------------!
05.04 05:13:23 [Server] Server thread/[INFO] [ChatControlRed]  ?cMvdWPlaceholderAPI placeholders failed!
05.04 05:13:23 [Server] Server thread/[INFO] [ChatControlRed]  ?cPlayer: Apina213
05.04 05:13:23 [Server] Server thread/[INFO] [ChatControlRed]  ?cMessage: ''true' == 'true''
05.04 05:13:23 [Server] Server thread/[INFO] [ChatControlRed]  ?cConsider writing to the developer of that library
05.04 05:13:23 [Server] Server thread/[INFO] [ChatControlRed]  ?cfirst as this may be a bug we cannot handle!
05.04 05:13:23 [Server] Server thread/[INFO] [ChatControlRed]  ?c
05.04 05:13:23 [Server] Server thread/[INFO] [ChatControlRed]  ?cYour chat message will appear without replacements.
[09:07:29] [Server thread/ERROR]: ChatControlRed 10.25.2 encountered a NullPointerException! Please check your error.log and report this issue with the information in that file. Running Purpur 1.20.1-R0.1-SNAPSHOT and Java 17.0.7
[09:07:29] [Server thread/INFO]: java.lang.NullPointerException
[09:07:29] [Server thread/INFO]: [ChatControlRed] !-----------------------------------------------------!
[09:07:29] [Server thread/ERROR]: ChatControlRed 10.25.2 encountered a NullPointerException! Please check your error.log and report this issue with the information in that file. Running Purpur 1.20.1-R0.1-SNAPSHOT and Java 17.0.7
[09:07:29] [Server thread/INFO]: java.lang.NullPointerException
[09:07:29] [Server thread/INFO]: [ChatControlRed] !-----------------------------------------------------!
[09:07:29] [Server thread/INFO]: [ChatControlRed]  MvdWPlaceholderAPI placeholders failed!
[09:07:29] [Server thread/INFO]: [ChatControlRed]  Player: CalOfTyr
[09:07:29] [Server thread/INFO]: [ChatControlRed]  Message: '[18] [✰] CalOfTyr'
[09:07:29] [Server thread/INFO]: [ChatControlRed]  Consider writing to the developer of that library
[09:07:29] [Server thread/INFO]: [ChatControlRed]  first as this may be a bug we cannot handle!
[09:07:29] [Server thread/INFO]: [ChatControlRed]  
[09:07:29] [Server thread/INFO]: [ChatControlRed]  Your chat message will appear without replacements.
[09:07:29] [Server thread/INFO]: [ChatControlRed] !-----------------------------------------------------!
[09:07:29] [Server thread/INFO]: [ChatControlRed]  MvdWPlaceholderAPI placeholders failed!
[09:07:29] [Server thread/INFO]: [ChatControlRed]  Player: CalOfTyr
[09:07:29] [Server thread/INFO]: [ChatControlRed]  Message: '/tell CalOfTyr '
[09:07:29] [Server thread/INFO]: [ChatControlRed]  Consider writing to the developer of that library
[09:07:29] [Server thread/INFO]: [ChatControlRed]  first as this may be a bug we cannot handle!
[09:07:29] [Server thread/INFO]: [ChatControlRed]  
[09:07:29] [Server thread/INFO]: [ChatControlRed]  Your chat message will appear without replacements.
[09:07:29] [Server thread/INFO]: [ChatControlRed] !-----------------------------------------------------!

This is an issue for me, because I am taking advantage of the new features in 10.24.4 and 10.24.5 to remove empty messages (due to filtering). But when these errors occur it sends the empty message which does not look good for my players: image

gre3x commented 3 months ago

Downgrading to version 10.24.5 fixes the issue

kangarko commented 3 months ago

Please retest on v10.25.3 and let me know if that happens still

gre3x commented 3 months ago

@kangarko the issue persists in the latest version and send even more errors now lol. Again happens for 1.8, 1.12, 1.17, and 1.20 servers

Example of the error (full logs below):

[19:00:04] [Server thread/ERROR]: ChatControlRed 10.25.3 encountered a NullPointerException! Please check your error.log and report this issue with the information in that file. Running Purpur 1.20.1-R0.1-SNAPSHOT and Java 17.0.7
[19:00:04] [Server thread/INFO]: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "instance" is null
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.ReflectionUtil.invoke(ReflectionUtil.java:478)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.model.MVdWPlaceholderHook.replacePlaceholders(HookManager.java:2812)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.model.HookManager.replacePlaceholders(HookManager.java:1474)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.model.Variables.replace(Variables.java:257)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.model.Variables.replace(Variables.java:218)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.model.Variables.replace(Variables.java:202)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.model.Variables.replace(Variables.java:187)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.model.SimpleComponent$Part.canSendTo(SimpleComponent.java:950)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.model.SimpleComponent$Part.toTextComponent(SimpleComponent.java:905)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.model.SimpleComponent$Part.access$600(SimpleComponent.java:807)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.model.SimpleComponent.build(SimpleComponent.java:359)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.model.SimpleComponent.sendAs(SimpleComponent.java:462)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.model.SimpleComponent.send(SimpleComponent.java:445)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.model.Channel.processBungeeMessage(Channel.java:1103)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.listener.BungeeListener.processPackets(BungeeListener.java:126)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.listener.BungeeListener.onMessageReceived(BungeeListener.java:94)
[19:00:04] [Server thread/INFO]:    at ChatControl-Red-10.25.3.jar//org.mineacademy.chatcontrol.lib.bungee.BungeeListener$BungeeListenerImpl.onPluginMessageReceived(BungeeListener.java:155)
[19:00:04] [Server thread/INFO]:    at org.bukkit.plugin.messaging.StandardMessenger.dispatchIncomingMessage(StandardMessenger.java:455)
[19:00:04] [Server thread/INFO]: [ChatControlRed] !-----------------------------------------------------!
[19:00:04] [Server thread/INFO]: [ChatControlRed]  MvdWPlaceholderAPI placeholders failed!
[19:00:04] [Server thread/INFO]: [ChatControlRed]  Player: j0hta
[19:00:04] [Server thread/INFO]: [ChatControlRed]  Message: ''true' == 'true''
[19:00:04] [Server thread/INFO]: [ChatControlRed]  Consider writing to the developer of that library
[19:00:04] [Server thread/INFO]: [ChatControlRed]  first as this may be a bug we cannot handle!
[19:00:04] [Server thread/INFO]: [ChatControlRed]  
[19:00:04] [Server thread/INFO]: [ChatControlRed]  Your chat message will appear without replacements.
[19:00:04] [Server thread/INFO]: [ChatControlRed] !-----------------------------------------------------!

Here is the full server log: https://paste.gg/p/anonymous/a57cb3bbd2104b8a87c1879ac1a59e5e

kangarko commented 3 months ago

Sorry to hear. Gonna investigate asap today.

gre3x commented 3 months ago

Based on the error, it seems like it is trying to instance.getClass() when "instance" is null. Probably you just need to check that "instance" is not null before doing that.

gre3x commented 3 months ago

@kangarko this is currently blocking me from updating ChatControlRed. Is there any progress on getting this fixed?

kangarko commented 2 months ago

Apologizes, this has already been address in the library and new versions of plugins will be released tonight. This was caused by https://github.com/kangarko/Foundation/commit/0b883fab1956bcc22486b308eb59fd51507888a3#diff-b2b371d55fbcbba09d75232c9b5b7ac235f16f0088f829ac7c01edc977edf995R478