mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-23 19:25:12 +01:00
Fix loop in nether portals (#1686)
* Fix loop in nether portals Close #1685 * Forgot to import
This commit is contained in:
parent
969b413588
commit
2bc5e59e9a
@ -12,6 +12,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -65,8 +66,9 @@ public class PortalTeleportationListener implements Listener {
|
||||
if (!(e.getEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
Entity entity = e.getEntity();
|
||||
Material type = e.getLocation().getBlock().getType();
|
||||
UUID uuid = e.getEntity().getUniqueId();
|
||||
UUID uuid = entity.getUniqueId();
|
||||
if (inPortal.contains(uuid) || !plugin.getIWM().inWorld(Util.getWorld(e.getLocation().getWorld()))) {
|
||||
return;
|
||||
}
|
||||
@ -75,8 +77,8 @@ public class PortalTeleportationListener implements Listener {
|
||||
// Schedule a time
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||
// Check again if still in portal
|
||||
if (type.equals(Material.NETHER_PORTAL)) {
|
||||
PlayerPortalEvent en = new PlayerPortalEvent((Player)e.getEntity(), e.getLocation(), null, TeleportCause.NETHER_PORTAL, 0, false, 0);
|
||||
if (entity.getLocation().getBlock().getType().equals(Material.NETHER_PORTAL)) {
|
||||
PlayerPortalEvent en = new PlayerPortalEvent((Player)entity, e.getLocation(), null, TeleportCause.NETHER_PORTAL, 0, false, 0);
|
||||
if (!this.onIslandPortal(en)) {
|
||||
// Failed
|
||||
inPortal.remove(uuid);
|
||||
@ -89,7 +91,7 @@ public class PortalTeleportationListener implements Listener {
|
||||
}
|
||||
// End portals are instant transfer
|
||||
if (!Bukkit.getAllowEnd() && (type.equals(Material.END_PORTAL) || type.equals(Material.END_GATEWAY))) {
|
||||
PlayerPortalEvent en = new PlayerPortalEvent((Player)e.getEntity(),
|
||||
PlayerPortalEvent en = new PlayerPortalEvent((Player)entity,
|
||||
e.getLocation(),
|
||||
null,
|
||||
type.equals(Material.END_PORTAL) ? TeleportCause.END_PORTAL : TeleportCause.END_GATEWAY,
|
||||
|
Loading…
Reference in New Issue
Block a user