mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-16 12:43:52 -07:00
Compensate for allow-nether/allow-end as false; Fixes BUKKIT-3466
When either of those settings are false, the worlds are not loaded and therefore will not be targeted for portal exits. Existing worlds are iterated directly to avoid defaulting to the first world if a direct dimension match is not found. Plugins must also specify exit from custom Bukkit worlds to comply with original commit: https://github.com/Bukkit/CraftBukkit/commit/2dc2af0 This commit introduces a constant to clarify the dependency on the CraftBukkit implementation of custom worlds having a dimension offset.
This commit is contained in:
@@ -1750,10 +1750,20 @@ public abstract class Entity {
|
||||
MinecraftServer minecraftserver = MinecraftServer.getServer();
|
||||
// CraftBukkit start - move logic into new function "teleportToLocation"
|
||||
// int j = this.dimension;
|
||||
Location enter = this.getBukkitEntity().getLocation();
|
||||
Location exit = minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i));
|
||||
WorldServer exitWorld = null;
|
||||
if (this.dimension < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // plugins must specify exit from custom Bukkit worlds
|
||||
// only target existing worlds (compensate for allow-nether/allow-end as false)
|
||||
for (WorldServer world : minecraftserver.worlds) {
|
||||
if (world.dimension == i) {
|
||||
exitWorld = world;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TravelAgent agent = (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s();
|
||||
Location enter = this.getBukkitEntity().getLocation();
|
||||
Location exit = exitWorld != null ? minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i)) : null;
|
||||
|
||||
TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s() : null;
|
||||
EntityPortalEvent event = new EntityPortalEvent(this.getBukkitEntity(), enter, exit, agent);
|
||||
event.getEntity().getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled() || event.getTo() == null || !this.isAlive()) {
|
||||
|
Reference in New Issue
Block a user