mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-07 03:00:29 +01:00
Added gamemode bypass for location safety check
This commit is contained in:
parent
a7878eedab
commit
8cb8f9578f
@ -1072,7 +1072,12 @@ public class IslandManager {
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
|
||||
Location loc = LocationUtil.getSafeLocation(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
|
||||
Location loc;
|
||||
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)) {
|
||||
loc = LocationUtil.getSafeLocation(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
|
||||
} else {
|
||||
loc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor);
|
||||
}
|
||||
if(loc != null){
|
||||
player.teleport(loc);
|
||||
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
|
||||
|
@ -15,6 +15,7 @@ import com.songoda.skyblock.utils.world.LocationUtil;
|
||||
import com.songoda.skyblock.world.WorldManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -193,24 +194,27 @@ public class Move implements Listener {
|
||||
}
|
||||
|
||||
private void teleportPlayerToIslandSpawn(Player player, IslandWorld world, Island island) {
|
||||
Location loc;
|
||||
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||
Location loc = LocationUtil.getSafeLocation(island.getLocation(world, IslandEnvironment.Main));
|
||||
if(loc != null){
|
||||
player.teleport(loc);
|
||||
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)) {
|
||||
loc = LocationUtil.getSafeLocation(island.getLocation(world, IslandEnvironment.Main));
|
||||
} else {
|
||||
LocationUtil.teleportPlayerToSpawn(player);
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cNessuna posizione sicura trovata!")); // TODO: Use language.yml
|
||||
loc = island.getLocation(world, IslandEnvironment.Main);
|
||||
}
|
||||
} else {
|
||||
Location loc = LocationUtil.getSafeLocation(island.getLocation(world, IslandEnvironment.Visitor));
|
||||
if(loc != null){
|
||||
player.teleport(loc);
|
||||
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)) {
|
||||
loc = LocationUtil.getSafeLocation(island.getLocation(world, IslandEnvironment.Visitor));
|
||||
} else {
|
||||
LocationUtil.teleportPlayerToSpawn(player);
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cNessuna posizione sicura trovata!")); // TODO: Use language.yml
|
||||
loc = island.getLocation(world, IslandEnvironment.Visitor);
|
||||
}
|
||||
}
|
||||
if(loc != null){
|
||||
player.teleport(loc);
|
||||
} else {
|
||||
LocationUtil.teleportPlayerToSpawn(player);
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cNessuna posizione sicura trovata!")); // TODO: Use language.yml
|
||||
}
|
||||
}
|
||||
|
||||
private void teleportPlayerToIslandSpawn(Player player, Island island) {
|
||||
|
Loading…
Reference in New Issue
Block a user