mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-27 20:56:05 +01:00
Added messages to language.yml and added the remove water on tp option
This commit is contained in:
parent
8c5be9bfe2
commit
ccba2db000
@ -11,9 +11,13 @@ import com.songoda.skyblock.message.MessageManager;
|
|||||||
import com.songoda.skyblock.playerdata.PlayerDataManager;
|
import com.songoda.skyblock.playerdata.PlayerDataManager;
|
||||||
import com.songoda.skyblock.sound.SoundManager;
|
import com.songoda.skyblock.sound.SoundManager;
|
||||||
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
||||||
|
import com.songoda.skyblock.utils.world.LocationUtil;
|
||||||
import com.songoda.skyblock.visit.Visit;
|
import com.songoda.skyblock.visit.Visit;
|
||||||
import com.songoda.skyblock.visit.VisitManager;
|
import com.songoda.skyblock.visit.VisitManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.data.Waterlogged;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -105,7 +109,19 @@ public class TeleportCommand extends SubCommand {
|
|||||||
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
|
Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
|
||||||
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
|
Location loc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Main);
|
||||||
|
if(skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||||
|
.getFileConfiguration().getBoolean("Island.Teleport.RemoveWater", false)){
|
||||||
|
Location tempLoc = LocationUtil.getDefinitiveLocation(loc);
|
||||||
|
if(tempLoc.getBlock().getType().equals(Material.WATER)){
|
||||||
|
tempLoc.getBlock().setType(Material.AIR);
|
||||||
|
} else if(tempLoc.getBlock().getBlockData() instanceof Waterlogged){
|
||||||
|
Waterlogged blockData = (Waterlogged) tempLoc.getBlock().getBlockData();
|
||||||
|
blockData.setWaterlogged(false);
|
||||||
|
tempLoc.getBlock().setBlockData(blockData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.teleport(loc);
|
||||||
|
|
||||||
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
|
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
|
||||||
player.setFallDistance(0.0F);
|
player.setFallDistance(0.0F);
|
||||||
|
@ -1061,7 +1061,9 @@ public class IslandManager {
|
|||||||
player.setFallDistance(0.0F);
|
player.setFallDistance(0.0F);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cNessuna posizione sicura trovata!")); // TODO: Use language.yml
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&',
|
||||||
|
Objects.requireNonNull(skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||||
|
.getFileConfiguration().getString("Island.Teleport.Unsafe.Message"))));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (scoreboardManager != null) {
|
if (scoreboardManager != null) {
|
||||||
@ -1099,7 +1101,9 @@ public class IslandManager {
|
|||||||
player.setFallDistance(0.0F);
|
player.setFallDistance(0.0F);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cNessuna posizione sicura trovata!")); // TODO: Use language.yml
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&',
|
||||||
|
Objects.requireNonNull(skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||||
|
.getFileConfiguration().getString("Island.Teleport.Unsafe.Message"))));
|
||||||
}
|
}
|
||||||
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
|
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
|
||||||
player.setFallDistance(0.0F);
|
player.setFallDistance(0.0F);
|
||||||
|
@ -13,11 +13,9 @@ import com.songoda.skyblock.sound.SoundManager;
|
|||||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||||
import com.songoda.skyblock.utils.world.LocationUtil;
|
import com.songoda.skyblock.utils.world.LocationUtil;
|
||||||
import com.songoda.skyblock.world.WorldManager;
|
import com.songoda.skyblock.world.WorldManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.*;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.block.data.Waterlogged;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -194,6 +192,17 @@ public class Move implements Listener {
|
|||||||
loc = LocationUtil.getSafeLocation(island.getLocation(world, IslandEnvironment.Main));
|
loc = LocationUtil.getSafeLocation(island.getLocation(world, IslandEnvironment.Main));
|
||||||
} else {
|
} else {
|
||||||
loc = island.getLocation(world, IslandEnvironment.Main);
|
loc = island.getLocation(world, IslandEnvironment.Main);
|
||||||
|
if(skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||||
|
.getFileConfiguration().getBoolean("Island.Teleport.RemoveWater", false)){
|
||||||
|
Location tempLoc = LocationUtil.getDefinitiveLocation(loc);
|
||||||
|
if(tempLoc.getBlock().getType().equals(Material.WATER)){
|
||||||
|
tempLoc.getBlock().setType(Material.AIR);
|
||||||
|
} else if(tempLoc.getBlock().getBlockData() instanceof Waterlogged){
|
||||||
|
Waterlogged blockData = (Waterlogged) tempLoc.getBlock().getBlockData();
|
||||||
|
blockData.setWaterlogged(false);
|
||||||
|
tempLoc.getBlock().setBlockData(blockData);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)) {
|
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)) {
|
||||||
@ -206,7 +215,9 @@ public class Move implements Listener {
|
|||||||
player.teleport(loc);
|
player.teleport(loc);
|
||||||
} else {
|
} else {
|
||||||
LocationUtil.teleportPlayerToSpawn(player);
|
LocationUtil.teleportPlayerToSpawn(player);
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cNessuna posizione sicura trovata!")); // TODO: Use language.yml
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&',
|
||||||
|
Objects.requireNonNull(skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||||
|
.getFileConfiguration().getString("Command.Island.Teleport.Unsafe.Message"))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import org.bukkit.*;
|
|||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.Waterlogged;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -47,6 +48,19 @@ public final class LocationUtil {
|
|||||||
return locChecked;
|
return locChecked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Location getDefinitiveLocation(Location loc){
|
||||||
|
Location locWorking = loc.clone();
|
||||||
|
for(int i=locWorking.getBlockY(); i>=0; i--){
|
||||||
|
if(!locWorking.getBlock().isEmpty()){
|
||||||
|
if(locWorking.getBlock().getType().equals(Material.WATER) || locWorking.getBlock().getBlockData() instanceof Waterlogged){
|
||||||
|
loc = locWorking;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return loc;
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean checkBlock(Location locChecked) {
|
private static boolean checkBlock(Location locChecked) {
|
||||||
boolean safe = false;
|
boolean safe = false;
|
||||||
if(!locChecked.getBlock().isEmpty() &&
|
if(!locChecked.getBlock().isEmpty() &&
|
||||||
|
@ -317,6 +317,7 @@ Island:
|
|||||||
Teleport:
|
Teleport:
|
||||||
# Enable or disable Fall damage
|
# Enable or disable Fall damage
|
||||||
FallDamage: true
|
FallDamage: true
|
||||||
|
RemoveWater: true
|
||||||
Limits:
|
Limits:
|
||||||
# Should slime split bypass limits.yml
|
# Should slime split bypass limits.yml
|
||||||
AllowSlimeSplit: true
|
AllowSlimeSplit: true
|
||||||
|
@ -905,6 +905,8 @@ Command:
|
|||||||
Message: '&bSkyBlock &8| &aInfo&8: &eYou have been teleported to your Island.'
|
Message: '&bSkyBlock &8| &aInfo&8: &eYou have been teleported to your Island.'
|
||||||
Other:
|
Other:
|
||||||
Message: '&bSkyBlock &8| &aInfo&8: &eYou have been teleported to &a%player''s &eIsland.'
|
Message: '&bSkyBlock &8| &aInfo&8: &eYou have been teleported to &a%player''s &eIsland.'
|
||||||
|
Unsafe:
|
||||||
|
Message: '&bSkyBlock &8| &cError&8: &eNo safe position found'
|
||||||
Create:
|
Create:
|
||||||
Owner:
|
Owner:
|
||||||
Message: '&bSkyBlock &8| &cError&8: &eYou are already an Island Owner.'
|
Message: '&bSkyBlock &8| &cError&8: &eYou are already an Island Owner.'
|
||||||
|
Loading…
Reference in New Issue
Block a user