diff --git a/src/main/java/me/goodandevil/skyblock/command/CommandManager.java b/src/main/java/me/goodandevil/skyblock/command/CommandManager.java index 4f6cd23f..0052ae1b 100644 --- a/src/main/java/me/goodandevil/skyblock/command/CommandManager.java +++ b/src/main/java/me/goodandevil/skyblock/command/CommandManager.java @@ -136,11 +136,22 @@ public class CommandManager implements CommandExecutor, TabCompleter { } SubCommand subCommand; + boolean isAdmin; if (args[0].equalsIgnoreCase("help")) { if (player == null) { sendConsoleHelpCommands(sender); } else { + boolean canUseHelp = player.hasPermission("fabledskyblock.*") + || player.hasPermission("fabledskyblock.island.*") + || player.hasPermission("fabledskyblock.island.help"); + + if (!canUseHelp) { + messageManager.sendMessage(player, configLoad.getString("Command.PermissionDenied.Admin.Message")); + soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + return; + } + int page = -1; if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")) @@ -167,63 +178,76 @@ public class CommandManager implements CommandExecutor, TabCompleter { } else if (args[0].equalsIgnoreCase("admin")) { if (args.length == 1 || args[1].equalsIgnoreCase("help")) { if (player == null) { - if (player == null) { - sendConsoleHelpCommands(sender); - } else { - int page = -1; + sendConsoleHelpCommands(sender); + } else { + boolean canUseHelp = player.hasPermission("fabledskyblock.*") + || player.hasPermission("fabledskyblock.admin.*") + || player.hasPermission("fabledskyblock.admin.help"); - if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")) - .getFileConfiguration().getBoolean("Command.Help.List")) { - page = 1; + if (!canUseHelp) { + messageManager.sendMessage(player, configLoad.getString("Command.PermissionDenied.Admin.Message")); + soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + return; + } - if (args.length == 3) { - if (args[2].matches("[0-9]+")) { - page = Integer.valueOf(args[2]); - } else { - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Help.Integer.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, - 1.0F); + int page = -1; - return; - } + if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")) + .getFileConfiguration().getBoolean("Command.Help.List")) { + page = 1; + + if (args.length == 3) { + if (args[2].matches("[0-9]+")) { + page = Integer.valueOf(args[2]); + } else { + messageManager.sendMessage(player, + configLoad.getString("Command.Island.Help.Integer.Message")); + soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, + 1.0F); + + return; } } - - sendPlayerAdminHelpCommands(player, page); } - } else { - messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Help.Permission.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + + sendPlayerAdminHelpCommands(player, page); } return; } subCommand = getAdminSubCommand(args[1]); + isAdmin = true; } else { subCommand = getIslandSubCommand(args[0]); + isAdmin = false; } if (subCommand == null) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Argument.Unrecognised.Message")); + messageManager.sendMessage(sender, configLoad.getString("Command.Island.Argument.Unrecognised.Message")); soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); - } else { - List arguments = new ArrayList<>(); - arguments.addAll(Arrays.asList(args)); - arguments.remove(args[0]); + return; + } - if (adminCommands.contains(subCommand)) { - arguments.remove(args[1]); - } + if (!subCommand.hasPermission(player, isAdmin)) { + messageManager.sendMessage(player, configLoad.getString("Command.PermissionDenied." + (isAdmin ? "Admin" : "Island") + ".Message")); + soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + return; + } - if (sender instanceof Player) { - subCommand.onCommandByPlayer(player, arguments.toArray(new String[0])); - } else if (sender instanceof ConsoleCommandSender) { - subCommand.onCommandByConsole((ConsoleCommandSender) sender, - arguments.toArray(new String[0])); - } + List arguments = new ArrayList<>(); + arguments.addAll(Arrays.asList(args)); + arguments.remove(args[0]); + + if (adminCommands.contains(subCommand)) { + arguments.remove(args[1]); + } + + if (sender instanceof Player) { + subCommand.onCommandByPlayer(player, arguments.toArray(new String[0])); + } else if (sender instanceof ConsoleCommandSender) { + subCommand.onCommandByConsole((ConsoleCommandSender) sender, + arguments.toArray(new String[0])); } } }.runTaskAsynchronously(skyblock); @@ -390,19 +414,11 @@ public class CommandManager implements CommandExecutor, TabCompleter { if (page == -1) { for (SubCommand subCommand : subCommands) { - String commandAliases = ""; + StringBuilder commandAliases = new StringBuilder(); if (showAlises) { - for (int i1 = 0; i1 < subCommand.getAliases().length; i1++) { - if (i1 == 0) { - commandAliases = "/"; - } - - if (i1 == subCommand.getAliases().length - 1) { - commandAliases = commandAliases + subCommand.getAliases()[i1]; - } else { - commandAliases = commandAliases + subCommand.getAliases()[i1] + "/"; - } + for (int i = 0; i < subCommand.getAliases().length; i++) { + commandAliases.append("/").append(subCommand.getAliases()[i]); } } @@ -420,19 +436,11 @@ public class CommandManager implements CommandExecutor, TabCompleter { for (; index < endIndex; index++) { if (subCommands.size() > index) { SubCommand subCommandFromIndex = subCommands.get(index); - String commandAliases = ""; + StringBuilder commandAliases = new StringBuilder(); if (showAlises) { for (int i = 0; i < subCommandFromIndex.getAliases().length; i++) { - if (i == 0) { - commandAliases = "/"; - } - - if (i == subCommandFromIndex.getAliases().length) { - commandAliases = commandAliases + subCommandFromIndex.getAliases()[i]; - } else { - commandAliases = commandAliases + subCommandFromIndex.getAliases()[i] + "/"; - } + commandAliases.append("/").append(subCommandFromIndex.getAliases()[i]); } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/AddUpgradeCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/AddUpgradeCommand.java index e003b4f1..45fb3ed8 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/AddUpgradeCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/AddUpgradeCommand.java @@ -1,20 +1,6 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; -import java.io.IOException; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; @@ -25,6 +11,16 @@ import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.upgrade.Upgrade; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.io.IOException; +import java.util.UUID; public class AddUpgradeCommand extends SubCommand { @@ -48,105 +44,92 @@ public class AddUpgradeCommand extends SubCommand { Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); FileConfiguration configLoad = config.getFileConfiguration(); - Player player = null; + if (args.length == 2) { + Player targetPlayer = Bukkit.getServer().getPlayer(args[0]); + UUID islandOwnerUUID; + String targetPlayerName; - if (sender instanceof Player) { - player = (Player) sender; - } - - if (player == null || player.hasPermission("fabledskyblock.admin.addupgrade") - || player.hasPermission("fabledskyblock.admin.*") || player.hasPermission("fabledskyblock.*")) { - if (args.length == 2) { - Player targetPlayer = Bukkit.getServer().getPlayer(args[0]); - UUID islandOwnerUUID; - String targetPlayerName; - - if (targetPlayer == null) { - OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]); - islandOwnerUUID = targetPlayerOffline.getOwner(); - targetPlayerName = targetPlayerOffline.getName(); - } else { - islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner(); - targetPlayerName = targetPlayer.getName(); - } - - Upgrade.Type upgrade = null; - - for (Upgrade.Type upgradeList : Upgrade.Type.values()) { - if (upgradeList != Upgrade.Type.Size) { - if (args[1].toUpperCase().equals(upgradeList.name().toUpperCase())) { - upgrade = upgradeList; - - break; - } - } - } - - if (islandOwnerUUID == null) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.AddUpgrade.Island.Owner.Message")); - soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); - } else if (upgrade == null) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Exist.Message")); - soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); - } else { - if (islandManager.containsIsland(islandOwnerUUID)) { - Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)); - - if (island.hasUpgrade(upgrade)) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Already.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - - return; - } - - island.setUpgrade(null, upgrade, true); - } else { - File islandDataFile = new File(skyblock.getDataFolder().toString() + "/island-data", - islandOwnerUUID.toString() + ".yml"); - - if (!fileManager.isFileExist(islandDataFile)) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.AddUpgrade.Island.Data.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - - return; - } - - FileConfiguration islandDataConfigLoad = YamlConfiguration.loadConfiguration(islandDataFile); - - if (islandDataConfigLoad.getString("Upgrade." + upgrade.name()) != null) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Already.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - - return; - } - - islandDataConfigLoad.set("Upgrade." + upgrade.name(), true); - - try { - islandDataConfigLoad.save(islandDataFile); - } catch (IOException e) { - e.printStackTrace(); - } - } - - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.AddUpgrade.Added.Message") - .replace("%player", targetPlayerName).replace("%upgrade", upgrade.name())); - soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F); - } + if (targetPlayer == null) { + OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]); + islandOwnerUUID = targetPlayerOffline.getOwner(); + targetPlayerName = targetPlayerOffline.getName(); } else { + islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner(); + targetPlayerName = targetPlayer.getName(); + } + + Upgrade.Type upgrade = null; + + for (Upgrade.Type upgradeList : Upgrade.Type.values()) { + if (upgradeList != Upgrade.Type.Size) { + if (args[1].toUpperCase().equals(upgradeList.name().toUpperCase())) { + upgrade = upgradeList; + + break; + } + } + } + + if (islandOwnerUUID == null) { messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.AddUpgrade.Invalid.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + configLoad.getString("Command.Island.Admin.AddUpgrade.Island.Owner.Message")); + soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); + } else if (upgrade == null) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Exist.Message")); + soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); + } else { + if (islandManager.containsIsland(islandOwnerUUID)) { + Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)); + + if (island.hasUpgrade(upgrade)) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Already.Message")); + soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + + return; + } + + island.setUpgrade(null, upgrade, true); + } else { + File islandDataFile = new File(skyblock.getDataFolder().toString() + "/island-data", + islandOwnerUUID.toString() + ".yml"); + + if (!fileManager.isFileExist(islandDataFile)) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.AddUpgrade.Island.Data.Message")); + soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + + return; + } + + FileConfiguration islandDataConfigLoad = YamlConfiguration.loadConfiguration(islandDataFile); + + if (islandDataConfigLoad.getString("Upgrade." + upgrade.name()) != null) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Already.Message")); + soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + + return; + } + + islandDataConfigLoad.set("Upgrade." + upgrade.name(), true); + + try { + islandDataConfigLoad.save(islandDataFile); + } catch (IOException e) { + e.printStackTrace(); + } + } + + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.AddUpgrade.Added.Message") + .replace("%player", targetPlayerName).replace("%upgrade", upgrade.name())); + soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F); } } else { messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.AddUpgrade.Permission.Message")); + configLoad.getString("Command.Island.Admin.AddUpgrade.Invalid.Message")); soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); } } @@ -157,8 +140,8 @@ public class AddUpgradeCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.AddUpgrade.Info.Message"; } @Override @@ -170,9 +153,4 @@ public class AddUpgradeCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/CreateCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/CreateCommand.java index 30616928..824bfb22 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/CreateCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/CreateCommand.java @@ -1,21 +1,12 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; -import me.goodandevil.skyblock.config.FileManager; -import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.menus.admin.Creator; import me.goodandevil.skyblock.playerdata.PlayerDataManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; public class CreateCommand extends SubCommand { @@ -23,24 +14,13 @@ public class CreateCommand extends SubCommand { public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); SoundManager soundManager = skyblock.getSoundManager(); - FileManager fileManager = skyblock.getFileManager(); - Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); - FileConfiguration configLoad = config.getFileConfiguration(); - - if (player.hasPermission("fabledskyblock.admin.create") || player.hasPermission("fabledskyblock.admin.*") - || player.hasPermission("fabledskyblock.*")) { - if (playerDataManager.hasPlayerData(player)) { - playerDataManager.getPlayerData(player).setViewer(null); - } - - Creator.getInstance().open(player); - soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F); - } else { - skyblock.getMessageManager().sendMessage(player, - configLoad.getString("Command.Island.Admin.Create.Permission.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + if (playerDataManager.hasPlayerData(player)) { + playerDataManager.getPlayerData(player).setViewer(null); } + + Creator.getInstance().open(player); + soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F); } @Override @@ -54,8 +34,8 @@ public class CreateCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.Create.Info.Message"; } @Override @@ -67,9 +47,4 @@ public class CreateCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/DeleteCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/DeleteCommand.java index 595b7f10..dc1f303d 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/DeleteCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/DeleteCommand.java @@ -1,20 +1,6 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; @@ -25,6 +11,16 @@ import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; import me.goodandevil.skyblock.utils.world.LocationUtil; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.UUID; public class DeleteCommand extends SubCommand { @@ -53,64 +49,58 @@ public class DeleteCommand extends SubCommand { player = (Player) sender; } - if (player == null || player.hasPermission("fabledskyblock.admin.delete") || player.hasPermission("fabledskyblock.admin.*") - || player.hasPermission("fabledskyblock.*")) { - if (args.length == 1) { - Player targetPlayer = Bukkit.getServer().getPlayer(args[0]); - UUID targetPlayerUUID; - String targetPlayerName; + if (args.length == 1) { + Player targetPlayer = Bukkit.getServer().getPlayer(args[0]); + UUID targetPlayerUUID; + String targetPlayerName; - if (targetPlayer == null) { - OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]); - targetPlayerUUID = targetPlayerOffline.getUniqueId(); - targetPlayerName = targetPlayerOffline.getName(); - } else { - targetPlayerUUID = targetPlayer.getUniqueId(); - targetPlayerName = targetPlayer.getName(); - } - - if (targetPlayerUUID == null || !islandManager.isIslandExist(targetPlayerUUID)) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.Delete.Owner.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } else { - Island island = islandManager.loadIsland(Bukkit.getServer().getOfflinePlayer(targetPlayerUUID)); - Location spawnLocation = LocationUtil.getSpawnLocation(); - - if (spawnLocation != null && islandManager.isLocationAtIsland(island, spawnLocation)) { - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.Delete.Spawn.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - - islandManager.unloadIsland(island, null); - - return; - } - - for (Player all : Bukkit.getOnlinePlayers()) { - if (island.hasRole(IslandRole.Member, all.getUniqueId()) - || island.hasRole(IslandRole.Operator, all.getUniqueId())) { - all.sendMessage(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Confirmation.Deletion.Broadcast.Message"))); - soundManager.playSound(all, Sounds.EXPLODE.bukkitSound(), 10.0F, 10.0F); - } - } - - island.setDeleted(true); - islandManager.deleteIsland(island); - - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.Delete.Deleted.Message").replace("%player", - targetPlayerName)); - soundManager.playSound(sender, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F); - } + if (targetPlayer == null) { + OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]); + targetPlayerUUID = targetPlayerOffline.getUniqueId(); + targetPlayerName = targetPlayerOffline.getName(); } else { - messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Delete.Invalid.Message")); + targetPlayerUUID = targetPlayer.getUniqueId(); + targetPlayerName = targetPlayer.getName(); + } + + if (targetPlayerUUID == null || !islandManager.isIslandExist(targetPlayerUUID)) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.Delete.Owner.Message")); soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + } else { + Island island = islandManager.loadIsland(Bukkit.getServer().getOfflinePlayer(targetPlayerUUID)); + Location spawnLocation = LocationUtil.getSpawnLocation(); + + if (spawnLocation != null && islandManager.isLocationAtIsland(island, spawnLocation)) { + messageManager.sendMessage(player, + configLoad.getString("Command.Island.Admin.Delete.Spawn.Message")); + soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + + islandManager.unloadIsland(island, null); + + return; + } + + for (Player all : Bukkit.getOnlinePlayers()) { + if (island.hasRole(IslandRole.Member, all.getUniqueId()) + || island.hasRole(IslandRole.Operator, all.getUniqueId())) { + all.sendMessage(ChatColor.translateAlternateColorCodes('&', + configLoad.getString("Command.Island.Confirmation.Deletion.Broadcast.Message"))); + soundManager.playSound(all, Sounds.EXPLODE.bukkitSound(), 10.0F, 10.0F); + } + } + + island.setDeleted(true); + islandManager.deleteIsland(island); + + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.Delete.Deleted.Message").replace("%player", + targetPlayerName)); + soundManager.playSound(sender, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F); } } else { - messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Delete.Permission.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Delete.Invalid.Message")); + soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); } } @@ -120,8 +110,8 @@ public class DeleteCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.Delete.Info.Message"; } @Override @@ -133,9 +123,4 @@ public class DeleteCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/GeneratorCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/GeneratorCommand.java index e8cb50c5..724f575d 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/GeneratorCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/GeneratorCommand.java @@ -1,15 +1,6 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.menus.admin.Generator; @@ -17,6 +8,11 @@ import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.playerdata.PlayerDataManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class GeneratorCommand extends SubCommand { @@ -30,12 +26,7 @@ public class GeneratorCommand extends SubCommand { Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); FileConfiguration configLoad = config.getFileConfiguration(); - if (!(player.hasPermission("fabledskyblock.admin.generator") || player.hasPermission("fabledskyblock.admin.*") - || player.hasPermission("fabledskyblock.*"))) { - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.Generator.Permission.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } else if (skyblock.getGeneratorManager() == null) { + if (skyblock.getGeneratorManager() == null) { messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Generator.Disabled.Message")); soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); } else { @@ -59,8 +50,8 @@ public class GeneratorCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.Generator.Info.Message"; } @Override @@ -72,9 +63,4 @@ public class GeneratorCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/LevelCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/LevelCommand.java index 8f05eb9a..5fd79635 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/LevelCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/LevelCommand.java @@ -1,40 +1,20 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; -import me.goodandevil.skyblock.config.FileManager; -import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.menus.admin.Levelling; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; public class LevelCommand extends SubCommand { @Override public void onCommandByPlayer(Player player, String[] args) { SoundManager soundManager = skyblock.getSoundManager(); - FileManager fileManager = skyblock.getFileManager(); - Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); - FileConfiguration configLoad = config.getFileConfiguration(); - - if (player.hasPermission("fabledskyblock.admin.level") || player.hasPermission("fabledskyblock.admin.*") - || player.hasPermission("fabledskyblock.*")) { - Levelling.getInstance().open(player); - soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F); - } else { - skyblock.getMessageManager().sendMessage(player, - configLoad.getString("Command.Island.Admin.Level.Permission.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } + Levelling.getInstance().open(player); + soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F); } @Override @@ -48,8 +28,8 @@ public class LevelCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.Level.Info.Message"; } @Override @@ -61,9 +41,4 @@ public class LevelCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/OwnerCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/OwnerCommand.java index 1eb0df55..068f936d 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/OwnerCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/OwnerCommand.java @@ -1,18 +1,6 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.message.MessageManager; @@ -20,6 +8,14 @@ import me.goodandevil.skyblock.playerdata.PlayerDataManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.UUID; public class OwnerCommand extends SubCommand { @@ -42,59 +38,47 @@ public class OwnerCommand extends SubCommand { Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); FileConfiguration configLoad = config.getFileConfiguration(); - Player player = null; + if (args.length == 1) { + Player targetPlayer = Bukkit.getServer().getPlayer(args[0]); + UUID targetPlayerUUID, islandOwnerUUID; + String targetPlayerName, islandOwnerName; - if (sender instanceof Player) { - player = (Player) sender; - } + if (targetPlayer == null) { + OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]); + targetPlayerUUID = targetPlayerOffline.getUniqueId(); + islandOwnerUUID = targetPlayerOffline.getOwner(); + targetPlayerName = targetPlayerOffline.getName(); + } else { + targetPlayerUUID = targetPlayer.getUniqueId(); + islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner(); + targetPlayerName = targetPlayer.getName(); + } - if (player == null || player.hasPermission("fabledskyblock.admin.owner") || player.hasPermission("fabledskyblock.admin.*") - || player.hasPermission("fabledskyblock.*")) { - if (args.length == 1) { - Player targetPlayer = Bukkit.getServer().getPlayer(args[0]); - UUID targetPlayerUUID, islandOwnerUUID; - String targetPlayerName, islandOwnerName; + if (islandOwnerUUID == null) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.Owner.Island.None.Message")); + soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); + } else if (islandOwnerUUID.equals(targetPlayerUUID)) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.Owner.Island.Owner.Message").replace("%player", + targetPlayerName)); + soundManager.playSound(sender, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F); + } else { + targetPlayer = Bukkit.getServer().getPlayer(islandOwnerUUID); if (targetPlayer == null) { - OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]); - targetPlayerUUID = targetPlayerOffline.getUniqueId(); - islandOwnerUUID = targetPlayerOffline.getOwner(); - targetPlayerName = targetPlayerOffline.getName(); + islandOwnerName = new OfflinePlayer(islandOwnerUUID).getName(); } else { - targetPlayerUUID = targetPlayer.getUniqueId(); - islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner(); - targetPlayerName = targetPlayer.getName(); + islandOwnerName = targetPlayer.getName(); } - if (islandOwnerUUID == null) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.Owner.Island.None.Message")); - soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); - } else if (islandOwnerUUID.equals(targetPlayerUUID)) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.Owner.Island.Owner.Message").replace("%player", - targetPlayerName)); - soundManager.playSound(sender, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F); - } else { - targetPlayer = Bukkit.getServer().getPlayer(islandOwnerUUID); - - if (targetPlayer == null) { - islandOwnerName = new OfflinePlayer(islandOwnerUUID).getName(); - } else { - islandOwnerName = targetPlayer.getName(); - } - - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.Owner.Island.Member.Message") - .replace("%player", targetPlayerName).replace("%owner", islandOwnerName)); - soundManager.playSound(sender, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F); - } - } else { - messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Owner.Invalid.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.Owner.Island.Member.Message") + .replace("%player", targetPlayerName).replace("%owner", islandOwnerName)); + soundManager.playSound(sender, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F); } } else { - messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Owner.Permission.Message")); + messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Owner.Invalid.Message")); soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); } } @@ -105,8 +89,8 @@ public class OwnerCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.Owner.Info.Message"; } @Override @@ -118,9 +102,4 @@ public class OwnerCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/ReloadCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/ReloadCommand.java index 2583c9fb..b46de0ee 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/ReloadCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/ReloadCommand.java @@ -1,18 +1,6 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; -import java.util.Map; - -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.generator.GeneratorManager; @@ -24,6 +12,14 @@ import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.scoreboard.ScoreboardManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.Map; public class ReloadCommand extends SubCommand { @@ -46,73 +42,61 @@ public class ReloadCommand extends SubCommand { Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); FileConfiguration configLoad = config.getFileConfiguration(); - Player player = null; + Map configs = fileManager.getConfigs(); - if (sender instanceof Player) { - player = (Player) sender; + for (int i = 0; i < configs.size(); i++) { + String configFileName = (String) configs.keySet().toArray()[i]; + Config configFileConfig = configs.get(configFileName); + String configFilePath = configFileName.replace(configFileConfig.getFile().getName(), ""); + + if (configFilePath.equals(skyblock.getDataFolder().toString() + "\\") + || configFilePath.equals(skyblock.getDataFolder().toString() + "/")) { + configFileConfig.loadFile(); + } } - if (player == null || player.hasPermission("fabledskyblock.admin.reload") || player.hasPermission("fabledskyblock.admin.*") - || player.hasPermission("fabledskyblock.*")) { - Map configs = fileManager.getConfigs(); + Config mainConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")); + FileConfiguration mainConfigLoad = mainConfig.getFileConfiguration(); - for (int i = 0; i < configs.size(); i++) { - String configFileName = (String) configs.keySet().toArray()[i]; - Config configFileConfig = configs.get(configFileName); - String configFilePath = configFileName.replace(configFileConfig.getFile().getName(), ""); - - if (configFilePath.equals(skyblock.getDataFolder().toString() + "\\") - || configFilePath.equals(skyblock.getDataFolder().toString() + "/")) { - configFileConfig.loadFile(); - } + if (skyblock.getScoreboardManager() == null) { + if (mainConfigLoad.getBoolean("Island.Scoreboard.Enable")) { + skyblock.setScoreboardManager(new ScoreboardManager(skyblock)); } - - Config mainConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")); - FileConfiguration mainConfigLoad = mainConfig.getFileConfiguration(); - - if (skyblock.getScoreboardManager() == null) { - if (mainConfigLoad.getBoolean("Island.Scoreboard.Enable")) { - skyblock.setScoreboardManager(new ScoreboardManager(skyblock)); - } - } else { - skyblock.getScoreboardManager().resendScoreboard(); - } - - if (skyblock.getGeneratorManager() == null) { - if (mainConfigLoad.getBoolean("Island.Generator.Enable")) { - skyblock.setGeneratorManager(new GeneratorManager(skyblock)); - } - } else { - GeneratorManager generatorManager = skyblock.getGeneratorManager(); - generatorManager.unregisterGenerators(); - generatorManager.registerGenerators(); - } - - LevellingManager levellingManager = skyblock.getLevellingManager(); - levellingManager.unregisterMaterials(); - levellingManager.registerMaterials(); - - Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() { - @Override - public void run() { - for (HologramType hologramTypeList : HologramType.values()) { - Hologram hologram = hologramManager.getHologram(hologramTypeList); - - if (hologram != null) { - hologramManager.removeHologram(hologram); - } - - hologramManager.spawnHologram(hologramTypeList); - } - } - }); - - messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Reload.Reloaded.Message")); - soundManager.playSound(sender, Sounds.ANVIL_USE.bukkitSound(), 1.0F, 1.0F); } else { - messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Reload.Permission.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + skyblock.getScoreboardManager().resendScoreboard(); } + + if (skyblock.getGeneratorManager() == null) { + if (mainConfigLoad.getBoolean("Island.Generator.Enable")) { + skyblock.setGeneratorManager(new GeneratorManager(skyblock)); + } + } else { + GeneratorManager generatorManager = skyblock.getGeneratorManager(); + generatorManager.unregisterGenerators(); + generatorManager.registerGenerators(); + } + + LevellingManager levellingManager = skyblock.getLevellingManager(); + levellingManager.unregisterMaterials(); + levellingManager.registerMaterials(); + + Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() { + @Override + public void run() { + for (HologramType hologramTypeList : HologramType.values()) { + Hologram hologram = hologramManager.getHologram(hologramTypeList); + + if (hologram != null) { + hologramManager.removeHologram(hologram); + } + + hologramManager.spawnHologram(hologramTypeList); + } + } + }); + + messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Reload.Reloaded.Message")); + soundManager.playSound(sender, Sounds.ANVIL_USE.bukkitSound(), 1.0F, 1.0F); } @Override @@ -121,8 +105,8 @@ public class ReloadCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.Reload.Info.Message"; } @Override @@ -134,9 +118,4 @@ public class ReloadCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/RemoveHologramCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/RemoveHologramCommand.java index 295b12d9..f088e468 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/RemoveHologramCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/RemoveHologramCommand.java @@ -1,19 +1,6 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; -import java.io.IOException; - -import org.apache.commons.lang3.text.WordUtils; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.hologram.Hologram; @@ -22,6 +9,15 @@ import me.goodandevil.skyblock.hologram.HologramType; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.apache.commons.lang3.text.WordUtils; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.io.IOException; public class RemoveHologramCommand extends SubCommand { @@ -44,71 +40,54 @@ public class RemoveHologramCommand extends SubCommand { Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); FileConfiguration configLoad = config.getFileConfiguration(); - Player player = null; + if (args.length == 1) { + HologramType hologramType = null; - if (sender instanceof Player) { - player = (Player) sender; - } - - if (player == null || player.hasPermission("fabledskyblock.admin.removehologram") - || player.hasPermission("fabledskyblock.admin.*") || player.hasPermission("fabledskyblock.*")) { - if (args.length == 1) { - HologramType hologramType = null; - - if (args[0].equalsIgnoreCase("Level")) { - hologramType = HologramType.Level; - } else if (args[0].equalsIgnoreCase("Votes")) { - hologramType = HologramType.Votes; - } - - if (hologramType != null) { - Config locationsConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")); - FileConfiguration locationsConfigLoad = locationsConfig.getFileConfiguration(); - - if (locationsConfigLoad.getString("Location.Hologram.Leaderboard." + hologramType.name()) == null) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.RemoveHologram.Set.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } else { - locationsConfigLoad.set("Location.Hologram.Leaderboard." + hologramType.name(), null); - - try { - locationsConfigLoad.save(locationsConfig.getFile()); - } catch (IOException e) { - e.printStackTrace(); - } - - Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() { - @Override - public void run() { - HologramType hologramType = HologramType - .valueOf(WordUtils.capitalize(args[0].toLowerCase())); - Hologram hologram = hologramManager.getHologram(hologramType); - - if (hologram != null) { - hologramManager.removeHologram(hologram); - } - } - }); - - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.RemoveHologram.Removed.Message") - .replace("%type", hologramType.name())); - soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F); - } - - return; - } + if (args[0].equalsIgnoreCase("Level")) { + hologramType = HologramType.Level; + } else if (args[0].equalsIgnoreCase("Votes")) { + hologramType = HologramType.Votes; } - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.RemoveHologram.Invalid.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } else { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.RemoveHologram.Permission.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + if (hologramType != null) { + Config locationsConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")); + FileConfiguration locationsConfigLoad = locationsConfig.getFileConfiguration(); + + if (locationsConfigLoad.getString("Location.Hologram.Leaderboard." + hologramType.name()) == null) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.RemoveHologram.Set.Message")); + soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + } else { + locationsConfigLoad.set("Location.Hologram.Leaderboard." + hologramType.name(), null); + + try { + locationsConfigLoad.save(locationsConfig.getFile()); + } catch (IOException e) { + e.printStackTrace(); + } + + Bukkit.getServer().getScheduler().runTask(skyblock, () -> { + HologramType hologramType1 = HologramType + .valueOf(WordUtils.capitalize(args[0].toLowerCase())); + Hologram hologram = hologramManager.getHologram(hologramType1); + + if (hologram != null) { + hologramManager.removeHologram(hologram); + } + }); + + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.RemoveHologram.Removed.Message") + .replace("%type", hologramType.name())); + soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F); + } + + return; + } } + + messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.RemoveHologram.Invalid.Message")); + soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); } @Override @@ -117,8 +96,8 @@ public class RemoveHologramCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.RemoveHologram.Info.Message"; } @Override @@ -130,9 +109,4 @@ public class RemoveHologramCommand extends SubCommand { public String[] getArguments() { return new String[] { "level", "votes" }; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/RemoveUpgradeCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/RemoveUpgradeCommand.java index eaa0fe50..33a2ff21 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/RemoveUpgradeCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/RemoveUpgradeCommand.java @@ -1,20 +1,6 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; -import java.io.IOException; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; @@ -25,6 +11,16 @@ import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.upgrade.Upgrade; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.io.IOException; +import java.util.UUID; public class RemoveUpgradeCommand extends SubCommand { @@ -48,105 +44,92 @@ public class RemoveUpgradeCommand extends SubCommand { Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); FileConfiguration configLoad = config.getFileConfiguration(); - Player player = null; + if (args.length == 2) { + Player targetPlayer = Bukkit.getServer().getPlayer(args[0]); + UUID islandOwnerUUID; + String targetPlayerName; - if (sender instanceof Player) { - player = (Player) sender; - } - - if (player == null || player.hasPermission("fabledskyblock.admin.removeupgrade") - || player.hasPermission("fabledskyblock.admin.*") || player.hasPermission("fabledskyblock.*")) { - if (args.length == 2) { - Player targetPlayer = Bukkit.getServer().getPlayer(args[0]); - UUID islandOwnerUUID; - String targetPlayerName; - - if (targetPlayer == null) { - OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]); - islandOwnerUUID = targetPlayerOffline.getOwner(); - targetPlayerName = targetPlayerOffline.getName(); - } else { - islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner(); - targetPlayerName = targetPlayer.getName(); - } - - Upgrade.Type upgrade = null; - - for (Upgrade.Type upgradeList : Upgrade.Type.values()) { - if (upgradeList != Upgrade.Type.Size) { - if (args[1].toUpperCase().equals(upgradeList.name().toUpperCase())) { - upgrade = upgradeList; - - break; - } - } - } - - if (islandOwnerUUID == null) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.RemoveUpgrade.Island.Owner.Message")); - soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); - } else if (upgrade == null) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.RemoveUpgrade.Upgrade.Exist.Message")); - soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); - } else { - if (islandManager.containsIsland(islandOwnerUUID)) { - Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)); - - if (!island.hasUpgrade(upgrade)) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.RemoveUpgrade.Upgrade.Missing.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - - return; - } - - island.removeUpgrade(upgrade); - } else { - File islandDataFile = new File(skyblock.getDataFolder().toString() + "/island-data", - islandOwnerUUID.toString() + ".yml"); - - if (!fileManager.isFileExist(islandDataFile)) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.RemoveUpgrade.Island.Data.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - - return; - } - - FileConfiguration islandDataConfigLoad = YamlConfiguration.loadConfiguration(islandDataFile); - - if (islandDataConfigLoad.getString("Upgrade." + upgrade.name()) == null) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.RemoveUpgrade.Upgrade.Missing.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - - return; - } - - islandDataConfigLoad.set("Upgrade." + upgrade.name(), null); - - try { - islandDataConfigLoad.save(islandDataFile); - } catch (IOException e) { - e.printStackTrace(); - } - } - - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.RemoveUpgrade.Removed.Message") - .replace("%player", targetPlayerName).replace("%upgrade", upgrade.name())); - soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F); - } + if (targetPlayer == null) { + OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]); + islandOwnerUUID = targetPlayerOffline.getOwner(); + targetPlayerName = targetPlayerOffline.getName(); } else { + islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner(); + targetPlayerName = targetPlayer.getName(); + } + + Upgrade.Type upgrade = null; + + for (Upgrade.Type upgradeList : Upgrade.Type.values()) { + if (upgradeList != Upgrade.Type.Size) { + if (args[1].toUpperCase().equals(upgradeList.name().toUpperCase())) { + upgrade = upgradeList; + + break; + } + } + } + + if (islandOwnerUUID == null) { messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.RemoveUpgrade.Invalid.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + configLoad.getString("Command.Island.Admin.RemoveUpgrade.Island.Owner.Message")); + soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); + } else if (upgrade == null) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.RemoveUpgrade.Upgrade.Exist.Message")); + soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); + } else { + if (islandManager.containsIsland(islandOwnerUUID)) { + Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)); + + if (!island.hasUpgrade(upgrade)) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.RemoveUpgrade.Upgrade.Missing.Message")); + soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + + return; + } + + island.removeUpgrade(upgrade); + } else { + File islandDataFile = new File(skyblock.getDataFolder().toString() + "/island-data", + islandOwnerUUID.toString() + ".yml"); + + if (!fileManager.isFileExist(islandDataFile)) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.RemoveUpgrade.Island.Data.Message")); + soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + + return; + } + + FileConfiguration islandDataConfigLoad = YamlConfiguration.loadConfiguration(islandDataFile); + + if (islandDataConfigLoad.getString("Upgrade." + upgrade.name()) == null) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.RemoveUpgrade.Upgrade.Missing.Message")); + soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + + return; + } + + islandDataConfigLoad.set("Upgrade." + upgrade.name(), null); + + try { + islandDataConfigLoad.save(islandDataFile); + } catch (IOException e) { + e.printStackTrace(); + } + } + + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.RemoveUpgrade.Removed.Message") + .replace("%player", targetPlayerName).replace("%upgrade", upgrade.name())); + soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F); } } else { messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.RemoveUpgrade.Permission.Message")); + configLoad.getString("Command.Island.Admin.RemoveUpgrade.Invalid.Message")); soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); } } @@ -157,8 +140,8 @@ public class RemoveUpgradeCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.RemoveUpgrade.Info.Message"; } @Override @@ -170,9 +153,4 @@ public class RemoveUpgradeCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/SetHologramCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/SetHologramCommand.java index 0f4b3da1..a28a314c 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/SetHologramCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/SetHologramCommand.java @@ -1,17 +1,6 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; - -import org.apache.commons.lang3.text.WordUtils; -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.hologram.Hologram; @@ -20,6 +9,13 @@ import me.goodandevil.skyblock.hologram.HologramType; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.apache.commons.lang3.text.WordUtils; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class SetHologramCommand extends SubCommand { @@ -33,56 +29,44 @@ public class SetHologramCommand extends SubCommand { Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); FileConfiguration configLoad = config.getFileConfiguration(); - if (player.hasPermission("fabledskyblock.admin.sethologram") || player.hasPermission("fabledskyblock.admin.*") - || player.hasPermission("fabledskyblock.*")) { - if (args.length == 1) { - HologramType hologramType = null; + if (args.length == 1) { + HologramType hologramType = null; - if (args[0].equalsIgnoreCase("Level")) { - hologramType = HologramType.Level; - } else if (args[0].equalsIgnoreCase("Votes")) { - hologramType = HologramType.Votes; - } - - if (hologramType != null) { - if (hologramType == HologramType.Level || hologramType == HologramType.Votes) { - fileManager.setLocation( - fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")), - "Location.Hologram.Leaderboard." + hologramType.name(), player.getLocation(), true); - } - - Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() { - @Override - public void run() { - HologramType hologramType = HologramType - .valueOf(WordUtils.capitalize(args[0].toLowerCase())); - Hologram hologram = hologramManager.getHologram(hologramType); - - if (hologram != null) { - hologramManager.removeHologram(hologram); - } - - hologramManager.spawnHologram(hologramType); - } - }); - - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.SetHologram.Set.Message").replace("%type", - hologramType.name())); - soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F); - - return; - } + if (args[0].equalsIgnoreCase("Level")) { + hologramType = HologramType.Level; + } else if (args[0].equalsIgnoreCase("Votes")) { + hologramType = HologramType.Votes; } - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.SetHologram.Invalid.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } else { - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.SetHologram.Permission.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + if (hologramType != null) { + fileManager.setLocation( + fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")), + "Location.Hologram.Leaderboard." + hologramType.name(), player.getLocation(), true); + + Bukkit.getServer().getScheduler().runTask(skyblock, () -> { + HologramType hologramType1 = HologramType + .valueOf(WordUtils.capitalize(args[0].toLowerCase())); + Hologram hologram = hologramManager.getHologram(hologramType1); + + if (hologram != null) { + hologramManager.removeHologram(hologram); + } + + hologramManager.spawnHologram(hologramType1); + }); + + messageManager.sendMessage(player, + configLoad.getString("Command.Island.Admin.SetHologram.Set.Message").replace("%type", + hologramType.name())); + soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F); + + return; + } } + + messageManager.sendMessage(player, + configLoad.getString("Command.Island.Admin.SetHologram.Invalid.Message")); + soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); } @Override @@ -96,8 +80,8 @@ public class SetHologramCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.SetHologram.Info.Message"; } @Override @@ -109,9 +93,4 @@ public class SetHologramCommand extends SubCommand { public String[] getArguments() { return new String[] { "level", "votes" }; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/SetSizeCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/SetSizeCommand.java index ad13f63c..2a2705cd 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/SetSizeCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/SetSizeCommand.java @@ -1,20 +1,6 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; -import java.io.IOException; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; @@ -25,6 +11,16 @@ import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.NumberUtil; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.io.IOException; +import java.util.UUID; public class SetSizeCommand extends SubCommand { @@ -48,95 +44,83 @@ public class SetSizeCommand extends SubCommand { Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); FileConfiguration configLoad = config.getFileConfiguration(); - Player player = null; + if (args.length == 2) { + if (args[1].matches("[0-9]+")) { + Player targetPlayer = Bukkit.getServer().getPlayer(args[0]); + UUID islandOwnerUUID; + String targetPlayerName; - if (sender instanceof Player) { - player = (Player) sender; - } + if (targetPlayer == null) { + OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]); + islandOwnerUUID = targetPlayerOffline.getOwner(); + targetPlayerName = targetPlayerOffline.getName(); + } else { + islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner(); + targetPlayerName = targetPlayer.getName(); + } - if (player == null || player.hasPermission("fabledskyblock.admin.setsize") || player.hasPermission("fabledskyblock.admin.*") - || player.hasPermission("fabledskyblock.*")) { - if (args.length == 2) { - if (args[1].matches("[0-9]+")) { - Player targetPlayer = Bukkit.getServer().getPlayer(args[0]); - UUID islandOwnerUUID; - String targetPlayerName; + int size = Integer.valueOf(args[1]); - if (targetPlayer == null) { - OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]); - islandOwnerUUID = targetPlayerOffline.getOwner(); - targetPlayerName = targetPlayerOffline.getName(); + if (islandOwnerUUID == null) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.SetSize.Island.Owner.Message")); + soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); + } else if (size < 50) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.SetSize.Size.Greater.Message")); + soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); + } else if (size > 1000) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.SetSize.Size.Less.Message")); + soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); + } else { + if (islandManager.containsIsland(islandOwnerUUID)) { + Island island = islandManager + .getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)); + island.setSize(size); + + if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")) + .getFileConfiguration().getBoolean("Island.WorldBorder.Enable") + && island.isBorder()) { + islandManager.updateBorder(island); + } } else { - islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner(); - targetPlayerName = targetPlayer.getName(); - } + File islandDataFile = new File(skyblock.getDataFolder().toString() + "/island-data", + islandOwnerUUID.toString() + ".yml"); - int size = Integer.valueOf(args[1]); + if (!fileManager.isFileExist(islandDataFile)) { + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.SetSize.Island.Data.Message")); + soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - if (islandOwnerUUID == null) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.SetSize.Island.Owner.Message")); - soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); - } else if (size < 50) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.SetSize.Size.Greater.Message")); - soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); - } else if (size > 1000) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.SetSize.Size.Less.Message")); - soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); - } else { - if (islandManager.containsIsland(islandOwnerUUID)) { - Island island = islandManager - .getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)); - island.setSize(size); - - if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")) - .getFileConfiguration().getBoolean("Island.WorldBorder.Enable") - && island.isBorder()) { - islandManager.updateBorder(island); - } - } else { - File islandDataFile = new File(skyblock.getDataFolder().toString() + "/island-data", - islandOwnerUUID.toString() + ".yml"); - - if (!fileManager.isFileExist(islandDataFile)) { - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.SetSize.Island.Data.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - - return; - } - - FileConfiguration islandDataConfigLoad = YamlConfiguration - .loadConfiguration(islandDataFile); - islandDataConfigLoad.set("Size", size); - - try { - islandDataConfigLoad.save(islandDataFile); - } catch (IOException e) { - e.printStackTrace(); - } + return; } - messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.SetSize.Set.Message") - .replace("%player", targetPlayerName) - .replace("%size", NumberUtil.formatNumberByDecimal(size))); - soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F); + FileConfiguration islandDataConfigLoad = YamlConfiguration + .loadConfiguration(islandDataFile); + islandDataConfigLoad.set("Size", size); + + try { + islandDataConfigLoad.save(islandDataFile); + } catch (IOException e) { + e.printStackTrace(); + } } - } else { + messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.SetSize.Numerical.Message")); - soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + configLoad.getString("Command.Island.Admin.SetSize.Set.Message") + .replace("%player", targetPlayerName) + .replace("%size", NumberUtil.formatNumberByDecimal(size))); + soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F); } } else { messageManager.sendMessage(sender, - configLoad.getString("Command.Island.Admin.SetSize.Invalid.Message")); + configLoad.getString("Command.Island.Admin.SetSize.Numerical.Message")); soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); } } else { - messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.SetSize.Permission.Message")); + messageManager.sendMessage(sender, + configLoad.getString("Command.Island.Admin.SetSize.Invalid.Message")); soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); } } @@ -147,8 +131,8 @@ public class SetSizeCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.SetSize.Info.Message"; } @Override @@ -160,9 +144,4 @@ public class SetSizeCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/SetSpawnCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/SetSpawnCommand.java index 51a3b2bc..cc33c462 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/SetSpawnCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/SetSpawnCommand.java @@ -1,20 +1,16 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class SetSpawnCommand extends SubCommand { @@ -27,17 +23,10 @@ public class SetSpawnCommand extends SubCommand { Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); FileConfiguration configLoad = config.getFileConfiguration(); - if (player.hasPermission("fabledskyblock.admin.setspawn") || player.hasPermission("fabledskyblock.admin.*") - || player.hasPermission("fabledskyblock.*")) { - fileManager.setLocation(fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")), - "Location.Spawn", player.getLocation(), true); - messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.SetSpawn.Set.Message")); - soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F); - } else { - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.SetSpawn.Permission.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } + fileManager.setLocation(fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")), + "Location.Spawn", player.getLocation(), true); + messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.SetSpawn.Set.Message")); + soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F); } @Override @@ -51,8 +40,8 @@ public class SetSpawnCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.SetSpawn.Info.Message"; } @Override @@ -64,9 +53,4 @@ public class SetSpawnCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/SettingsCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/SettingsCommand.java index 7058fe15..f1a3213c 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/SettingsCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/SettingsCommand.java @@ -1,40 +1,20 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; -import me.goodandevil.skyblock.config.FileManager; -import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.menus.admin.Settings; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; public class SettingsCommand extends SubCommand { @Override public void onCommandByPlayer(Player player, String[] args) { SoundManager soundManager = skyblock.getSoundManager(); - FileManager fileManager = skyblock.getFileManager(); - Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); - FileConfiguration configLoad = config.getFileConfiguration(); - - if (player.hasPermission("fabledskyblock.admin.settings") || player.hasPermission("fabledskyblock.admin.*") - || player.hasPermission("fabledskyblock.*")) { - Settings.getInstance().open(player, Settings.Type.Categories, null); - soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F); - } else { - skyblock.getMessageManager().sendMessage(player, - configLoad.getString("Command.Island.Admin.Settings.Permission.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } + Settings.getInstance().open(player, Settings.Type.Categories, null); + soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F); } @Override @@ -48,8 +28,8 @@ public class SettingsCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.Settings.Info.Message"; } @Override @@ -61,9 +41,4 @@ public class SettingsCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/StructureCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/StructureCommand.java index 64a16e62..970d6123 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/StructureCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/StructureCommand.java @@ -1,16 +1,6 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; -import java.util.logging.Level; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import me.goodandevil.skyblock.command.CommandManager.Type; +import me.goodandevil.skyblock.command.SubCommand; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.playerdata.PlayerData; @@ -22,9 +12,15 @@ import me.goodandevil.skyblock.utils.world.LocationUtil; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; -import me.goodandevil.skyblock.command.SubCommand; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.io.File; +import java.util.logging.Level; public class StructureCommand extends SubCommand { @@ -36,7 +32,7 @@ public class StructureCommand extends SubCommand { Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")); FileConfiguration configLoad = config.getFileConfiguration(); - if (args.length == 0 || (args.length > 0 && args[0].equalsIgnoreCase("help"))) { + if (args.length == 0 || args[0].equalsIgnoreCase("help")) { for (String helpLines : configLoad.getStringList("Command.Island.Help.Lines")) { if (helpLines.contains("%type")) { helpLines = helpLines.replace("%type", "Structure"); @@ -92,109 +88,91 @@ public class StructureCommand extends SubCommand { } soundManager.playSound(player, Sounds.ARROW_HIT.bukkitSound(), 1.0F, 1.0F); - - return; } else { if (args[0].equalsIgnoreCase("tool")) { - if (player.hasPermission("fabledskyblock.admin.structure.tool") - || player.hasPermission("fabledskyblock.admin.structure.*") - || player.hasPermission("fabledskyblock.admin.*") || player.hasPermission("fabledskyblock.*")) { - try { - ItemStack is = StructureUtil.getTool(); + try { + ItemStack is = StructureUtil.getTool(); - for (ItemStack itemList : player.getInventory().getContents()) { - if (itemList != null) { - if ((itemList.getType() == is.getType()) && (itemList.hasItemMeta()) && (itemList - .getItemMeta().getDisplayName().equals(is.getItemMeta().getDisplayName()))) { - messageManager.sendMessage(player, configLoad - .getString("Command.Island.Admin.Structure.Tool.Inventory.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + for (ItemStack itemList : player.getInventory().getContents()) { + if (itemList != null) { + if ((itemList.getType() == is.getType()) && (itemList.hasItemMeta()) && (itemList + .getItemMeta().getDisplayName().equals(is.getItemMeta().getDisplayName()))) { + messageManager.sendMessage(player, configLoad + .getString("Command.Island.Admin.Structure.Tool.Inventory.Message")); + soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - return; - } + return; } } - - player.getInventory().addItem(is); - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.Structure.Tool.Equiped.Message")); - soundManager.playSound(player, Sounds.CHICKEN_EGG_POP.bukkitSound(), 1.0F, 1.0F); - } catch (Exception e) { - messageManager.sendMessage(player, - configLoad.getString("Island.Structure.Tool.Material.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - - Bukkit.getServer().getLogger().log(Level.WARNING, - "SkyBlock | Error: The defined material in the configuration file for the Structure selection tool could not be found."); } - } else { + + player.getInventory().addItem(is); messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.Structure.Tool.Permission.Message")); + configLoad.getString("Command.Island.Admin.Structure.Tool.Equiped.Message")); + soundManager.playSound(player, Sounds.CHICKEN_EGG_POP.bukkitSound(), 1.0F, 1.0F); + } catch (Exception e) { + messageManager.sendMessage(player, + configLoad.getString("Island.Structure.Tool.Material.Message")); soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + + Bukkit.getServer().getLogger().log(Level.WARNING, + "SkyBlock | Error: The defined material in the configuration file for the Structure selection tool could not be found."); } return; } else if (args[0].equalsIgnoreCase("save")) { - if (player.hasPermission("fabledskyblock.admin.structure.save") - || player.hasPermission("fabledskyblock.admin.structure.*") - || player.hasPermission("fabledskyblock.admin.*") || player.hasPermission("fabledskyblock.*")) { - if (args.length == 2) { - PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player); + if (args.length == 2) { + PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player); - Location position1Location = playerData.getArea().getPosition(1); - Location position2Location = playerData.getArea().getPosition(2); + Location position1Location = playerData.getArea().getPosition(1); + Location position2Location = playerData.getArea().getPosition(2); - if (position1Location == null && position2Location == null) { - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.Structure.Save.Position.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } else if ((position1Location == null && position2Location != null) - || (position1Location != null && position2Location == null)) { - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.Structure.Save.Complete.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } else if (!position1Location.getWorld().getName() - .equals(position2Location.getWorld().getName())) { - messageManager.sendMessage(player, configLoad - .getString("Command.Island.Admin.Structure.Save.Selection.World.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } else if (!player.getWorld().getName().equals(position1Location.getWorld().getName())) { - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.Structure.Save.Player.World.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } else if (!LocationUtil.isInsideArea(player.getLocation(), position1Location, - position2Location)) { - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.Structure.Save.Player.Area.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } else { - try { - File configFile = new File( - skyblock.getDataFolder().toString() + "/structures/" + args[1] + ".structure"); - StructureUtil.saveStructure(configFile, player.getLocation(), - StructureUtil.getFixedLocations(position1Location, position2Location)); - - messageManager.sendMessage(player, - configLoad - .getString( - "Command.Island.Admin.Structure.Save.Saved.Successful.Message") - .replace("%name", args[1])); - soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F); - } catch (Exception e) { - messageManager.sendMessage(player, configLoad - .getString("Command.Island.Admin.Structure.Save.Saved.Failed.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - e.printStackTrace(); - } - } - } else { + if (position1Location == null && position2Location == null) { messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.Structure.Save.Invalid.Message")); + configLoad.getString("Command.Island.Admin.Structure.Save.Position.Message")); soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + } else if ((position1Location == null && position2Location != null) + || (position1Location != null && position2Location == null)) { + messageManager.sendMessage(player, + configLoad.getString("Command.Island.Admin.Structure.Save.Complete.Message")); + soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + } else if (!position1Location.getWorld().getName() + .equals(position2Location.getWorld().getName())) { + messageManager.sendMessage(player, configLoad + .getString("Command.Island.Admin.Structure.Save.Selection.World.Message")); + soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + } else if (!player.getWorld().getName().equals(position1Location.getWorld().getName())) { + messageManager.sendMessage(player, + configLoad.getString("Command.Island.Admin.Structure.Save.Player.World.Message")); + soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + } else if (!LocationUtil.isInsideArea(player.getLocation(), position1Location, + position2Location)) { + messageManager.sendMessage(player, + configLoad.getString("Command.Island.Admin.Structure.Save.Player.Area.Message")); + soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + } else { + try { + File configFile = new File( + skyblock.getDataFolder().toString() + "/structures/" + args[1] + ".structure"); + StructureUtil.saveStructure(configFile, player.getLocation(), + StructureUtil.getFixedLocations(position1Location, position2Location)); + + messageManager.sendMessage(player, + configLoad + .getString( + "Command.Island.Admin.Structure.Save.Saved.Successful.Message") + .replace("%name", args[1])); + soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F); + } catch (Exception e) { + messageManager.sendMessage(player, configLoad + .getString("Command.Island.Admin.Structure.Save.Saved.Failed.Message")); + soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); + e.printStackTrace(); + } } } else { messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.Structure.Tool.Save.Message")); + configLoad.getString("Command.Island.Admin.Structure.Save.Invalid.Message")); soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); } @@ -217,8 +195,8 @@ public class StructureCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.Structure.Info.Message"; } @Override @@ -230,9 +208,4 @@ public class StructureCommand extends SubCommand { public String[] getArguments() { return new String[] { "tool", "save" }; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/admin/UpgradeCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/admin/UpgradeCommand.java index fe9c751d..d35c15fa 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/admin/UpgradeCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/admin/UpgradeCommand.java @@ -1,15 +1,6 @@ package me.goodandevil.skyblock.command.commands.admin; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.menus.admin.Upgrade; @@ -17,6 +8,11 @@ import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.playerdata.PlayerDataManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class UpgradeCommand extends SubCommand { @@ -30,11 +26,7 @@ public class UpgradeCommand extends SubCommand { Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); FileConfiguration configLoad = config.getFileConfiguration(); - if (!(player.hasPermission("fabledskyblock.admin.upgrade") || player.hasPermission("fabledskyblock.admin.*") - || player.hasPermission("fabledskyblock.*"))) { - messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Upgrade.Permission.Message")); - soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); - } else if (skyblock.getUpgradeManager() == null) { + if (skyblock.getUpgradeManager() == null) { messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Upgrade.Disabled.Message")); soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); } else { @@ -58,8 +50,8 @@ public class UpgradeCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Admin.Upgrade.Info.Message"; } @Override @@ -71,9 +63,4 @@ public class UpgradeCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Admin; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/BorderCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/BorderCommand.java index b575afad..c5834921 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/BorderCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/BorderCommand.java @@ -1,15 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; @@ -18,6 +9,11 @@ import me.goodandevil.skyblock.island.IslandRole; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class BorderCommand extends SubCommand { @@ -64,8 +60,8 @@ public class BorderCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Border.Info.Message"; } @Override @@ -77,9 +73,4 @@ public class BorderCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/CancelCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/CancelCommand.java index 8414c467..e2ddbe35 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/CancelCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/CancelCommand.java @@ -1,16 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.invite.Invite; import me.goodandevil.skyblock.invite.InviteManager; @@ -20,6 +10,12 @@ import me.goodandevil.skyblock.island.IslandRole; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class CancelCommand extends SubCommand { @@ -92,8 +88,8 @@ public class CancelCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Cancel.Info.Message"; } @Override @@ -105,9 +101,4 @@ public class CancelCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/ChatCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/ChatCommand.java index dfed1835..91be0a72 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/ChatCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/ChatCommand.java @@ -1,13 +1,7 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.command.CommandManager.Type; +import me.goodandevil.skyblock.api.event.player.PlayerIslandChatSwitchEvent; +import me.goodandevil.skyblock.command.SubCommand; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.IslandManager; @@ -17,10 +11,12 @@ import me.goodandevil.skyblock.playerdata.PlayerData; import me.goodandevil.skyblock.playerdata.PlayerDataManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.api.event.player.PlayerIslandChatSwitchEvent; -import me.goodandevil.skyblock.command.CommandManager; -import me.goodandevil.skyblock.command.SubCommand; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class ChatCommand extends SubCommand { @@ -77,8 +73,8 @@ public class ChatCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Chat.Info.Message"; } @Override @@ -90,9 +86,4 @@ public class ChatCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/CloseCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/CloseCommand.java index 6fb6bb9f..81bd1aaa 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/CloseCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/CloseCommand.java @@ -1,15 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.IslandManager; @@ -17,6 +8,11 @@ import me.goodandevil.skyblock.island.IslandRole; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class CloseCommand extends SubCommand { @@ -63,8 +59,8 @@ public class CloseCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Close.Info.Message"; } @Override @@ -76,9 +72,4 @@ public class CloseCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/ConfirmCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/ConfirmCommand.java index 283eb3f6..c7f25dfb 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/ConfirmCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/ConfirmCommand.java @@ -1,19 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.confirmation.Confirmation; @@ -31,6 +18,15 @@ import me.goodandevil.skyblock.structure.StructureManager; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; import me.goodandevil.skyblock.utils.world.LocationUtil; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.UUID; public class ConfirmCommand extends SubCommand { @@ -207,8 +203,8 @@ public class ConfirmCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Confirmation.Info.Message"; } @Override @@ -220,9 +216,4 @@ public class ConfirmCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/ControlPanelCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/ControlPanelCommand.java index e22c3576..727efa48 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/ControlPanelCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/ControlPanelCommand.java @@ -1,19 +1,15 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.menus.ControlPanel; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class ControlPanelCommand extends SubCommand { @@ -45,8 +41,8 @@ public class ControlPanelCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.ControlPanel.Info.Message"; } @Override @@ -58,9 +54,4 @@ public class ControlPanelCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/CoopCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/CoopCommand.java index 97b66992..bc0fa9f9 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/CoopCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/CoopCommand.java @@ -1,17 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; @@ -23,6 +12,13 @@ import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; import me.goodandevil.skyblock.utils.world.LocationUtil; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.UUID; public class CoopCommand extends SubCommand { @@ -135,8 +131,8 @@ public class CoopCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Coop.Info.Message"; } @Override @@ -148,9 +144,4 @@ public class CoopCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/CreateCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/CreateCommand.java index f4b50768..fab66284 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/CreateCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/CreateCommand.java @@ -1,16 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.util.List; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.cooldown.Cooldown; @@ -24,6 +14,12 @@ import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.structure.Structure; import me.goodandevil.skyblock.utils.NumberUtil; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.List; public class CreateCommand extends SubCommand { @@ -117,8 +113,8 @@ public class CreateCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Create.Info.Message"; } @Override @@ -130,9 +126,4 @@ public class CreateCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/CurrentCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/CurrentCommand.java index 1fc86222..a21c82ea 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/CurrentCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/CurrentCommand.java @@ -1,16 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.playerdata.PlayerData; @@ -18,6 +8,12 @@ import me.goodandevil.skyblock.playerdata.PlayerDataManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class CurrentCommand extends SubCommand { @@ -121,8 +117,8 @@ public class CurrentCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Current.Info.Message"; } @Override @@ -134,9 +130,4 @@ public class CurrentCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/DeleteCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/DeleteCommand.java index c57272ad..0376a82e 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/DeleteCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/DeleteCommand.java @@ -1,15 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.confirmation.Confirmation; @@ -21,13 +12,17 @@ import me.goodandevil.skyblock.playerdata.PlayerData; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.ChatComponent; import me.goodandevil.skyblock.utils.version.Sounds; - import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.chat.ComponentSerializer; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class DeleteCommand extends SubCommand { @@ -142,8 +137,8 @@ public class DeleteCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Delete.Info.Message"; } @Override @@ -155,9 +150,4 @@ public class DeleteCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/DemoteCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/DemoteCommand.java index d9ecfdc0..7ff0ae70 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/DemoteCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/DemoteCommand.java @@ -1,18 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.util.Set; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.IslandManager; @@ -21,6 +9,14 @@ import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.Set; +import java.util.UUID; public class DemoteCommand extends SubCommand { @@ -115,8 +111,8 @@ public class DemoteCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Demote.Info.Message"; } @Override @@ -128,9 +124,4 @@ public class DemoteCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/DenyCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/DenyCommand.java index 4acd59c5..e2187d02 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/DenyCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/DenyCommand.java @@ -1,22 +1,18 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.invite.Invite; import me.goodandevil.skyblock.invite.InviteManager; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class DenyCommand extends SubCommand { @@ -74,8 +70,8 @@ public class DenyCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Deny.Info.Message"; } @Override @@ -87,9 +83,4 @@ public class DenyCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/InformationCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/InformationCommand.java index 8c30670b..a063cbd6 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/InformationCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/InformationCommand.java @@ -1,17 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.IslandManager; import me.goodandevil.skyblock.menus.Information; @@ -21,6 +10,13 @@ import me.goodandevil.skyblock.playerdata.PlayerDataManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.UUID; public class InformationCommand extends SubCommand { @@ -100,8 +96,8 @@ public class InformationCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Information.Info.Message"; } @Override @@ -113,9 +109,4 @@ public class InformationCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/InviteCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/InviteCommand.java index 6d551d6d..432cfb56 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/InviteCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/InviteCommand.java @@ -1,18 +1,8 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; import me.goodandevil.skyblock.api.event.island.IslandInviteEvent; import me.goodandevil.skyblock.api.invite.IslandInvitation; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.invite.Invite; @@ -23,13 +13,18 @@ import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.ChatComponent; import me.goodandevil.skyblock.utils.version.Sounds; - import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.chat.ComponentSerializer; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class InviteCommand extends SubCommand { @@ -251,8 +246,8 @@ public class InviteCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Invite.Info.Message"; } @Override @@ -264,9 +259,4 @@ public class InviteCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/KickAllCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/KickAllCommand.java index 6261cf73..248d747b 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/KickAllCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/KickAllCommand.java @@ -1,20 +1,8 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.util.Set; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; import me.goodandevil.skyblock.api.event.island.IslandKickEvent; import me.goodandevil.skyblock.api.utils.APIUtil; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.IslandManager; @@ -23,6 +11,14 @@ import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; import me.goodandevil.skyblock.utils.world.LocationUtil; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.Set; +import java.util.UUID; public class KickAllCommand extends SubCommand { @@ -94,8 +90,8 @@ public class KickAllCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.KickAll.Info.Message"; } @Override @@ -107,9 +103,4 @@ public class KickAllCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/KickCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/KickCommand.java index 69cb4999..999cd474 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/KickCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/KickCommand.java @@ -1,22 +1,8 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.io.IOException; -import java.util.Set; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; import me.goodandevil.skyblock.api.event.island.IslandKickEvent; import me.goodandevil.skyblock.api.utils.APIUtil; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; @@ -31,6 +17,16 @@ import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; import me.goodandevil.skyblock.utils.world.LocationUtil; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.io.IOException; +import java.util.Set; +import java.util.UUID; public class KickCommand extends SubCommand { @@ -264,8 +260,8 @@ public class KickCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Kick.Info.Message"; } @Override @@ -277,9 +273,4 @@ public class KickCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/LeaderboardCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/LeaderboardCommand.java index 60bc50f3..724d9acc 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/LeaderboardCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/LeaderboardCommand.java @@ -1,22 +1,18 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.menus.Leaderboard; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.playerdata.PlayerDataManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class LeaderboardCommand extends SubCommand { @@ -86,8 +82,8 @@ public class LeaderboardCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Leaderboard.Info.Message"; } @Override @@ -99,9 +95,4 @@ public class LeaderboardCommand extends SubCommand { public String[] getArguments() { return new String[] { "level", "votes" }; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/LeaveCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/LeaveCommand.java index a147bc3b..8ecbb609 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/LeaveCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/LeaveCommand.java @@ -1,19 +1,7 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.util.Set; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; import me.goodandevil.skyblock.api.event.player.PlayerIslandLeaveEvent; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; @@ -27,6 +15,14 @@ import me.goodandevil.skyblock.scoreboard.ScoreboardManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; import me.goodandevil.skyblock.utils.world.LocationUtil; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.Set; +import java.util.UUID; public class LeaveCommand extends SubCommand { @@ -157,9 +153,9 @@ public class LeaveCommand extends SubCommand { } @Override - public String getInfo() { - return info; - } + public String getInfoMessagePath() { + return "Command.Island.Leave.Info.Message"; + } @Override public String[] getAliases() { @@ -170,9 +166,4 @@ public class LeaveCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/LevelCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/LevelCommand.java index c47d2a59..75f50788 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/LevelCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/LevelCommand.java @@ -1,17 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.cooldown.Cooldown; import me.goodandevil.skyblock.cooldown.CooldownManager; @@ -28,6 +17,13 @@ import me.goodandevil.skyblock.utils.NumberUtil; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; import me.goodandevil.skyblock.visit.VisitManager; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.UUID; public class LevelCommand extends SubCommand { @@ -168,8 +164,8 @@ public class LevelCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Level.Info.Message"; } @Override @@ -181,9 +177,4 @@ public class LevelCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/MembersCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/MembersCommand.java index 52fe17aa..f9e09441 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/MembersCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/MembersCommand.java @@ -1,18 +1,14 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.menus.Members; import me.goodandevil.skyblock.playerdata.PlayerData; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; + +import java.io.File; public class MembersCommand extends SubCommand { @@ -47,8 +43,8 @@ public class MembersCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Members.Info.Message"; } @Override @@ -60,9 +56,4 @@ public class MembersCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/OpenCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/OpenCommand.java index 9193e479..97036183 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/OpenCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/OpenCommand.java @@ -1,15 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.IslandManager; @@ -17,6 +8,11 @@ import me.goodandevil.skyblock.island.IslandRole; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class OpenCommand extends SubCommand { @@ -63,8 +59,8 @@ public class OpenCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Open.Info.Message"; } @Override @@ -76,9 +72,4 @@ public class OpenCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/OwnerCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/OwnerCommand.java index 78027d7b..68b5c40e 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/OwnerCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/OwnerCommand.java @@ -1,17 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.confirmation.Confirmation; @@ -30,13 +19,19 @@ import me.goodandevil.skyblock.utils.ChatComponent; import me.goodandevil.skyblock.utils.NumberUtil; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; - import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.chat.ComponentSerializer; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.UUID; public class OwnerCommand extends SubCommand { @@ -262,8 +257,8 @@ public class OwnerCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Ownership.Info.Message"; } @Override @@ -275,9 +270,4 @@ public class OwnerCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/PromoteCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/PromoteCommand.java index e46939fa..b000c76a 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/PromoteCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/PromoteCommand.java @@ -1,8 +1,5 @@ package me.goodandevil.skyblock.command.commands.island; -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.command.SubCommand; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; @@ -144,8 +141,8 @@ public class PromoteCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Promote.Info.Message"; } @Override @@ -157,9 +154,4 @@ public class PromoteCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/PublicCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/PublicCommand.java index 0f6093d8..f87ce55f 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/PublicCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/PublicCommand.java @@ -1,15 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.IslandManager; @@ -17,6 +8,11 @@ import me.goodandevil.skyblock.island.IslandRole; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class PublicCommand extends SubCommand { @@ -65,8 +61,8 @@ public class PublicCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Public.Info.Message"; } @Override @@ -78,9 +74,4 @@ public class PublicCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/SetSpawnCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/SetSpawnCommand.java index 62b3fbd1..8f7a1fd6 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/SetSpawnCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/SetSpawnCommand.java @@ -1,7 +1,14 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - +import me.goodandevil.skyblock.command.SubCommand; +import me.goodandevil.skyblock.config.FileManager; +import me.goodandevil.skyblock.config.FileManager.Config; +import me.goodandevil.skyblock.island.*; +import me.goodandevil.skyblock.message.MessageManager; +import me.goodandevil.skyblock.sound.SoundManager; +import me.goodandevil.skyblock.utils.version.Materials; +import me.goodandevil.skyblock.utils.version.Sounds; +import me.goodandevil.skyblock.utils.world.LocationUtil; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.command.ConsoleCommandSender; @@ -10,22 +17,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; -import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; -import me.goodandevil.skyblock.config.FileManager; -import me.goodandevil.skyblock.config.FileManager.Config; -import me.goodandevil.skyblock.island.Island; -import me.goodandevil.skyblock.island.IslandEnvironment; -import me.goodandevil.skyblock.island.IslandManager; -import me.goodandevil.skyblock.island.IslandRole; -import me.goodandevil.skyblock.island.IslandWorld; -import me.goodandevil.skyblock.message.MessageManager; -import me.goodandevil.skyblock.sound.SoundManager; -import me.goodandevil.skyblock.utils.version.Materials; -import me.goodandevil.skyblock.utils.version.Sounds; -import me.goodandevil.skyblock.utils.world.LocationUtil; +import java.io.File; public class SetSpawnCommand extends SubCommand { @@ -176,8 +168,8 @@ public class SetSpawnCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.SetSpawn.Info.Message"; } @Override @@ -189,9 +181,4 @@ public class SetSpawnCommand extends SubCommand { public String[] getArguments() { return new String[] { "main", "visitor" }; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/SettingsCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/SettingsCommand.java index 61362972..3c2cbe39 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/SettingsCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/SettingsCommand.java @@ -1,15 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.IslandManager; @@ -17,6 +8,11 @@ import me.goodandevil.skyblock.island.IslandRole; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class SettingsCommand extends SubCommand { @@ -65,8 +61,8 @@ public class SettingsCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Settings.Info.Message"; } @Override @@ -78,9 +74,4 @@ public class SettingsCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/TeleportCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/TeleportCommand.java index 0a4efcfb..1fdc4a45 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/TeleportCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/TeleportCommand.java @@ -1,28 +1,24 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; -import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.IslandEnvironment; import me.goodandevil.skyblock.island.IslandManager; import me.goodandevil.skyblock.island.IslandWorld; +import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.playerdata.PlayerDataManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; import me.goodandevil.skyblock.visit.VisitManager; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.UUID; public class TeleportCommand extends SubCommand { @@ -145,8 +141,8 @@ public class TeleportCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Teleport.Info.Message"; } @Override @@ -158,9 +154,4 @@ public class TeleportCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/UnbanCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/UnbanCommand.java index 102acc9e..997d4f8a 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/UnbanCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/UnbanCommand.java @@ -1,18 +1,7 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; import me.goodandevil.skyblock.ban.Ban; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; @@ -22,6 +11,13 @@ import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.UUID; public class UnbanCommand extends SubCommand { @@ -109,15 +105,8 @@ public class UnbanCommand extends SubCommand { } @Override - public String getInfo() { - return info; - } - - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; + public String getInfoMessagePath() { + return "Command.Island.Unban.Info.Message"; } @Override @@ -129,9 +118,4 @@ public class UnbanCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/UnlockCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/UnlockCommand.java index e705097d..30d373dc 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/UnlockCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/UnlockCommand.java @@ -1,7 +1,5 @@ package me.goodandevil.skyblock.command.commands.island; -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.command.SubCommand; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; @@ -12,7 +10,6 @@ import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; import org.apache.commons.lang.WordUtils; -import org.bukkit.Bukkit; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; @@ -95,8 +92,8 @@ public class UnlockCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Unlock.Info.Message"; } @Override @@ -108,9 +105,4 @@ public class UnlockCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/UpgradeCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/UpgradeCommand.java index 56793400..fe8554e7 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/UpgradeCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/UpgradeCommand.java @@ -1,20 +1,16 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.menus.Upgrade; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class UpgradeCommand extends SubCommand { @@ -54,8 +50,8 @@ public class UpgradeCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Upgrade.Info.Message"; } @Override @@ -67,9 +63,4 @@ public class UpgradeCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/ValueCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/ValueCommand.java index b8fd7d6c..445f2232 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/ValueCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/ValueCommand.java @@ -1,16 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.apache.commons.lang3.text.WordUtils; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.levelling.LevellingManager; @@ -21,6 +11,12 @@ import me.goodandevil.skyblock.utils.NumberUtil; import me.goodandevil.skyblock.utils.version.Materials; import me.goodandevil.skyblock.utils.version.NMSUtil; import me.goodandevil.skyblock.utils.version.Sounds; +import org.apache.commons.lang3.text.WordUtils; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class ValueCommand extends SubCommand { @@ -84,8 +80,8 @@ public class ValueCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Value.Info.Message"; } @Override @@ -97,9 +93,4 @@ public class ValueCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/VisitCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/VisitCommand.java index 2d398ed7..04fdda77 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/VisitCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/VisitCommand.java @@ -1,21 +1,16 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.menus.Visit; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.playerdata.PlayerData; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; + +import java.io.File; public class VisitCommand extends SubCommand { @@ -57,8 +52,8 @@ public class VisitCommand extends SubCommand { } @Override - public String getInfo() { - return this.info; + public String getInfoMessagePath() { + return "Command.Island.Visit.Info.Message"; } @Override @@ -70,9 +65,4 @@ public class VisitCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/VisitorsCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/VisitorsCommand.java index b3688071..4eeff41a 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/VisitorsCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/VisitorsCommand.java @@ -1,12 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.command.CommandManager.Type; +import me.goodandevil.skyblock.command.SubCommand; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.IslandManager; @@ -14,9 +8,11 @@ import me.goodandevil.skyblock.menus.Visitors; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; -import me.goodandevil.skyblock.command.SubCommand; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class VisitorsCommand extends SubCommand { @@ -57,8 +53,8 @@ public class VisitorsCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Visitors.Info.Message"; } @Override @@ -70,9 +66,4 @@ public class VisitorsCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/VoteCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/VoteCommand.java index 31dc2347..5fdd56ce 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/VoteCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/VoteCommand.java @@ -1,17 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; @@ -24,6 +13,13 @@ import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.player.OfflinePlayer; import me.goodandevil.skyblock.utils.version.Sounds; import me.goodandevil.skyblock.visit.VisitManager; +import org.bukkit.Bukkit; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.UUID; public class VoteCommand extends SubCommand { @@ -133,8 +129,8 @@ public class VoteCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Vote.Info.Message"; } @Override @@ -146,9 +142,4 @@ public class VoteCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/WeatherCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/WeatherCommand.java index 80a73172..13e6d7e4 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/WeatherCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/WeatherCommand.java @@ -1,15 +1,6 @@ package me.goodandevil.skyblock.command.commands.island; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.IslandManager; import me.goodandevil.skyblock.island.IslandRole; @@ -17,6 +8,11 @@ import me.goodandevil.skyblock.menus.Weather; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class WeatherCommand extends SubCommand { @@ -56,8 +52,8 @@ public class WeatherCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Weather.Info.Message"; } @Override @@ -69,9 +65,4 @@ public class WeatherCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/ResetCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/ResetCommand.java index 9cfa4736..3b13587a 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/ResetCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/ResetCommand.java @@ -1,15 +1,6 @@ package me.goodandevil.skyblock.command.commands.island.disabled; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.confirmation.Confirmation; @@ -25,6 +16,11 @@ import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class ResetCommand extends SubCommand { @@ -88,8 +84,8 @@ public class ResetCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Reset.Info.Message"; } @Override @@ -101,9 +97,4 @@ public class ResetCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/RollbackCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/RollbackCommand.java index e369b633..ba547d9e 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/RollbackCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/RollbackCommand.java @@ -1,15 +1,6 @@ package me.goodandevil.skyblock.command.commands.island.disabled; -import java.io.File; - -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.CommandManager; import me.goodandevil.skyblock.command.SubCommand; -import me.goodandevil.skyblock.command.CommandManager.Type; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.IslandManager; @@ -18,6 +9,11 @@ import me.goodandevil.skyblock.menus.Rollback; import me.goodandevil.skyblock.message.MessageManager; import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.utils.version.Sounds; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; public class RollbackCommand extends SubCommand { @@ -55,8 +51,8 @@ public class RollbackCommand extends SubCommand { } @Override - public String getInfo() { - return info; + public String getInfoMessagePath() { + return "Command.Island.Rollback.Info.Message"; } @Override @@ -68,9 +64,4 @@ public class RollbackCommand extends SubCommand { public String[] getArguments() { return new String[0]; } - - @Override - public Type getType() { - return CommandManager.Type.Default; - } }