}
}
public void handlePortalEnterNextTick(Player player, Location from) {
// Handle teleportation the next tick
final EntityPortalEvent portalEvent = new EntityPortalEvent(player, from, null, null);
CommonUtil.nextTick(new Runnable() {
public void run() {
handlePortalEnter(portalEvent, false);
if (portalEvent.getTo() != null && !portalEvent.isCancelled()) {
// Use a travel agent if needed
Location to = portalEvent.getTo();
if (portalEvent.useTravelAgent()) {
to = WorldUtil.findSpawnLocation(to);
}
// This tends to happen with Bukkit logic...haha
if (to == null) {
return;
}
// Note: We could use EntityUtil.teleport here...
// But why even bother, we would only add strange differences between teleports
portalEvent.getEntity().teleport(to);
}
}
});
}