NewAmazingPVP / ProxyPlayerNotify

A plugin to notify when a player joins or leaves the network or when they switch to another server
4 stars 0 forks source link

Error when using proxy whitelist plugin #9

Open arskvsh opened 1 month ago

arskvsh commented 1 month ago

Hello! Needed to use a proxy-side whitelist plugin for a while, faced a console error when a non-whitelisted player tried to connect to the proxy.

[12:40:43 ERROR]: Couldn't pass DisconnectEvent to proxyplayernotify 2.1.1
java.lang.NullPointerException: Cannot invoke "String.toLowerCase()" because "lastServer" is null
        at bpn.velocity.VelocityPlayerNotify.onLeave(VelocityPlayerNotify.java:155) ~[?:?]
        at bpn.velocity.Lmbda$21.execute(Unknown Source) ~[?:?]
        at com.velocitypowered.proxy.event.UntargetedEventHandler$VoidHandler.lambda$buildHandler$0(UntargetedEventHandler.java:56) ~[server.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at com.velocitypowered.proxy.event.VelocityEventManager.fire(VelocityEventManager.java:676) ~[server.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at com.velocitypowered.proxy.event.VelocityEventManager.lambda$fire$5(VelocityEventManager.java:541) ~[server.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]

Seems that just a check for an empty value needs to be added.

NewAmazingPVP commented 1 month ago

@arskvsh Could you confirm if this issue still occurs with latest version v2.2.2? There were a bunch of fixes after v2.1.1

arskvsh commented 1 month ago

@arskvsh Could you confirm if this issue still occurs with latest version v2.2.2? There were a bunch of fixes after v2.1.1

Sorry, just forgot to update, it's gone now :)

However, there is another small issue. When non-whitelisted players join, the plugin now sends join messages with a raw placeholder, so according to my config it looks like "Player has joined the network (%last_server%)". This is also a case when the placeholder is enclosed, so replacing it with an empty string would cause "()" thing.

May we please have an ability to set "unknown server name" or some other workaround to avoid showing the placeholder?

NewAmazingPVP commented 1 month ago

@arskvsh Sorry for the late reply, but actually I wanted to mention the %last_server% placeholder no longer works for join_message and instead you have to use %server% for it to work properly. Sorry for not mentioning that with the update.

Here are the placeholders that work with each kind of message. join_message: %player%, %lp_prefix%, %lp_suffix%, %server%, %time% join_private_message: %player%, %lp_prefix%, %lp_suffix%, %server%, %time% switch_message: %player%, %last_server%, %server%, %time%, %lp_prefix%, %lp_suffix% leave_message: %player%, %lp_prefix%, %lp_suffix%, %last_server%, %time%

There were also new options added, such as join_message_delay, etc.

If you don't see the update options, you might have to regenerate the config.yml since I haven't yet added the auto regenerate config feature and I am expecting that feature to be added next update. If the issue still persists, let me know and I'll fix it.

arskvsh commented 1 month ago

@NewAmazingPVP Hello again, I apologize as I've made a mistake when I described the problem. Actually, it's the leave message that's being sent. It happens when a player is filtered off by the proxy whitelist plugin.

I don't really know the mechanics behind the whitelist plugin (VelocityCoolList), but I suppose the player is just immediately kicked. So, according to my assumption, they join the network (limbo) and are immediately kicked from it the moment before PPN is even able to capture last_server, making it impossible to mute the network-wide message as it would normally do for limbo. However, it probably would work the same way if the first server a player joins wasn't a limbo.

BTW thank you for the explanation regarding placeholders.

NewAmazingPVP commented 1 month ago

@arskvsh I have found a potential bug and fixed it. Here is the build If it still doesn't work, regenerate your config. With the build I sent, a new option in the config should pop up, and it should be called the join_message_delay. Try setting it to a higher number until it works. Try 50 or more and see if that helps. Also, if possible, could you send me your config.yml with all options? You are putting the limbo server within the limbo section in the config, correct?

NewAmazingPVP commented 3 weeks ago

@arskvsh Please try the new version with default settings/delays (50 ticks) whenever you get time to and please let me know if it's still problematic or not.