diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 81472ac74..4831adce4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -33,6 +33,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityCreatePortalEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDeathEvent; @@ -185,12 +186,40 @@ public class UHC extends TeamGame } @EventHandler - public void endPortalTransfer(PlayerPortalEvent event) + public void endPortalTransfer(final PlayerPortalEvent event) { + System.out.println(event.getCause()); if (event.getCause() == TeleportCause.END_PORTAL) { event.setCancelled(true); - event.getPlayer().teleport(((CraftServer)Bukkit.getServer()).getHandle().getServer().getPlayerList().calculateTarget(event.getPlayer().getLocation(), ((CraftWorld)Bukkit.getWorld("world_the_end")).getHandle())); + + if (event.getPlayer().getLocation().getWorld() == Bukkit.getWorld("world_the_end")) + { + System.out.println("in teleport place"); + Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + if (event.getPlayer().isOnline()) + { + System.out.println("Teleporting player back to world: " + new Location(WorldData.World, 2.5, 70, 0.5)); + event.getPlayer().teleport(new Location(event.getPlayer().getWorld(), 2.5, 70, 0.5)); + event.getPlayer().sendMessage("Hi, get back in your world."); + } + } + }, 2L); + } + else + event.getPlayer().teleport(((CraftServer)Bukkit.getServer()).getHandle().getServer().getPlayerList().calculateTarget(event.getPlayer().getLocation(), ((CraftWorld)Bukkit.getWorld("world_the_end")).getHandle())); + } + } + + @EventHandler + public void endPortalCreation(final EntityCreatePortalEvent event) + { + if (event.getEntity() instanceof EnderDragon) + { + event.setCancelled(true); } }