mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-10-04 17:38:04 +02:00
Fixed teleportation bug.
This commit is contained in:
parent
2c86e6e89b
commit
eb5e7f3399
@ -74,7 +74,7 @@ public class Teleport implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player, configLoad.getString("Island.Settings.Permission.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Island.Settings.Permission.Message"));
|
||||||
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -178,18 +178,20 @@ public class Teleport implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityTeleport(EntityPortalEvent e) {
|
public void onEntityTeleport(EntityPortalEvent e) {
|
||||||
WorldManager worldManager = skyblock.getWorldManager();
|
WorldManager worldManager = skyblock.getWorldManager();
|
||||||
// Do not handle player
|
|
||||||
if (e.getEntityType() == EntityType.PLAYER)
|
|
||||||
return;
|
|
||||||
Location from = e.getFrom();
|
|
||||||
Location to = e.getTo();
|
|
||||||
// Test which world the event is from
|
|
||||||
if (from.getWorld() == to.getWorld())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (worldManager.getIslandWorld(e.getFrom().getWorld()) != null)
|
// Do not handle player
|
||||||
e.setCancelled(true);
|
if (e.getEntityType() == EntityType.PLAYER)
|
||||||
}
|
return;
|
||||||
|
|
||||||
|
Location from = e.getFrom();
|
||||||
|
Location to = e.getTo();
|
||||||
|
|
||||||
|
if (to == null || from.getWorld() == to.getWorld())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (worldManager.getIslandWorld(e.getFrom().getWorld()) != null)
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user