Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when replacing player var #32

Closed
TheosisOfficial opened this issue Sep 7, 2021 · 6 comments
Closed

NPE when replacing player var #32

TheosisOfficial opened this issue Sep 7, 2021 · 6 comments
Assignees
Labels
bug Something isn't working next release

Comments

@TheosisOfficial
Copy link

I got this exception when joining and leaving my server quickly, but this is the first time it has happened after using the plugin for a while and I can't seem to reproduce it: https://pastebin.com/H7tX4u5c. I already contacted Paper to see if it was caused by a bug on their end but they said it was a bug with the plugin.

Output of /version:
[07.09 16:04:33] [Server] [INFO] This server is running Paper version git-Paper-251 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: 5960af9) [07.09 16:04:33] [Server] You are running the latest version [07.09 16:04:33] [Server] Previous versiongit-Paper-250 (MC: 1.17.1)

@strumswell
Copy link
Owner

strumswell commented Sep 7, 2021

Hey, what variable are you using in regulars motd?

Edit: Has this happened multiple times already? Or was this the first time?

@TheosisOfficial
Copy link
Author

Hey, what variable are you using in regulars motd?

Edit: Has this happened multiple times already? Or was this the first time?

This was the first and only time this has happened. Here's my entire config.yml: https://pastebin.com/NYgPH0in

@strumswell
Copy link
Owner

I have fully read the stack trace now, and I have a feeling what may have happened. The error occurred while trying to find and replace %player% . An old Bukkit API normally retrieves this from your server cache in case the player has been online a short to medium time ago. Otherwise, it calls Mojangs auth servers. I know you don't use %player%, but the code gets called nevertheless — it just replaces nothing.

I feel like something broke here, and I don't think it's due to ServerlistMOTD (might be wrong, though). I can add a null check in the corresponding section to catch those cases.

Thanks for reporting! :)

PS: Was the motd correctly displayed when getting the error?

@strumswell strumswell changed the title Exception NPE when replacing player var Sep 7, 2021
@strumswell strumswell added the bug Something isn't working label Sep 7, 2021
@strumswell strumswell self-assigned this Sep 7, 2021
@TheosisOfficial
Copy link
Author

I have fully read the stack trace now, and I have a feeling what may have happened. The error occurred while trying to find and replace %player% . An old Bukkit API normally retrieves this from your server cache in case the player has been online a short to medium time ago. Otherwise, it calls Mojangs auth servers. I know you don't use %player%, but the code gets called nevertheless — it just replaces nothing.

I feel like something broke here, and I don't think it's due to ServerlistMOTD (might be wrong, though). I can add a null check in the corresponding section to catch those cases.

Thanks for reporting! :)

PS: Was the motd correctly displayed when getting the error?

I'm honestly not certain, but if I was to guess, yes, because I think I would have noticed if it wasn't. Thanks for looking into this! :)

strumswell added a commit that referenced this issue Sep 12, 2021
- Added HEX support, thanks to @harry0198 and his HexiTextLib! He did 99% of the work and I just needed to make so small adjustments. #21
- Catch possible NPE with getOfflinePlayer #32
- Use Logger instead of sysout #31
- Let ServerlistMOTD shut up and stop spamming console 😆
@strumswell
Copy link
Owner

If you'd like to, you can check out the beta. I've included your feedback.

https://github.com/strumswell/ServerlistMOTD-X/releases/tag/X-2021-09-12-BETA

@strumswell
Copy link
Owner

Not fixed as it seems. New conversation in #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next release
Projects
None yet
Development

No branches or pull requests

2 participants