[1.8.3] NullPointerException with portals going from survival to creative gamemode worlds
RoyCurtis opened this issue ยท 7 comments
Summary
If a player enters a portal that teleports them from a world with Survival gamemode, into one with a Creative gamemode, the following happens:
- The teleport occurs and a teleport event is fired, as normal
- Upon arriving at the other end, another teleport event is fired but with
null
destination - This causes a lot of plugins, such as Multiverse-Core, Multiverse-Portals, Multiverse-Inventories, WorldGuard and zPermissions to throw a NullPointerException as they receive the event
After exhaustive testing, I have determined that this bug only happens:
- After one of the Spigot 1.8.3 updates
- When the destination is a spawn point (e.g.
w:world_creative
) - When the destination's game mode is either
CREATIVE
orSPECTATOR
(notADVENTURE
) and the source's game mode isSURVIVAL
- Teleporting via a portal; using
/mvtp
does not trigger this bug at all - Regardless of the use of 'Multiverse-NetherPortals' to disable vanilla nether portals in the world
Breakpointing through the code of Multiverse-Core and Multiverse-Portals, I was unable to determine the source of the event. I do not know if it is thrown by a plugin, or within Spigot. Could setting flight mode be at fault?
Details
- Using a special fork of Multiverse-Portals with WorldEdit fixes (courtesy of @TWSSYesterday)
- Tested using the latest dev build of Multiverse-Core and a special fork with fixes
This server is running CraftBukkit version git-Spigot-ea179b3-6e0120a (MC: 1.8.3) (Implementing API version 1.8.3-R0.1-SNAPSHOT)
- Tested in two environments:
Logs
- Full debug log when entering an affected portal: https://gist.github.com/RoyCurtis/588160e679ab88efa58f
- Patial debug log on production server when entering an affected portal, with workaround patch: https://gist.github.com/RoyCurtis/937a87a48b3ba9cc8cef
Reproduction
- Create a new world:
/mv create test normal
- Set current world to survival:
/mvm set mode survival
- Set test world to creative:
/mvm set mode creative test
- Create a 4 by 5 obsidian frame, select it with the Multiverse wand
- Execute
/mvp create world2test w:test
and ignite the portal - Go through the portal
- Observe the teleport succeeds, but at least two NullPointerExceptions appear on the console
Workaround
I patched Multiverse-Core to discard teleport events with null destinations. However, this is a hacky approach and some plugins (e.g. WorldGuard) will still try to handle this event.
The code for this patch may be found here: https://github.com/Gamealition/Multiverse-Core/commit/95939b80b9b13754d472c811bdc089504e2b8214
A week or so ago we switched back to using Multiverse's CI builds, and the issue seems to still be present (to the extent we had to mute it with a log4j configuration).
Here is a console log of what happens when using a portal from world
to world_creative
. I should note also; on the Minecraft client, it looks as if I get teleported somewhere else first, and then in world_creative
but with an upwards velocity as if I had been "rejected" from a portal.
Server details as of today:
CraftBukkit version git-Spigot-76236cb-62a2169 (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT)
- Output of
mv version
- Multiverse-NetherPortals links:
[11:07:12 INFO]: --- NetherPortal Links ---
[11:07:12 INFO]: world -> world_nether
[11:07:12 INFO]: resource -> resource_nether
[11:07:12 INFO]: world_creative -> world_creative
I will have to re-try the entire reproduction and testing procedure, which I am unable to do for a few days, to give a more accurate answer (e.g. if this is a Spigot issue).
Hi @RoyCurtis, this is a well written bug report, so you don't get my typical copy paste :) I am trying to clean up our issue tracker, but am unable to reproduce the issues you describe with Spigot 1.9.
Here are my logs, nothing new after creating the portal:
[14:05:03 INFO]: fernferret issued server command: /mvp create world2test w:test
>
My version is (yes, I'm already 19 commits behind!):
[14:06:26 INFO]: This server is running CraftBukkit version git-Spigot-b39373b-73eff0d (MC: 1.9) (Implementing API version 1.9-R0.1-SNAPSHOT)
Have you had a chance to re-test this?
Thank you again for your awesome bug report, I'll be linking other people here and maybe stealing it for our wiki!
No problem; glad to have been of help, please feel free to use as an example.
As for this issue; It may be a while until I can re-test. Our server will not be updating to 1.9 for a long time.
I should mention also there are other symptoms of this issue. We've been hiding the exception using log4j filters, but aside from the exception this bug will do one of two things randomly:
- Double teleport, as described in the OP
- Teleport the player to
world_the_end
instead. This is despite the fact the portal is a nether one. This has become the more likely symptom over the last few months for unknown reasons.
As a workaround, we've been replacing the purple portal blocks with water. It fixes both symptoms, but I never checked if it also fixes the exception. Again, we may eventually get around to testing this on 1.9.
Hmm yea, I bet it has something to do with event firing orders and whatnot. I imagine 1.9 has changed quite a bit so maybe that fixed it?
I won't have time for a while, but I may be able to get around testing with 1.8.? (what version of spigot are you on?)
Anywho, if you've seen me closing tons of issues around our tracker, I'm trying to make the ones that are actual, well documented, well written issues open so we can solve them.
Sorry for the slow response; here's the version for our 1.8.9 server:
[07:42:59 INFO]: This server is running CraftBukkit version git-Spigot-db6de12-3f3c65f (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT)
[07:42:59 INFO]: Checking version, please wait...
[07:43:03 INFO]: You are 174 version(s) behind
We still don't have any further information or testing to contribute at the moment
Closing ticket because it's years old. Update to the latest versions of Multiverse (Core, Portals and any others you may use). Please open a new ticket if this issue persists or for a faster response, you can also receive support on the Multiverse Discord.