Fixed players getting stuck in nether portals.
This is a workaround for the spigot bug where a PlayerTeleportEvent doesn't fire for portal teleportations.
This commit is contained in:
parent
65caae3737
commit
8c758ce28b
|
|
@ -768,6 +768,20 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//when a player teleports via a portal
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
void onPlayerPortal(PlayerPortalEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
//FEATURE: when players get trapped in a nether portal, send them back through to the other side
|
||||||
|
if(event.getCause() == TeleportCause.NETHER_PORTAL)
|
||||||
|
{
|
||||||
|
CheckForPortalTrapTask task = new CheckForPortalTrapTask(player, event.getFrom());
|
||||||
|
GriefPrevention.instance.getServer().getScheduler().scheduleSyncDelayedTask(GriefPrevention.instance, task, 100L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//when a player teleports
|
//when a player teleports
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerTeleport(PlayerTeleportEvent event)
|
public void onPlayerTeleport(PlayerTeleportEvent event)
|
||||||
|
|
@ -791,13 +805,6 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//FEATURE: when players get trapped in a nether portal, send them back through to the other side
|
|
||||||
if(event.getCause() == TeleportCause.NETHER_PORTAL)
|
|
||||||
{
|
|
||||||
CheckForPortalTrapTask task = new CheckForPortalTrapTask(player, event.getFrom());
|
|
||||||
GriefPrevention.instance.getServer().getScheduler().scheduleSyncDelayedTask(GriefPrevention.instance, task, 100L);
|
|
||||||
}
|
|
||||||
|
|
||||||
//FEATURE: prevent teleport abuse to win sieges
|
//FEATURE: prevent teleport abuse to win sieges
|
||||||
|
|
||||||
//these rules only apply to siege worlds only
|
//these rules only apply to siege worlds only
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user