Cleaned up portal cancellation.
This commit is contained in:
parent
022c343a98
commit
8984309c56
@ -9,12 +9,14 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -102,6 +104,8 @@ public class UHC extends TeamGame
|
||||
private boolean _portalCreated = false;
|
||||
private GameTeam _lastDragonDamager = null;
|
||||
|
||||
private Location _exitLocation = null;
|
||||
|
||||
public UHC(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.UHC,
|
||||
@ -178,29 +182,10 @@ public class UHC extends TeamGame
|
||||
@EventHandler
|
||||
public void endPortalTransfer(final PlayerPortalEvent event)
|
||||
{
|
||||
System.out.println(event.getCause());
|
||||
if (event.getCause() == TeleportCause.END_PORTAL)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
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()));
|
||||
event.getPlayer().teleport(((CraftServer)Bukkit.getServer()).getHandle().getServer().getPlayerList().calculateTarget(event.getPlayer().getLocation(), ((CraftWorld)Bukkit.getWorld("world_the_end")).getHandle()));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user