mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-02-04 05:41:30 +01:00
Portals will no longer teleport you into the abyss.
This commit is contained in:
parent
70ab779041
commit
29b0b6c6e5
@ -13,6 +13,7 @@ import me.goodandevil.skyblock.utils.version.Materials;
|
||||
import me.goodandevil.skyblock.utils.version.Sounds;
|
||||
import me.goodandevil.skyblock.utils.world.LocationUtil;
|
||||
import me.goodandevil.skyblock.world.WorldManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -63,21 +64,6 @@ public class Portal implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void OnEntityPortalTeleport(EntityPortalEvent event) {
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
|
||||
if (!worldManager.isIslandWorld(player.getWorld()))
|
||||
return;
|
||||
|
||||
event.useTravelAgent(false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityPortalEnter(EntityPortalEnterEvent event) {
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
@ -148,6 +134,8 @@ public class Portal implements Listener {
|
||||
|
||||
if (tick == null) return;
|
||||
|
||||
Bukkit.broadcastMessage("hit");
|
||||
|
||||
IslandWorld fromWorld = worldManager.getIslandWorld(player.getWorld());
|
||||
IslandWorld toWorld = IslandWorld.Normal;
|
||||
|
||||
@ -159,7 +147,8 @@ public class Portal implements Listener {
|
||||
switch (toWorld) {
|
||||
case Nether:
|
||||
if (configLoad.getBoolean("Island.World.Nether.Enable") && island.isRegionUnlocked(player, "Nether")) {
|
||||
player.teleport(island.getLocation(toWorld, spawnEnvironment));
|
||||
IslandWorld toWorldF = toWorld;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> player.teleport(island.getLocation(toWorldF, spawnEnvironment)), 1L);
|
||||
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
||||
player.setFallDistance(0.0F);
|
||||
tick.setTick(1);
|
||||
@ -168,7 +157,8 @@ public class Portal implements Listener {
|
||||
|
||||
case End:
|
||||
if (configLoad.getBoolean("Island.World.End.Enable") && island.isRegionUnlocked(player, "End")) {
|
||||
player.teleport(island.getLocation(toWorld, spawnEnvironment));
|
||||
IslandWorld toWorldF = toWorld;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> player.teleport(island.getLocation(toWorldF, spawnEnvironment)), 1L);
|
||||
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
||||
player.setFallDistance(0.0F);
|
||||
tick.setTick(1);
|
||||
@ -176,7 +166,8 @@ public class Portal implements Listener {
|
||||
break;
|
||||
|
||||
default:
|
||||
player.teleport(island.getLocation(toWorld, spawnEnvironment));
|
||||
IslandWorld toWorldF = toWorld;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> player.teleport(island.getLocation(toWorldF, spawnEnvironment)), 1L);
|
||||
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
||||
player.setFallDistance(0.0F);
|
||||
tick.setTick(1);
|
||||
|
Loading…
Reference in New Issue
Block a user