WorldBorder

WorldBorder

1M Downloads

Players getting teleported below y=0

sbienkow opened this issue ยท 9 comments

commented

Players keep getting teleported below y=0 when they hit the world border. This mostly happens in the nether.
My proposal is to add a PlayerTeleportEvent listener, check if the cause was PLUGIN and player destination's y value is below 0. In case that's true, teleport them to a safe spot (spawn point or some configurable spot, not sure yet of the possibilities / restrictions).
This would be an optional feature, that's off by default.

Any thoughts? Ideas?

I can create PR for that, if it gets accepted and I have some more time.

commented

You can run the command /wb debug on to enable debug logging. After that, if you can reproduce the problem of you being teleported underneath bedrock, you should be able to find some extra info for that in your server log.

If you can provide that debug data, it might help indicate what is happening.

commented

My family's server also has this problem. Specifically while flying using an Elytra in the Nether. The spawn point is a perfectly valid location to teleport to (on multiple Y-levels), but I keep getting teleported to underneath the bedrock. Thankfully I've been able to get into spectator mode fast enough, but its only a matter of time until I end up dead in the void. It's easily reproducible, as it happens ~90% of the time I hit the border while flying.

I'm happy to provide logs/etc and do more testing if needed.

commented

Absolutely. At work at the moment, but when I get home I'll turn on the debugging and get you some data. Thanks!

commented

Okay, the first three attempts here worked properly. The last two, WB couldn't find a valid location, and teleported me to spawn.
I did not understand spawn to be 0 0, so it wan't as wide open as I thought. However, I did check and there was a valid point at 0 0, but the plugin still teleported me to y=0. Then since I was inside the bedrock block at 0 0 0, I clipped through into the void.
After the first failure, I opened up the area to ensure there was indeed a valid block above y=0, but I had the same results.
wb_debug.txt

commented

OK, so the problem indicated there is that your spawn location for the Nether world is set to (0, 0, 0). When the spawn location is used as a fallback, WorldBorder does not do anything to make sure that spawn position is viable, it is assumed to be usable.

A simple workaround in that case is to go to a safe spot in the nether as an Op on the server and run the vanilla /setworldspawn command, to fix the spawn location being set at (0, 0, 0).

commented

Hey, awesome! It didn't click in my brain that my world's spawn was set to y=0 by default. I wonder if that's the case with @sbienkow?
EDIT: I guess its the case that bedrock is never selected as a valid teleportation block? We use the nether roof as a means of travel and I can't ever remember not being teleported into the actual nether when hitting the world border.
Thanks a lot! Great mod, and thanks for the free support!

commented

Hey,
Sorry, got a bit busy :)
I wrote a very simple plugin and it looks like it's the case:

> listspawns
[15:11:26 INFO]: [world] x=160, y=68, z=0
[15:11:26 INFO]: [world_nether] x=0, y=0, z=0
[15:11:26 INFO]: [world_the_end] x=0, y=0, z=0

The nether and the end spawnpoints are indeed 0, 0, 0.

@Brettflan would you be interested in a PR with changes to the teleportation logic, which uses one of the recent player locations instead?
EDIT: Not instead, but before falling back on current logic
Rough idea:
In the border check runnable, if player is inside the border, add his location to some list (that holds X last player positions). When he hits the border, select last position that's still valid (border or block positions might have changed).
Higher chances for finding a spot that make sense, probably also less load and need for a fallback to spawnpoint.
Also, add a warning in logs if worldspawnpoint y <= 1 or so - so that there won't be more issues like this one :)

Thanks for your great mod!

commented

WorldBorder normally will never teleport a player below 0 Y level. It stops checking further down at 0, and unless the player is flying, requires a safe block to stand on below the target location anyway.
https://github.com/Brettflan/WorldBorder/blob/master/src/main/java/com/wimbli/WorldBorder/BorderData.java#L407

The only way it should be able to teleport the player below that is if it can't find a safe spot and thus defaults back to the world's spawn location, and the world's spawn location has that problem.
https://github.com/Brettflan/WorldBorder/blob/master/src/main/java/com/wimbli/WorldBorder/BorderCheckTask.java#L141

commented

This happened a few times already, to me and our players. And it always happened when hitting the world border.

I see there's some debug logs, but I haven't seen them in console logs. I'll look for them.

If this happens to be true, what about remembering last safe location in the check task and teleporting player there instead?