mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-07 03:00:29 +01:00
Fixed portals
This commit is contained in:
parent
e64b354252
commit
2c4bb357da
@ -119,9 +119,8 @@ public class Portal implements Listener {
|
||||
|
||||
PlayerEnterPortalEvent playerEnterPortalEvent = new PlayerEnterPortalEvent(player, player.getLocation()); // TODO Why?? - Fabrimat
|
||||
// Check permissions.
|
||||
if (!skyblock.getPermissionManager().processPermission(playerEnterPortalEvent,
|
||||
player, island))
|
||||
return;
|
||||
boolean perms = !skyblock.getPermissionManager().processPermission(playerEnterPortalEvent,
|
||||
player, island);
|
||||
|
||||
IslandWorld fromWorld = worldManager.getIslandWorld(player.getWorld());
|
||||
IslandWorld toWorld = IslandWorld.Normal;
|
||||
@ -132,21 +131,29 @@ public class Portal implements Listener {
|
||||
toWorld = fromWorld.equals(IslandWorld.Normal) ? IslandWorld.End : IslandWorld.Normal;
|
||||
}
|
||||
|
||||
switch (toWorld) {
|
||||
case End:
|
||||
case Nether:
|
||||
if (configLoad.getBoolean("Island.World." + toWorld.name() + ".Enable") && island.isRegionUnlocked(player, toWorld)) {
|
||||
teleportPlayerToWorld(player, soundManager, island, spawnEnvironment, tick, toWorld);
|
||||
}
|
||||
break;
|
||||
if(!perms){
|
||||
switch (toWorld) {
|
||||
case End:
|
||||
case Nether:
|
||||
if (configLoad.getBoolean("Island.World." + toWorld.name() + ".Enable") && island.isRegionUnlocked(player, toWorld)) {
|
||||
teleportPlayerToWorld(player, soundManager, island, spawnEnvironment, tick, toWorld);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
IslandWorld toWorldF = toWorld;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> player.teleport(island.getLocation(toWorldF, spawnEnvironment)), 1L);
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
|
||||
player.setFallDistance(0.0F);
|
||||
tick.setTick(1);
|
||||
break;
|
||||
default:
|
||||
IslandWorld toWorldF = toWorld;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> player.teleport(island.getLocation(toWorldF, spawnEnvironment)), 1L);
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
|
||||
player.setFallDistance(0.0F);
|
||||
tick.setTick(1);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if(toWorld.equals(IslandWorld.End)){
|
||||
player.setVelocity(player.getLocation().getDirection().multiply(-.50).setY(.6f));
|
||||
} else if(toWorld.equals(IslandWorld.Nether)) {
|
||||
player.setVelocity(player.getLocation().getDirection().multiply(-.50));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,9 +34,6 @@ public class PortalPermission extends ListeningPermission {
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
//player.teleport(getToLocation(event.getLocation(), player));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user