mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-23 02:35:25 +01:00
Reenable reload command but add a warning message
This commit is contained in:
parent
69e30ef992
commit
80b856f7c0
@ -91,6 +91,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
|
||||
new me.goodandevil.skyblock.command.commands.admin.OwnerCommand(),
|
||||
new me.goodandevil.skyblock.command.commands.admin.RemoveHologramCommand(),
|
||||
new me.goodandevil.skyblock.command.commands.admin.RemoveUpgradeCommand(),
|
||||
new me.goodandevil.skyblock.command.commands.admin.ReloadCommand(),
|
||||
new me.goodandevil.skyblock.command.commands.admin.SetHologramCommand(),
|
||||
new me.goodandevil.skyblock.command.commands.admin.SetSizeCommand(),
|
||||
new me.goodandevil.skyblock.command.commands.admin.SetSpawnCommand(),
|
||||
|
@ -1,4 +1,4 @@
|
||||
package me.goodandevil.skyblock.command.commands.admin.disabled;
|
||||
package me.goodandevil.skyblock.command.commands.admin;
|
||||
|
||||
import me.goodandevil.skyblock.command.SubCommand;
|
||||
import me.goodandevil.skyblock.config.FileManager;
|
||||
@ -39,6 +39,12 @@ public class ReloadCommand extends SubCommand {
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
|
||||
messageManager.sendMessage(sender, "&cPlease note that this command is not supported and may" +
|
||||
"cause issues that will make the status of the plugin unrecoverable. " +
|
||||
"If you encounter any issues please stop your server, edit the configuration files, " +
|
||||
"and then start your server again. This command does NOT reload all the plugin files, only " +
|
||||
"the config.yml, language.yml, generators.yml, and levelling.yml.");
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
@ -28,54 +28,46 @@ public class CurrentCommand extends SubCommand {
|
||||
|
||||
if (args.length > 0) {
|
||||
if (!args[0].equalsIgnoreCase(player.getName())) {
|
||||
if (player.hasPermission("fabledskyblock.current") || player.hasPermission("fabledskyblock.*")) {
|
||||
if (args.length == 1) {
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
||||
if (args.length == 1) {
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
||||
|
||||
if (targetPlayer == null) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Current.Offline.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!targetPlayer.getName().equals(player.getName())) {
|
||||
PlayerData playerData = playerDataManager.getPlayerData(targetPlayer);
|
||||
|
||||
if (playerData.getIsland() == null) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Current.Island.None.Other.Message"));
|
||||
} else {
|
||||
String targetPlayerName = targetPlayer.getName(), ownerPlayerName;
|
||||
targetPlayer = Bukkit.getServer().getPlayer(playerData.getIsland());
|
||||
|
||||
if (targetPlayer == null) {
|
||||
ownerPlayerName = new OfflinePlayer(playerData.getIsland()).getName();
|
||||
} else {
|
||||
ownerPlayerName = targetPlayer.getName();
|
||||
}
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Current.Island.Owner.Other.Message")
|
||||
.replace("%target", targetPlayerName)
|
||||
.replace("%owner", ownerPlayerName));
|
||||
}
|
||||
|
||||
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (args.length > 1) {
|
||||
if (targetPlayer == null) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Current.Invalid.Message"));
|
||||
configLoad.getString("Command.Island.Current.Offline.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (!targetPlayer.getName().equals(player.getName())) {
|
||||
PlayerData playerData = playerDataManager.getPlayerData(targetPlayer);
|
||||
|
||||
if (playerData.getIsland() == null) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Current.Island.None.Other.Message"));
|
||||
} else {
|
||||
String targetPlayerName = targetPlayer.getName(), ownerPlayerName;
|
||||
targetPlayer = Bukkit.getServer().getPlayer(playerData.getIsland());
|
||||
|
||||
if (targetPlayer == null) {
|
||||
ownerPlayerName = new OfflinePlayer(playerData.getIsland()).getName();
|
||||
} else {
|
||||
ownerPlayerName = targetPlayer.getName();
|
||||
}
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Current.Island.Owner.Other.Message")
|
||||
.replace("%target", targetPlayerName)
|
||||
.replace("%owner", ownerPlayerName));
|
||||
}
|
||||
|
||||
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (args.length > 1) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Current.Permission.Message"));
|
||||
configLoad.getString("Command.Island.Current.Invalid.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
|
@ -34,26 +34,18 @@ public class InformationCommand extends SubCommand {
|
||||
UUID islandOwnerUUID = null;
|
||||
|
||||
if (args.length == 1) {
|
||||
if (player.hasPermission("fabledskyblock.information") || player.hasPermission("fabledskyblock.*")) {
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
||||
|
||||
if (targetPlayer == null) {
|
||||
OfflinePlayer targetOfflinePlayer = new OfflinePlayer(args[0]);
|
||||
islandOwnerUUID = targetOfflinePlayer.getOwner();
|
||||
} else {
|
||||
islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner();
|
||||
}
|
||||
|
||||
if (islandOwnerUUID == null) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Information.Island.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
if (targetPlayer == null) {
|
||||
OfflinePlayer targetOfflinePlayer = new OfflinePlayer(args[0]);
|
||||
islandOwnerUUID = targetOfflinePlayer.getOwner();
|
||||
} else {
|
||||
islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner();
|
||||
}
|
||||
|
||||
if (islandOwnerUUID == null) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Information.Permission.Message"));
|
||||
configLoad.getString("Command.Island.Information.Island.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
|
@ -41,47 +41,40 @@ public class LevelCommand extends SubCommand {
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
if (player.hasPermission("fabledskyblock.level") || player.hasPermission("fabledskyblock.*")) {
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
||||
UUID islandOwnerUUID = null;
|
||||
String targetPlayerName;
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
||||
UUID islandOwnerUUID = null;
|
||||
String targetPlayerName;
|
||||
|
||||
if (targetPlayer == null) {
|
||||
OfflinePlayer targetOfflinePlayer = new OfflinePlayer(args[0]);
|
||||
islandOwnerUUID = targetOfflinePlayer.getOwner();
|
||||
targetPlayerName = targetOfflinePlayer.getName();
|
||||
} else {
|
||||
islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner();
|
||||
targetPlayerName = targetPlayer.getName();
|
||||
}
|
||||
|
||||
if (islandOwnerUUID == null) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Level.Owner.Other.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
} else if (!islandOwnerUUID.equals(playerDataManager.getPlayerData(player).getOwner())) {
|
||||
if (visitManager.hasIsland(islandOwnerUUID)) {
|
||||
me.goodandevil.skyblock.visit.Visit visit = visitManager.getIsland(islandOwnerUUID);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Level.Level.Message")
|
||||
.replace("%player", targetPlayerName).replace("%level",
|
||||
"" + NumberUtil.formatNumberByDecimal(visit.getLevel().getLevel())));
|
||||
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Level.Owner.Other.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
if (targetPlayer == null) {
|
||||
OfflinePlayer targetOfflinePlayer = new OfflinePlayer(args[0]);
|
||||
islandOwnerUUID = targetOfflinePlayer.getOwner();
|
||||
targetPlayerName = targetOfflinePlayer.getName();
|
||||
} else {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Level.Permission.Message"));
|
||||
islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner();
|
||||
targetPlayerName = targetPlayer.getName();
|
||||
}
|
||||
|
||||
if (islandOwnerUUID == null) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Level.Owner.Other.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
} else if (!islandOwnerUUID.equals(playerDataManager.getPlayerData(player).getOwner())) {
|
||||
if (visitManager.hasIsland(islandOwnerUUID)) {
|
||||
me.goodandevil.skyblock.visit.Visit visit = visitManager.getIsland(islandOwnerUUID);
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Level.Level.Message")
|
||||
.replace("%player", targetPlayerName).replace("%level",
|
||||
"" + NumberUtil.formatNumberByDecimal(visit.getLevel().getLevel())));
|
||||
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Level.Owner.Other.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
|
@ -31,41 +31,36 @@ public class ValueCommand extends SubCommand {
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (player.hasPermission("fabledskyblock.value") || player.hasPermission("fabledskyblock.*")) {
|
||||
if (player.getItemInHand() == null) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Value.Hand.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
Materials materials = null;
|
||||
|
||||
if (NMSUtil.getVersionNumber() < 13) {
|
||||
materials = Materials.requestMaterials(player.getItemInHand().getType().name(),
|
||||
(byte) player.getItemInHand().getDurability());
|
||||
} else {
|
||||
materials = Materials.fromString(player.getItemInHand().getType().name());
|
||||
}
|
||||
|
||||
if (materials != null && levellingManager.containsMaterial(materials)) {
|
||||
LevellingMaterial material = levellingManager.getMaterial(materials);
|
||||
double level = (double) material.getPoints()
|
||||
/ (double) fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getInt("Island.Levelling.Division");
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Value.Value.Message")
|
||||
.replace("%material",
|
||||
WordUtils.capitalizeFully(materials.name().toLowerCase().replace("_", " ")))
|
||||
.replace("%points", "" + material.getPoints())
|
||||
.replace("%level", "" + NumberUtil.formatNumberByDecimal(level)));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Value.None.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Value.Permission.Message"));
|
||||
if (player.getItemInHand() == null) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Value.Hand.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
Materials materials = null;
|
||||
|
||||
if (NMSUtil.getVersionNumber() < 13) {
|
||||
materials = Materials.requestMaterials(player.getItemInHand().getType().name(),
|
||||
(byte) player.getItemInHand().getDurability());
|
||||
} else {
|
||||
materials = Materials.fromString(player.getItemInHand().getType().name());
|
||||
}
|
||||
|
||||
if (materials != null && levellingManager.containsMaterial(materials)) {
|
||||
LevellingMaterial material = levellingManager.getMaterial(materials);
|
||||
double level = (double) material.getPoints()
|
||||
/ (double) fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getInt("Island.Levelling.Division");
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Value.Value.Message")
|
||||
.replace("%material",
|
||||
WordUtils.capitalizeFully(materials.name().toLowerCase().replace("_", " ")))
|
||||
.replace("%points", "" + material.getPoints())
|
||||
.replace("%level", "" + NumberUtil.formatNumberByDecimal(level)));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Value.None.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user