-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Minor
-
None
-
Affects Version/s: None
-
None
-
Environment:
Running on windows 10, Java 21 (jbr_jcef-21.0.3-windows-x64-b465).
Only running with test plugin.
-
This server is running CraftBukkit version 4223-Spigot-146439e-d01c70e (MC: 1.21) (Implementing API version 1.21-R0.1-SNAPSHOT)
-
Yes
Expected behavior
The vanilla teleportation behavior should either:
- Send the player to a different dimension, and to the right location, as if the player teleported from the location that triggered this event.
- Not trigger at all, as the player nolonger is at the original location
Observed/Actual behavior
In some cases the player teleports monodimensionally (Race condition?), also generating a destination portal, if necessary.
Steps/models to reproduce
Monodimensionall travel can be reproduced with this minimal(ish) reproducible script:
@EventHandler
void onPlayerMove(PlayerMoveEvent event) {
Location to = event.getTo();
Location from = event.getFrom();
if (from.getBlockX() == to.getBlockX() &&
from.getBlockY() == to.getBlockY() &&
from.getBlockZ() == to.getBlockZ()) {
return;
}
Material toType = to.getBlock().getType();
if (!Tag.PORTALS.isTagged(toType) || toType == Material.END_GATEWAY) {
return;
}
World originWorld = to.getWorld();
World targetWorld = switch (originWorld.getName()) {
case "world" -> {
if (toType == Material.END_PORTAL) {
yield Bukkit.getWorld("world_the_end");
}
yield Bukkit.getWorld("world_nether");
}
default -> Bukkit.getWorld("world");
};
Bukkit.getScheduler().runTask(this, () -> {
event.getPlayer().teleport(new Location(targetWorld, to.getBlockX(), to.getBlockX(), to.getBlockZ()));
});
}
To reproduce
- Start a new server with default world names with a plugin that contains the given script
- Make a nether portal
- Go through the nether portal in creative mode (not flying)
Other
Probably reproducible for entities as well. Can probably also be reproducible with end portals