Partially reverted teleport falldamage protection option and initially fixed value

This commit is contained in:
Fabrizio La Rosa 2020-06-13 17:44:06 +02:00
parent d2cf9edf09
commit 61f8524f11
6 changed files with 15 additions and 38 deletions

View File

@ -107,7 +107,7 @@ public class TeleportCommand extends SubCommand {
Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
}
});

View File

@ -258,9 +258,7 @@ public class IslandManager {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(skyblock, () -> {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
player.setFallDistance(0.0F);
}
player.setFallDistance(0.0F);
}, configLoad.getInt("Island.Creation.TeleportTimeout") * 20);
String biomeName = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getString("Island.Biome.Default.Type").toUpperCase();
@ -1038,7 +1036,7 @@ public class IslandManager {
Location loc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Main);
if(loc != null){
player.teleport(loc);
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
}
} else {
@ -1080,13 +1078,13 @@ public class IslandManager {
}
if(loc != null){
player.teleport(loc);
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
}
} else {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cNessuna posizione sicura trovata!")); // TODO: Use language.yml
}
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
}
});

View File

@ -47,9 +47,7 @@ public class Death implements Listener {
if (configLoad.getBoolean("Island.Death.AutoRespawn")) {
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> {
player.spigot().respawn();
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
player.setFallDistance(0.0F);
}
player.setFallDistance(0.0F);
player.setFireTicks(0);
}, 1L);
}

View File

@ -60,9 +60,7 @@ public class Join implements Listener {
LocationUtil.teleportPlayerToSpawn(player);
} else if (configLoad.getBoolean("Island.Join.Island") && island != null) {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
player.setFallDistance(0.0F);
}
player.setFallDistance(0.0F);
teleportedToIsland = true;
}

View File

@ -109,10 +109,7 @@ public class Move implements Listener {
if (configLoad.getBoolean("Island.World." + world.name() + ".Liquid.Enable")) {
if (to.getY() <= configLoad.getInt("Island.World." + world.name() + ".Liquid.Height")) {
if (keepItemsOnDeath && configLoad.getBoolean("Island.Liquid.Teleport.Enable")) {
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
player.setFallDistance(0.0F);
}
player.setFallDistance(0.0F);
teleportPlayerToIslandSpawn(player, soundManager, island);
}
return;
@ -138,11 +135,7 @@ public class Move implements Listener {
player.removePotionEffect(potionEffect.getType());
}
}
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
player.setFallDistance(0.0F);
}
}
player.setFallDistance(0.0F);
if (configLoad.getBoolean("Island.Void.Teleport.Island")) {
teleportPlayerToIslandSpawn(player, island);
@ -150,9 +143,7 @@ public class Move implements Listener {
LocationUtil.teleportPlayerToSpawn(player);
}
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
player.setFallDistance(0.0F);
}
player.setFallDistance(0.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
}
}
@ -163,9 +154,7 @@ public class Move implements Listener {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
player.setFallDistance(0.0F);
}
player.setFallDistance(0.0F);
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
.getString("Island.WorldBorder.Outside.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
@ -228,7 +217,7 @@ public class Move implements Listener {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
}
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);

View File

@ -134,9 +134,7 @@ public class Portal implements Listener {
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);
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
player.setFallDistance(0.0F);
}
player.setFallDistance(0.0F);
tick.setTick(1);
}
break;
@ -146,9 +144,7 @@ public class Portal implements Listener {
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);
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
player.setFallDistance(0.0F);
}
player.setFallDistance(0.0F);
tick.setTick(1);
}
break;
@ -157,9 +153,7 @@ public class Portal implements Listener {
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);
if(!configLoad.getBoolean("Island.Teleport.FallDamage")){
player.setFallDistance(0.0F);
}
player.setFallDistance(0.0F);
tick.setTick(1);
break;
}