Junk TARDIS causes NullPointerException when players log out while travelling
Technoguyfication opened this issue ยท 2 comments
Describe the bug
NullPointerException is spammed every tick if a player logs out while travelling in the junk TARDIS.
Error description:
[15:53:12 INFO]: Xalili lost connection: Disconnected
[15:53:12 INFO]: << [Player] Xalili left the server.
[15:53:12 WARN]: [TARDIS] Task #1062726 for TARDIS v4.6.3-b2281 generated an exception
java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.isOnline()" because "p" is null
at me.eccentric_nz.TARDIS.junk.TARDISJunkItsDangerousRunnable.lambda$run$0(TARDISJunkItsDangerousRunnable.java:61) ~[?:?]
at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
at me.eccentric_nz.TARDIS.junk.TARDISJunkItsDangerousRunnable.run(TARDISJunkItsDangerousRunnable.java:59) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Paper-752]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.16.5.jar:git-Paper-752]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1427) ~[patched_1.16.5.jar:git-Paper-752]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:436) ~[patched_1.16.5.jar:git-Paper-752]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1342) ~[patched_1.16.5.jar:git-Paper-752]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1130) ~[patched_1.16.5.jar:git-Paper-752]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-752]
at java.lang.Thread.run(Thread.java:831) [?:?]
(the error is repeated every tick until the TARDIS finishes traveling or player logs back in)
Code causing the error:
It looks like this is caused by getPlayer
returning null for offline players, and the plugin isn't doing a null check here,
To Reproduce
Steps to reproduce the behaviour:
- Create junk tardis
- Start travelling somewhere with it
- Log out while travelling
- Error occurs
/tardis version
output
[15:57:42 INFO]: [TARDIS] Server version: git-Paper-752 (MC: 1.16.5)
[15:57:42 INFO]: [TARDIS] TARDIS version: 4.6.3-b2281
[15:57:42 INFO]: [TARDIS] TARDISChunkGenerator version: 4.6.3
[15:57:42 INFO]: [TARDIS] Multiverse-Core version: 4.2.2-b812
[15:57:42 INFO]: [TARDIS] Essentials version: 2.18.2.0
[15:57:42 INFO]: [TARDIS] WorldGuard version: 7.0.4+f7ff984
[15:57:42 INFO]: [TARDIS] CoreProtect version: 19.5
[15:57:42 INFO]: [TARDIS] GriefPrevention version: 16.17.1-2b69191
[15:57:42 INFO]: [TARDIS] Checking for new TARDIS builds...
I should also add that if a player logs out or gets disconnected while in the time vortex with the junk TARDIS, they will be killed instantly upon logging back in. Perhaps we should implement something to safely transport players out of the junk TARDIS vortex world when they log back in? This is a huge edge case but it would suck to lose network connection while using the junk TARDIS and lose all your stuff because of it.
Edit: Here's a video to better explain it: https://youtu.be/nce4CAMR8K4
dd2d3d6 should take care of log spam, I'll see if something can be done for logging back in later