From 686facd6cbca719db24305c9dff19be9414645b2 Mon Sep 17 00:00:00 2001 From: Esophose Date: Sun, 10 Mar 2019 05:14:38 -0600 Subject: [PATCH] Refactored commands and added permissions --- .../me/goodandevil/skyblock/SkyBlock.java | 42 +- .../skyblock/command/CommandManager.java | 364 +++++++----------- .../skyblock/command/SubCommand.java | 37 +- .../commands/admin/AddUpgradeCommand.java | 14 - .../command/commands/admin/CreateCommand.java | 14 - .../command/commands/admin/DeleteCommand.java | 14 - .../commands/admin/GeneratorCommand.java | 14 - .../command/commands/admin/LevelCommand.java | 14 - .../command/commands/admin/OwnerCommand.java | 14 - .../command/commands/admin/ReloadCommand.java | 14 - .../commands/admin/RemoveHologramCommand.java | 14 - .../commands/admin/RemoveUpgradeCommand.java | 14 - .../commands/admin/SetHologramCommand.java | 14 - .../commands/admin/SetSizeCommand.java | 14 - .../commands/admin/SetSpawnCommand.java | 14 - .../commands/admin/SettingsCommand.java | 14 - .../commands/admin/StructureCommand.java | 14 - .../commands/admin/UpgradeCommand.java | 14 - .../commands/{ => island}/AcceptCommand.java | 53 +-- .../commands/{ => island}/BanCommand.java | 47 +-- .../commands/{ => island}/BankCommand.java | 27 +- .../commands/{ => island}/BansCommand.java | 39 +- .../commands/{ => island}/BiomeCommand.java | 39 +- .../commands/{ => island}/BorderCommand.java | 16 +- .../commands/{ => island}/CancelCommand.java | 16 +- .../commands/{ => island}/ChatCommand.java | 16 +- .../commands/{ => island}/CloseCommand.java | 16 +- .../commands/{ => island}/ConfirmCommand.java | 16 +- .../{ => island}/ControlPanelCommand.java | 16 +- .../commands/{ => island}/CoopCommand.java | 16 +- .../commands/{ => island}/CreateCommand.java | 16 +- .../commands/{ => island}/CurrentCommand.java | 16 +- .../commands/{ => island}/DeleteCommand.java | 16 +- .../commands/{ => island}/DemoteCommand.java | 16 +- .../commands/{ => island}/DenyCommand.java | 16 +- .../{ => island}/InformationCommand.java | 16 +- .../commands/{ => island}/InviteCommand.java | 16 +- .../commands/{ => island}/KickAllCommand.java | 16 +- .../commands/{ => island}/KickCommand.java | 16 +- .../{ => island}/LeaderboardCommand.java | 16 +- .../commands/{ => island}/LeaveCommand.java | 16 +- .../commands/{ => island}/LevelCommand.java | 16 +- .../commands/{ => island}/MembersCommand.java | 16 +- .../commands/{ => island}/OpenCommand.java | 16 +- .../commands/{ => island}/OwnerCommand.java | 16 +- .../commands/{ => island}/PromoteCommand.java | 16 +- .../commands/{ => island}/PublicCommand.java | 16 +- .../{ => island}/SetSpawnCommand.java | 17 +- .../{ => island}/SettingsCommand.java | 16 +- .../{ => island}/TeleportCommand.java | 16 +- .../commands/{ => island}/UnbanCommand.java | 9 +- .../commands/{ => island}/UnlockCommand.java | 16 +- .../commands/{ => island}/UpgradeCommand.java | 16 +- .../commands/{ => island}/ValueCommand.java | 16 +- .../commands/{ => island}/VisitCommand.java | 19 +- .../{ => island}/VisitorsCommand.java | 16 +- .../commands/{ => island}/VoteCommand.java | 16 +- .../commands/{ => island}/WeatherCommand.java | 16 +- .../{ => island/disabled}/ResetCommand.java | 16 +- .../disabled}/RollbackCommand.java | 16 +- .../utils/reflection/PackageClassLoader.java | 72 ++++ src/main/resources/language.yml | 44 +-- 62 files changed, 347 insertions(+), 1216 deletions(-) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/AcceptCommand.java (94%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/BanCommand.java (90%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/BankCommand.java (90%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/BansCommand.java (81%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/BiomeCommand.java (80%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/BorderCommand.java (91%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/CancelCommand.java (94%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/ChatCommand.java (93%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/CloseCommand.java (91%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/ConfirmCommand.java (97%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/ControlPanelCommand.java (87%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/CoopCommand.java (95%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/CreateCommand.java (95%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/CurrentCommand.java (94%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/DeleteCommand.java (95%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/DemoteCommand.java (95%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/DenyCommand.java (92%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/InformationCommand.java (93%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/InviteCommand.java (98%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/KickAllCommand.java (93%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/KickCommand.java (97%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/LeaderboardCommand.java (92%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/LeaveCommand.java (96%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/LevelCommand.java (96%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/MembersCommand.java (87%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/OpenCommand.java (91%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/OwnerCommand.java (97%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/PromoteCommand.java (96%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/PublicCommand.java (91%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/SetSpawnCommand.java (96%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/SettingsCommand.java (91%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/TeleportCommand.java (95%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/UnbanCommand.java (96%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/UnlockCommand.java (93%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/UpgradeCommand.java (89%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/ValueCommand.java (93%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/VisitCommand.java (88%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/VisitorsCommand.java (90%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/VoteCommand.java (95%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island}/WeatherCommand.java (90%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island/disabled}/ResetCommand.java (93%) rename src/main/java/me/goodandevil/skyblock/command/commands/{ => island/disabled}/RollbackCommand.java (89%) create mode 100644 src/main/java/me/goodandevil/skyblock/utils/reflection/PackageClassLoader.java diff --git a/src/main/java/me/goodandevil/skyblock/SkyBlock.java b/src/main/java/me/goodandevil/skyblock/SkyBlock.java index 04b4e8a0..496c8fb8 100644 --- a/src/main/java/me/goodandevil/skyblock/SkyBlock.java +++ b/src/main/java/me/goodandevil/skyblock/SkyBlock.java @@ -1,16 +1,5 @@ package me.goodandevil.skyblock; -import java.io.File; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.event.HandlerList; -import org.bukkit.generator.ChunkGenerator; -import org.bukkit.plugin.PluginManager; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scheduler.BukkitRunnable; - import me.goodandevil.skyblock.api.SkyBlockAPI; import me.goodandevil.skyblock.ban.BanManager; import me.goodandevil.skyblock.biome.BiomeManager; @@ -26,23 +15,7 @@ import me.goodandevil.skyblock.invite.InviteManager; import me.goodandevil.skyblock.island.IslandManager; import me.goodandevil.skyblock.leaderboard.LeaderboardManager; import me.goodandevil.skyblock.levelling.LevellingManager; -import me.goodandevil.skyblock.listeners.Block; -import me.goodandevil.skyblock.listeners.Bucket; -import me.goodandevil.skyblock.listeners.Chat; -import me.goodandevil.skyblock.listeners.Death; -import me.goodandevil.skyblock.listeners.Entity; -import me.goodandevil.skyblock.listeners.Food; -import me.goodandevil.skyblock.listeners.Interact; -import me.goodandevil.skyblock.listeners.Inventory; -import me.goodandevil.skyblock.listeners.Item; -import me.goodandevil.skyblock.listeners.Join; -import me.goodandevil.skyblock.listeners.Move; -import me.goodandevil.skyblock.listeners.Portal; -import me.goodandevil.skyblock.listeners.Projectile; -import me.goodandevil.skyblock.listeners.Quit; -import me.goodandevil.skyblock.listeners.Respawn; -import me.goodandevil.skyblock.listeners.Spawner; -import me.goodandevil.skyblock.listeners.Teleport; +import me.goodandevil.skyblock.listeners.*; import me.goodandevil.skyblock.menus.Rollback; import me.goodandevil.skyblock.menus.admin.Creator; import me.goodandevil.skyblock.menus.admin.Generator; @@ -61,6 +34,16 @@ import me.goodandevil.skyblock.visit.VisitManager; import me.goodandevil.skyblock.visit.VisitTask; import me.goodandevil.skyblock.world.WorldManager; import me.goodandevil.skyblock.world.generator.VoidGenerator; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.event.HandlerList; +import org.bukkit.generator.ChunkGenerator; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitRunnable; + +import java.io.File; public class SkyBlock extends JavaPlugin { @@ -96,6 +79,7 @@ public class SkyBlock extends JavaPlugin { console.sendMessage(formatText("&a=============================")); console.sendMessage(formatText("&7FabledSkyBlock " + this.getDescription().getVersion() + " by &5Songoda <3&7!")); console.sendMessage(formatText("&7Action: &aEnabling&7...")); + console.sendMessage(formatText("&a=============================")); instance = this; @@ -176,8 +160,6 @@ public class SkyBlock extends JavaPlugin { this.getCommand("skyblock").setExecutor(new SkyBlockCommand()); SkyBlockAPI.setImplementation(instance); - - console.sendMessage(formatText("&a=============================")); } @Override diff --git a/src/main/java/me/goodandevil/skyblock/command/CommandManager.java b/src/main/java/me/goodandevil/skyblock/command/CommandManager.java index 5090b97e..4f6cd23f 100644 --- a/src/main/java/me/goodandevil/skyblock/command/CommandManager.java +++ b/src/main/java/me/goodandevil/skyblock/command/CommandManager.java @@ -1,32 +1,6 @@ package me.goodandevil.skyblock.command; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; - -import me.goodandevil.skyblock.command.commands.*; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.command.TabCompleter; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; - import me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.command.commands.admin.AddUpgradeCommand; -import me.goodandevil.skyblock.command.commands.admin.GeneratorCommand; -import me.goodandevil.skyblock.command.commands.admin.ReloadCommand; -import me.goodandevil.skyblock.command.commands.admin.RemoveHologramCommand; -import me.goodandevil.skyblock.command.commands.admin.RemoveUpgradeCommand; -import me.goodandevil.skyblock.command.commands.admin.SetHologramCommand; -import me.goodandevil.skyblock.command.commands.admin.SetSizeCommand; -import me.goodandevil.skyblock.command.commands.admin.StructureCommand; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.menus.ControlPanel; @@ -34,15 +8,26 @@ 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.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.*; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; public class CommandManager implements CommandExecutor, TabCompleter { private final SkyBlock skyblock; - private HashMap> subCommands = new HashMap<>(); + private List islandCommands; + private List adminCommands; public CommandManager(SkyBlock skyblock) { this.skyblock = skyblock; @@ -54,133 +39,66 @@ public class CommandManager implements CommandExecutor, TabCompleter { } public void registerSubCommands() { - Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")); - FileConfiguration configLoad = config.getFileConfiguration(); + islandCommands = Arrays.asList( + new me.goodandevil.skyblock.command.commands.island.AcceptCommand(), + new me.goodandevil.skyblock.command.commands.island.BanCommand(), + new me.goodandevil.skyblock.command.commands.island.BankCommand(), + new me.goodandevil.skyblock.command.commands.island.BansCommand(), + new me.goodandevil.skyblock.command.commands.island.BiomeCommand(), + new me.goodandevil.skyblock.command.commands.island.BorderCommand(), + new me.goodandevil.skyblock.command.commands.island.CancelCommand(), + new me.goodandevil.skyblock.command.commands.island.ChatCommand(), + new me.goodandevil.skyblock.command.commands.island.CloseCommand(), + new me.goodandevil.skyblock.command.commands.island.ConfirmCommand(), + new me.goodandevil.skyblock.command.commands.island.ControlPanelCommand(), + new me.goodandevil.skyblock.command.commands.island.CoopCommand(), + new me.goodandevil.skyblock.command.commands.island.CreateCommand(), + new me.goodandevil.skyblock.command.commands.island.CurrentCommand(), + new me.goodandevil.skyblock.command.commands.island.DeleteCommand(), + new me.goodandevil.skyblock.command.commands.island.DemoteCommand(), + new me.goodandevil.skyblock.command.commands.island.DenyCommand(), + new me.goodandevil.skyblock.command.commands.island.InformationCommand(), + new me.goodandevil.skyblock.command.commands.island.InviteCommand(), + new me.goodandevil.skyblock.command.commands.island.KickAllCommand(), + new me.goodandevil.skyblock.command.commands.island.KickCommand(), + new me.goodandevil.skyblock.command.commands.island.LeaderboardCommand(), + new me.goodandevil.skyblock.command.commands.island.LeaveCommand(), + new me.goodandevil.skyblock.command.commands.island.LevelCommand(), + new me.goodandevil.skyblock.command.commands.island.MembersCommand(), + new me.goodandevil.skyblock.command.commands.island.OpenCommand(), + new me.goodandevil.skyblock.command.commands.island.OwnerCommand(), + new me.goodandevil.skyblock.command.commands.island.PromoteCommand(), + new me.goodandevil.skyblock.command.commands.island.PublicCommand(), + new me.goodandevil.skyblock.command.commands.island.SetSpawnCommand(), + new me.goodandevil.skyblock.command.commands.island.SettingsCommand(), + new me.goodandevil.skyblock.command.commands.island.TeleportCommand(), + new me.goodandevil.skyblock.command.commands.island.UnbanCommand(), + new me.goodandevil.skyblock.command.commands.island.UnlockCommand(), + new me.goodandevil.skyblock.command.commands.island.UpgradeCommand(), + new me.goodandevil.skyblock.command.commands.island.ValueCommand(), + new me.goodandevil.skyblock.command.commands.island.VisitCommand(), + new me.goodandevil.skyblock.command.commands.island.VisitorsCommand(), + new me.goodandevil.skyblock.command.commands.island.VoteCommand(), + new me.goodandevil.skyblock.command.commands.island.WeatherCommand() + ); - List subCommands = new ArrayList<>(); - subCommands.add(new VisitCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Visit.Info.Message")))); - subCommands.add(new VoteCommand(skyblock).setInfo( - ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Vote.Info.Message")))); - subCommands.add(new ControlPanelCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.ControlPanel.Info.Message")))); - subCommands.add(new UpgradeCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Upgrade.Info.Message")))); - subCommands.add(new BorderCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Border.Info.Message")))); - subCommands.add(new LeaderboardCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Leaderboard.Info.Message")))); - subCommands.add(new CreateCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Create.Info.Message")))); - // subCommands.add(new - // ResetCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&',configLoad.getString("Command.Island.Reset.Info.Message")))); - subCommands.add(new DeleteCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Delete.Info.Message")))); - subCommands.add(new TeleportCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Teleport.Info.Message")))); - subCommands.add(new SetSpawnCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.SetSpawn.Info.Message")))); - subCommands.add(new AcceptCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Accept.Info.Message")))); - subCommands.add(new DenyCommand(skyblock).setInfo( - ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Deny.Info.Message")))); - subCommands.add(new CancelCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Cancel.Info.Message")))); - subCommands.add(new LeaveCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Leave.Info.Message")))); - subCommands.add(new PromoteCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Promote.Info.Message")))); - subCommands.add(new DemoteCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Demote.Info.Message")))); - subCommands.add(new KickCommand(skyblock).setInfo( - ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Kick.Info.Message")))); - subCommands.add(new KickAllCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.KickAll.Info.Message")))); - subCommands.add(new BanCommand(skyblock).setInfo( - ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Ban.Info.Message")))); - subCommands.add(new BansCommand(skyblock).setInfo( - ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Bans.Info.Message")))); - subCommands.add(new UnbanCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Unban.Info.Message")))); - subCommands.add(new BiomeCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Biome.Info.Message")))); - subCommands.add(new WeatherCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Weather.Info.Message")))); - subCommands.add(new UnlockCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Unlock.Info.Message")))); - subCommands.add(new BankCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Bank.Info.Message")))); - // subCommands.add(new - // RollbackCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - // configLoad.getString("Command.Island.Rollback.Info.Message")))); - subCommands.add(new LevelCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Level.Info.Message")))); - subCommands.add(new ValueCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Value.Info.Message")))); - subCommands.add(new SettingsCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Settings.Info.Message")))); - subCommands.add(new InformationCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Information.Info.Message")))); - subCommands.add(new CoopCommand(skyblock).setInfo( - ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Coop.Info.Message")))); - subCommands.add(new MembersCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Members.Info.Message")))); - subCommands.add(new OwnerCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Ownership.Info.Message")))); - subCommands.add(new ConfirmCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Confirmation.Info.Message")))); - subCommands.add(new InviteCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Invite.Info.Message")))); - subCommands.add(new ChatCommand(skyblock).setInfo( - ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Chat.Info.Message")))); - subCommands.add(new VisitorsCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Visitors.Info.Message")))); - subCommands.add(new CurrentCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Current.Info.Message")))); - subCommands.add(new PublicCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Public.Info.Message")))); - subCommands.add(new OpenCommand(skyblock).setInfo( - ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Open.Info.Message")))); - subCommands.add(new CloseCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Close.Info.Message")))); - - this.subCommands.put(CommandManager.Type.Default, subCommands); - - subCommands = new ArrayList<>(); - subCommands.add(new me.goodandevil.skyblock.command.commands.admin.SetSpawnCommand(skyblock) - .setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Admin.SetSpawn.Info.Message")))); - subCommands.add(new SetHologramCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Admin.SetHologram.Info.Message")))); - subCommands.add(new RemoveHologramCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Admin.RemoveHologram.Info.Message")))); - subCommands.add(new SetSizeCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Admin.SetSize.Info.Message")))); - subCommands.add(new AddUpgradeCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Admin.AddUpgrade.Info.Message")))); - subCommands.add(new RemoveUpgradeCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Admin.RemoveUpgrade.Info.Message")))); - subCommands.add(new me.goodandevil.skyblock.command.commands.admin.CreateCommand(skyblock).setInfo(ChatColor - .translateAlternateColorCodes('&', configLoad.getString("Command.Island.Admin.Create.Info.Message")))); - subCommands.add(new me.goodandevil.skyblock.command.commands.admin.UpgradeCommand(skyblock).setInfo(ChatColor - .translateAlternateColorCodes('&', configLoad.getString("Command.Island.Admin.Upgrade.Info.Message")))); - subCommands.add(new GeneratorCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Admin.Generator.Info.Message")))); - subCommands.add(new me.goodandevil.skyblock.command.commands.admin.LevelCommand(skyblock).setInfo(ChatColor - .translateAlternateColorCodes('&', configLoad.getString("Command.Island.Admin.Level.Info.Message")))); - subCommands.add(new me.goodandevil.skyblock.command.commands.admin.SettingsCommand(skyblock) - .setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Admin.Settings.Info.Message")))); - subCommands.add(new StructureCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Admin.Structure.Info.Message")))); - subCommands.add(new me.goodandevil.skyblock.command.commands.admin.DeleteCommand(skyblock).setInfo(ChatColor - .translateAlternateColorCodes('&', configLoad.getString("Command.Island.Admin.Delete.Info.Message")))); - subCommands.add(new OwnerCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Admin.Owner.Info.Message")))); - subCommands.add(new ReloadCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', - configLoad.getString("Command.Island.Admin.Reload.Info.Message")))); - - this.subCommands.put(CommandManager.Type.Admin, subCommands); + adminCommands = Arrays.asList( + new me.goodandevil.skyblock.command.commands.admin.AddUpgradeCommand(), + new me.goodandevil.skyblock.command.commands.admin.CreateCommand(), + new me.goodandevil.skyblock.command.commands.admin.DeleteCommand(), + new me.goodandevil.skyblock.command.commands.admin.GeneratorCommand(), + new me.goodandevil.skyblock.command.commands.admin.LevelCommand(), + new me.goodandevil.skyblock.command.commands.admin.OwnerCommand(), + new me.goodandevil.skyblock.command.commands.admin.ReloadCommand(), + new me.goodandevil.skyblock.command.commands.admin.RemoveHologramCommand(), + new me.goodandevil.skyblock.command.commands.admin.RemoveUpgradeCommand(), + new me.goodandevil.skyblock.command.commands.admin.SetHologramCommand(), + new me.goodandevil.skyblock.command.commands.admin.SetSizeCommand(), + new me.goodandevil.skyblock.command.commands.admin.SetSpawnCommand(), + new me.goodandevil.skyblock.command.commands.admin.SettingsCommand(), + new me.goodandevil.skyblock.command.commands.admin.StructureCommand(), + new me.goodandevil.skyblock.command.commands.admin.UpgradeCommand() + ); } @Override @@ -207,12 +125,7 @@ public class CommandManager implements CommandExecutor, TabCompleter { sendConsoleHelpCommands(sender); } else { if (skyblock.getIslandManager().getIsland(player) == null) { - Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() { - @Override - public void run() { - Bukkit.getServer().dispatchCommand(sender, "island create"); - } - }); + Bukkit.getServer().getScheduler().runTask(skyblock, () -> Bukkit.getServer().dispatchCommand(sender, "island create")); } else { ControlPanel.getInstance().open(player); soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F); @@ -247,14 +160,13 @@ public class CommandManager implements CommandExecutor, TabCompleter { } } - sendPlayerHelpCommands(player, CommandManager.Type.Default, page); + sendPlayerIslandHelpCommands(player, page); } return; } else if (args[0].equalsIgnoreCase("admin")) { - if (args.length == 1 || (args.length >= 2 && args[1].equalsIgnoreCase("help"))) { - if (player == null || player.hasPermission("fabledskyblock.admin") - || player.hasPermission("fabledskyblock.admin.*") || player.hasPermission("fabledskyblock.*")) { + if (args.length == 1 || args[1].equalsIgnoreCase("help")) { + if (player == null) { if (player == null) { sendConsoleHelpCommands(sender); } else { @@ -278,20 +190,19 @@ public class CommandManager implements CommandExecutor, TabCompleter { } } - sendPlayerHelpCommands(player, CommandManager.Type.Admin, page); + sendPlayerAdminHelpCommands(player, page); } } else { - messageManager.sendMessage(player, - configLoad.getString("Command.Island.Admin.Help.Permission.Message")); + messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Help.Permission.Message")); soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); } return; } - subCommand = getSubCommand(CommandManager.Type.Admin, args[1]); + subCommand = getAdminSubCommand(args[1]); } else { - subCommand = getSubCommand(CommandManager.Type.Default, args[0]); + subCommand = getIslandSubCommand(args[0]); } if (subCommand == null) { @@ -299,11 +210,11 @@ public class CommandManager implements CommandExecutor, TabCompleter { configLoad.getString("Command.Island.Argument.Unrecognised.Message")); soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); } else { - ArrayList arguments = new ArrayList<>(); + List arguments = new ArrayList<>(); arguments.addAll(Arrays.asList(args)); arguments.remove(args[0]); - if (subCommand.getType() == CommandManager.Type.Admin) { + if (adminCommands.contains(subCommand)) { arguments.remove(args[1]); } @@ -327,6 +238,8 @@ public class CommandManager implements CommandExecutor, TabCompleter { return null; } + boolean isAdmin = sender.hasPermission("fabledskyblock.admin.*") || sender.hasPermission("fabledskyblock.*"); + if (command.getName().equalsIgnoreCase("island")) { List commandAliases = new ArrayList<>(); @@ -334,33 +247,31 @@ public class CommandManager implements CommandExecutor, TabCompleter { if (args[0] == null || args[0].isEmpty()) { commandAliases.add("admin"); - for (SubCommand subCommandList : subCommands.get(Type.Default)) { + for (SubCommand subCommandList : islandCommands) { commandAliases.add(subCommandList.getName()); } } else { - if (sender.hasPermission("fabledskyblock.admin") || sender.hasPermission("fabledskyblock.admin.*") - || sender.hasPermission("fabledskyblock.*")) { + if (isAdmin) { if ("admin".contains(args[0].toLowerCase())) { commandAliases.add("admin"); } } - for (SubCommand subCommandList : subCommands.get(Type.Default)) { + for (SubCommand subCommandList : islandCommands) { if (subCommandList.getName().toLowerCase().contains(args[0].toLowerCase())) { commandAliases.add(subCommandList.getName()); } } } } else if (args.length == 2) { - if (sender.hasPermission("fabledskyblock.admin") || sender.hasPermission("fabledskyblock.admin.*") - || sender.hasPermission("fabledskyblock.*")) { + if (isAdmin) { if (args[0].equalsIgnoreCase("admin")) { if (args[1] == null || args[1].isEmpty()) { - for (SubCommand subCommandList : subCommands.get(Type.Admin)) { + for (SubCommand subCommandList : adminCommands) { commandAliases.add(subCommandList.getName()); } } else { - for (SubCommand subCommandList : subCommands.get(Type.Admin)) { + for (SubCommand subCommandList : adminCommands) { if (subCommandList.getName().toLowerCase().contains(args[1].toLowerCase())) { commandAliases.add(subCommandList.getName()); } @@ -369,16 +280,15 @@ public class CommandManager implements CommandExecutor, TabCompleter { } } - List arguments = getArguments(Type.Default, args[0], args[1]); + List arguments = getIslandArguments(args[0], args[1]); if (arguments.size() != 0) { commandAliases.addAll(arguments); } } else if (args.length == 3) { - if (sender.hasPermission("fabledskyblock.admin") || sender.hasPermission("fabledskyblock.admin.*") - || sender.hasPermission("fabledskyblock.*")) { + if (isAdmin) { if (args[0].equalsIgnoreCase("admin")) { - List arguments = getArguments(Type.Admin, args[1], args[2]); + List arguments = getAdminArguments(args[1], args[2]); if (arguments.size() != 0) { commandAliases.addAll(arguments); @@ -395,10 +305,18 @@ public class CommandManager implements CommandExecutor, TabCompleter { return null; } - public List getArguments(Type type, String arg1, String arg2) { + public List getIslandArguments(String arg1, String arg2) { + return this.getArguments(islandCommands, arg1, arg2); + } + + public List getAdminArguments(String arg1, String arg2) { + return this.getArguments(adminCommands, arg1, arg2); + } + + public List getArguments(List subCommands, String arg1, String arg2) { List arguments = new ArrayList<>(); - for (SubCommand subCommandList : subCommands.get(type)) { + for (SubCommand subCommandList : subCommands) { if (arg1.equalsIgnoreCase(subCommandList.getName())) { if (arg2 == null || arg2.isEmpty()) { arguments.addAll(Arrays.asList(subCommandList.getArguments())); @@ -419,7 +337,15 @@ public class CommandManager implements CommandExecutor, TabCompleter { return arguments; } - public void sendPlayerHelpCommands(Player player, CommandManager.Type type, int page) { + public void sendPlayerIslandHelpCommands(Player player, int page) { + this.sendPlayerHelpCommands(player, islandCommands, page, false); + } + + public void sendPlayerAdminHelpCommands(Player player, int page) { + this.sendPlayerHelpCommands(player, adminCommands, page, true); + } + + public void sendPlayerHelpCommands(Player player, List subCommands, int page, boolean isAdmin) { FileManager fileManager = skyblock.getFileManager(); Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); @@ -427,8 +353,8 @@ public class CommandManager implements CommandExecutor, TabCompleter { int pageSize = 7; - int nextEndIndex = subCommands.get(type).size() - page * pageSize, index = page * pageSize - pageSize, - endIndex = index >= subCommands.get(type).size() ? subCommands.get(type).size() - 1 : index + pageSize; + int nextEndIndex = subCommands.size() - page * pageSize, index = page * pageSize - pageSize, + endIndex = index >= subCommands.size() ? subCommands.size() - 1 : index + pageSize; boolean showAlises = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")) .getFileConfiguration().getBoolean("Command.Help.Aliases.Enable"); @@ -441,13 +367,13 @@ public class CommandManager implements CommandExecutor, TabCompleter { String subCommandText = ""; - if (type == CommandManager.Type.Admin) { + if (isAdmin) { subCommandText = "admin "; } for (String helpLines : configLoad.getStringList("Command.Island.Help.Lines")) { if (helpLines.contains("%type")) { - helpLines = helpLines.replace("%type", type.name()); + helpLines = helpLines.replace("%type", "Admin"); } if (helpLines.contains("%commands")) { @@ -463,38 +389,37 @@ public class CommandManager implements CommandExecutor, TabCompleter { } if (page == -1) { - for (int i = 0; i < subCommands.get(type).size(); i++) { - SubCommand subCommandFromIndex = subCommands.get(type).get(i); + for (SubCommand subCommand : subCommands) { String commandAliases = ""; if (showAlises) { - for (int i1 = 0; i1 < subCommandFromIndex.getAliases().length; i1++) { + for (int i1 = 0; i1 < subCommand.getAliases().length; i1++) { if (i1 == 0) { commandAliases = "/"; } - if (i1 == subCommandFromIndex.getAliases().length - 1) { - commandAliases = commandAliases + subCommandFromIndex.getAliases()[i1]; + if (i1 == subCommand.getAliases().length - 1) { + commandAliases = commandAliases + subCommand.getAliases()[i1]; } else { - commandAliases = commandAliases + subCommandFromIndex.getAliases()[i1] + "/"; + commandAliases = commandAliases + subCommand.getAliases()[i1] + "/"; } } } player.spigot() .sendMessage(new ChatComponent( - prefix.replace("%info", subCommandFromIndex.getInfo()) + "/island " - + subCommandText + subCommandFromIndex.getName() + commandAliases - + suffix.replace("%info", subCommandFromIndex.getInfo()), + prefix.replace("%info", subCommand.getInfo()) + "/island " + + subCommandText + subCommand.getName() + commandAliases + + suffix.replace("%info", subCommand.getInfo()), false, null, null, new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new ComponentBuilder(subCommandFromIndex.getInfo()).create())) - .getTextComponent()); + new ComponentBuilder(subCommand.getInfo()).create())) + .getTextComponent()); } } else { for (; index < endIndex; index++) { - if (subCommands.get(type).size() > index) { - SubCommand subCommandFromIndex = subCommands.get(type).get(index); + if (subCommands.size() > index) { + SubCommand subCommandFromIndex = subCommands.get(index); String commandAliases = ""; if (showAlises) { @@ -588,30 +513,29 @@ public class CommandManager implements CommandExecutor, TabCompleter { String[] commands = { "delete", "owner", "reload", "removehologram", "setsize" }; for (String commandList : commands) { - SubCommand subCommand = getSubCommand(CommandManager.Type.Admin, commandList); + SubCommand subCommand = this.getAdminSubCommand(commandList); sender.sendMessage("* /island admin " + subCommand.getName() + " - " + subCommand.getInfo()); } } - public SubCommand getSubCommand(CommandManager.Type type, String arg) { - for (SubCommand subCommandList : subCommands.get(type)) { - if (subCommandList.getName().equalsIgnoreCase(arg)) { - return subCommandList; - } + public SubCommand getIslandSubCommand(String cmdName) { + return this.getSubCommand(islandCommands, cmdName); + } - for (String argList : subCommandList.getAliases()) { - if (argList.equalsIgnoreCase(arg)) { - return subCommandList; - } - } + public SubCommand getAdminSubCommand(String cmdName) { + return this.getSubCommand(adminCommands, cmdName); + } + + public SubCommand getSubCommand(List subCommands, String cmdName) { + for (SubCommand command : subCommands) { + if (command.getName().equalsIgnoreCase(cmdName)) + return command; + + for (String argList : command.getAliases()) + if (argList.equalsIgnoreCase(cmdName)) + return command; } return null; } - - public enum Type { - - Default, Admin; - - } } diff --git a/src/main/java/me/goodandevil/skyblock/command/SubCommand.java b/src/main/java/me/goodandevil/skyblock/command/SubCommand.java index 6ecab644..9bf5099a 100644 --- a/src/main/java/me/goodandevil/skyblock/command/SubCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/SubCommand.java @@ -1,25 +1,44 @@ package me.goodandevil.skyblock.command; +import me.goodandevil.skyblock.SkyBlock; +import org.bukkit.ChatColor; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; +import org.bukkit.permissions.Permissible; + +import java.io.File; public abstract class SubCommand { - public abstract void onCommandByPlayer(Player player, String[] args); + protected final SkyBlock skyblock; + protected final String info; - public abstract void onCommandByConsole(ConsoleCommandSender sender, String[] args); + public SubCommand() { + this.skyblock = SkyBlock.getInstance(); + this.info = ChatColor.translateAlternateColorCodes('&', this.skyblock.getFileManager().getConfig(new File(this.skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString(this.getInfoMessagePath())); + } - public abstract String getName(); + public abstract void onCommandByPlayer(Player player, String[] args); - public abstract String getInfo(); + public abstract void onCommandByConsole(ConsoleCommandSender sender, String[] args); - public abstract SubCommand setInfo(String info); + public abstract String getName(); - // TODO: public abstract boolean hasPermission(CommandSender sender); + public abstract String getInfoMessagePath(); - public abstract String[] getAliases(); + public abstract String[] getAliases(); - public abstract String[] getArguments(); + public abstract String[] getArguments(); + + public String getInfo() { return this.info; } + + public boolean hasPermission(Permissible toCheck, boolean isAdmin) { + if (toCheck.hasPermission("fabledskyblock.*")) + return true; + + return isAdmin + ? toCheck.hasPermission("fabledskyblock.admin.*") || toCheck.hasPermission("fabledskyblock.admin." + this.getName()) + : toCheck.hasPermission("fabledskyblock.island.*") || toCheck.hasPermission("fabledskyblock.island." + this.getName()); + } - public abstract CommandManager.Type getType(); } 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 dd3d4e36..e003b4f1 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 @@ -28,13 +28,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class AddUpgradeCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public AddUpgradeCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { onCommand(player, args); @@ -168,13 +161,6 @@ public class AddUpgradeCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; 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 2d9a316d..30616928 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 @@ -19,13 +19,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class CreateCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public CreateCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -65,13 +58,6 @@ public class CreateCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; 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 28b2fb4a..595b7f10 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 @@ -28,13 +28,6 @@ import me.goodandevil.skyblock.utils.world.LocationUtil; public class DeleteCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public DeleteCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { onCommand(player, args); @@ -131,13 +124,6 @@ public class DeleteCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "remove", "disband" }; 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 f407d914..e8cb50c5 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 @@ -20,13 +20,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class GeneratorCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public GeneratorCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -70,13 +63,6 @@ public class GeneratorCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; 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 0022f8f2..8f05eb9a 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 @@ -18,13 +18,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class LevelCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public LevelCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { SoundManager soundManager = skyblock.getSoundManager(); @@ -59,13 +52,6 @@ public class LevelCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "levelling", "points" }; 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 5152b9c7..1eb0df55 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 @@ -23,13 +23,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class OwnerCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public OwnerCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { onCommand(player, args); @@ -116,13 +109,6 @@ public class OwnerCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "ownership", "leader" }; 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 31f59c98..2583c9fb 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 @@ -27,13 +27,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class ReloadCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public ReloadCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { onCommand(player, args); @@ -132,13 +125,6 @@ public class ReloadCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; 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 f6843946..295b12d9 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 @@ -25,13 +25,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class RemoveHologramCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public RemoveHologramCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { onCommand(player, args); @@ -128,13 +121,6 @@ public class RemoveHologramCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; 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 2fc06348..eaa0fe50 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 @@ -28,13 +28,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class RemoveUpgradeCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public RemoveUpgradeCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { onCommand(player, args); @@ -168,13 +161,6 @@ public class RemoveUpgradeCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; 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 1d17c977..0f4b3da1 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 @@ -23,13 +23,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class SetHologramCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public SetHologramCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { HologramManager hologramManager = skyblock.getHologramManager(); @@ -107,13 +100,6 @@ public class SetHologramCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; 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 cc635df4..ad13f63c 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 @@ -28,13 +28,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class SetSizeCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public SetSizeCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { onCommand(player, args); @@ -158,13 +151,6 @@ public class SetSizeCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; 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 58a75b29..51a3b2bc 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 @@ -18,13 +18,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class SetSpawnCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public SetSpawnCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -62,13 +55,6 @@ public class SetSpawnCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; 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 8399cc0c..7058fe15 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 @@ -18,13 +18,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class SettingsCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public SettingsCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { SoundManager soundManager = skyblock.getSoundManager(); @@ -59,13 +52,6 @@ public class SettingsCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "permissions", "perms", "p" }; 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 aa1e508f..64a16e62 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 @@ -28,13 +28,6 @@ import me.goodandevil.skyblock.command.SubCommand; public class StructureCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public StructureCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -228,13 +221,6 @@ public class StructureCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; 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 e681367c..fe9c751d 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 @@ -20,13 +20,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class UpgradeCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public UpgradeCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -69,13 +62,6 @@ public class UpgradeCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/AcceptCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/AcceptCommand.java similarity index 94% rename from src/main/java/me/goodandevil/skyblock/command/commands/AcceptCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/AcceptCommand.java index 84856c38..72161746 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/AcceptCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/AcceptCommand.java @@ -1,22 +1,6 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; -import java.io.File; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -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.player.PlayerIslandJoinEvent; -import me.goodandevil.skyblock.command.CommandManager.Type; -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; @@ -32,16 +16,21 @@ import me.goodandevil.skyblock.scoreboard.Scoreboard; 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.ChatColor; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; public class AcceptCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public AcceptCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -243,15 +232,8 @@ public class AcceptCommand 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.Accept.Info.Message"; } @Override @@ -263,9 +245,4 @@ public class AcceptCommand 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/BanCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/BanCommand.java similarity index 90% rename from src/main/java/me/goodandevil/skyblock/command/commands/BanCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/BanCommand.java index 5110cb89..bf7eb5af 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/BanCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/BanCommand.java @@ -1,14 +1,7 @@ -package me.goodandevil.skyblock.command.commands; +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.command.CommandManager.Type; +import me.goodandevil.skyblock.ban.Ban; +import me.goodandevil.skyblock.command.SubCommand; import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.island.Island; @@ -19,20 +12,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 me.goodandevil.skyblock.SkyBlock; -import me.goodandevil.skyblock.ban.Ban; -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; +import java.util.UUID; public class BanCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public BanCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -132,15 +121,8 @@ public class BanCommand 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.Ban.Info.Message"; } @Override @@ -152,9 +134,4 @@ public class BanCommand 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/BankCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/BankCommand.java similarity index 90% rename from src/main/java/me/goodandevil/skyblock/command/commands/BankCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/BankCommand.java index cad20f9b..ef57c9d1 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/BankCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/BankCommand.java @@ -1,7 +1,5 @@ -package me.goodandevil.skyblock.command.commands; +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; @@ -21,13 +19,6 @@ import java.io.File; public class BankCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public BankCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -127,15 +118,8 @@ public class BankCommand 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.Bank.Info.Message"; } @Override @@ -147,9 +131,4 @@ public class BankCommand 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/BansCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/BansCommand.java similarity index 81% rename from src/main/java/me/goodandevil/skyblock/command/commands/BansCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/BansCommand.java index 8bf6e2f2..6a97d3ba 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/BansCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/BansCommand.java @@ -1,15 +1,6 @@ -package me.goodandevil.skyblock.command.commands; +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.IslandRole; @@ -17,16 +8,14 @@ import me.goodandevil.skyblock.menus.Bans; 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 BansCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public BansCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -67,15 +56,8 @@ public class BansCommand 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.Bans.Info.Message"; } @Override @@ -87,9 +69,4 @@ public class BansCommand 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/BiomeCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/BiomeCommand.java similarity index 80% rename from src/main/java/me/goodandevil/skyblock/command/commands/BiomeCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/BiomeCommand.java index 9cb3159f..4991b5a5 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/BiomeCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/BiomeCommand.java @@ -1,15 +1,6 @@ -package me.goodandevil.skyblock.command.commands; +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,16 +8,14 @@ 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 BiomeCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public BiomeCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -63,15 +52,8 @@ public class BiomeCommand 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.Biome.Info.Message"; } @Override @@ -83,9 +65,4 @@ public class BiomeCommand 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/BorderCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/BorderCommand.java similarity index 91% rename from src/main/java/me/goodandevil/skyblock/command/commands/BorderCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/BorderCommand.java index d272f797..b575afad 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/BorderCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/BorderCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -21,13 +21,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class BorderCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public BorderCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -75,13 +68,6 @@ public class BorderCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "worldborder", "wb" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/CancelCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/CancelCommand.java similarity index 94% rename from src/main/java/me/goodandevil/skyblock/command/commands/CancelCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/CancelCommand.java index 52a6e65a..8414c467 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/CancelCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/CancelCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -23,13 +23,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class CancelCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public CancelCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -103,13 +96,6 @@ public class CancelCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/ChatCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/ChatCommand.java similarity index 93% rename from src/main/java/me/goodandevil/skyblock/command/commands/ChatCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/ChatCommand.java index 10e130c2..dfed1835 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/ChatCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/ChatCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -24,13 +24,6 @@ import me.goodandevil.skyblock.command.SubCommand; public class ChatCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public ChatCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -88,13 +81,6 @@ public class ChatCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/CloseCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/CloseCommand.java similarity index 91% rename from src/main/java/me/goodandevil/skyblock/command/commands/CloseCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/CloseCommand.java index 12faa458..6fb6bb9f 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/CloseCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/CloseCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -20,13 +20,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class CloseCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public CloseCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -74,13 +67,6 @@ public class CloseCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/ConfirmCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/ConfirmCommand.java similarity index 97% rename from src/main/java/me/goodandevil/skyblock/command/commands/ConfirmCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/ConfirmCommand.java index 23f94d8a..283eb3f6 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/ConfirmCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/ConfirmCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.util.UUID; @@ -34,13 +34,6 @@ import me.goodandevil.skyblock.utils.world.LocationUtil; public class ConfirmCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public ConfirmCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -218,13 +211,6 @@ public class ConfirmCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "confirmation" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/ControlPanelCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/ControlPanelCommand.java similarity index 87% rename from src/main/java/me/goodandevil/skyblock/command/commands/ControlPanelCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/ControlPanelCommand.java index c620bffe..e22c3576 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/ControlPanelCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/ControlPanelCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -17,13 +17,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class ControlPanelCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public ControlPanelCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { SoundManager soundManager = skyblock.getSoundManager(); @@ -56,13 +49,6 @@ public class ControlPanelCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "cp" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/CoopCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/CoopCommand.java similarity index 95% rename from src/main/java/me/goodandevil/skyblock/command/commands/CoopCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/CoopCommand.java index f5f19554..97b66992 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/CoopCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/CoopCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.util.UUID; @@ -26,13 +26,6 @@ import me.goodandevil.skyblock.utils.world.LocationUtil; public class CoopCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public CoopCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -146,13 +139,6 @@ public class CoopCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/CreateCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/CreateCommand.java similarity index 95% rename from src/main/java/me/goodandevil/skyblock/command/commands/CreateCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/CreateCommand.java index 6f30f2f3..f4b50768 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/CreateCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/CreateCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.util.List; @@ -27,13 +27,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class CreateCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public CreateCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { CooldownManager cooldownManager = skyblock.getCooldownManager(); @@ -128,13 +121,6 @@ public class CreateCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "new" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/CurrentCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/CurrentCommand.java similarity index 94% rename from src/main/java/me/goodandevil/skyblock/command/commands/CurrentCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/CurrentCommand.java index 6fdbb592..1fc86222 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/CurrentCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/CurrentCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -21,13 +21,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class CurrentCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public CurrentCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -132,13 +125,6 @@ public class CurrentCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "cur" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/DeleteCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/DeleteCommand.java similarity index 95% rename from src/main/java/me/goodandevil/skyblock/command/commands/DeleteCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/DeleteCommand.java index 0e7b5566..c57272ad 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/DeleteCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/DeleteCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -31,13 +31,6 @@ import net.md_5.bungee.chat.ComponentSerializer; public class DeleteCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public DeleteCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -153,13 +146,6 @@ public class DeleteCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "remove", "disband", "reset", "restart" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/DemoteCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/DemoteCommand.java similarity index 95% rename from src/main/java/me/goodandevil/skyblock/command/commands/DemoteCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/DemoteCommand.java index e34fe793..d9ecfdc0 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/DemoteCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/DemoteCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.util.Set; @@ -24,13 +24,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class DemoteCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public DemoteCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -126,13 +119,6 @@ public class DemoteCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/DenyCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/DenyCommand.java similarity index 92% rename from src/main/java/me/goodandevil/skyblock/command/commands/DenyCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/DenyCommand.java index dcf61c67..4acd59c5 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/DenyCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/DenyCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -20,13 +20,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class DenyCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public DenyCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -85,13 +78,6 @@ public class DenyCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/InformationCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/InformationCommand.java similarity index 93% rename from src/main/java/me/goodandevil/skyblock/command/commands/InformationCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/InformationCommand.java index 54d11ac1..8c30670b 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/InformationCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/InformationCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.util.UUID; @@ -24,13 +24,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class InformationCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public InformationCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -111,13 +104,6 @@ public class InformationCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "info" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/InviteCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/InviteCommand.java similarity index 98% rename from src/main/java/me/goodandevil/skyblock/command/commands/InviteCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/InviteCommand.java index f750841e..6d551d6d 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/InviteCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/InviteCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -33,13 +33,6 @@ import net.md_5.bungee.chat.ComponentSerializer; public class InviteCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public InviteCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -262,13 +255,6 @@ public class InviteCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/KickAllCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/KickAllCommand.java similarity index 93% rename from src/main/java/me/goodandevil/skyblock/command/commands/KickAllCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/KickAllCommand.java index e7db1845..6261cf73 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/KickAllCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/KickAllCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.util.Set; @@ -26,13 +26,6 @@ import me.goodandevil.skyblock.utils.world.LocationUtil; public class KickAllCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public KickAllCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -105,13 +98,6 @@ public class KickAllCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/KickCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/KickCommand.java similarity index 97% rename from src/main/java/me/goodandevil/skyblock/command/commands/KickCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/KickCommand.java index c17cd4a3..69cb4999 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/KickCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/KickCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.io.IOException; @@ -34,13 +34,6 @@ import me.goodandevil.skyblock.utils.world.LocationUtil; public class KickCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public KickCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -275,13 +268,6 @@ public class KickCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/LeaderboardCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/LeaderboardCommand.java similarity index 92% rename from src/main/java/me/goodandevil/skyblock/command/commands/LeaderboardCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/LeaderboardCommand.java index 6a069b5e..60bc50f3 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/LeaderboardCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/LeaderboardCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -20,13 +20,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class LeaderboardCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public LeaderboardCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -97,13 +90,6 @@ public class LeaderboardCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "lb", "top" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/LeaveCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/LeaveCommand.java similarity index 96% rename from src/main/java/me/goodandevil/skyblock/command/commands/LeaveCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/LeaveCommand.java index 01d06fda..a147bc3b 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/LeaveCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/LeaveCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.util.Set; @@ -30,13 +30,6 @@ import me.goodandevil.skyblock.utils.world.LocationUtil; public class LeaveCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public LeaveCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -168,13 +161,6 @@ public class LeaveCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/LevelCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/LevelCommand.java similarity index 96% rename from src/main/java/me/goodandevil/skyblock/command/commands/LevelCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/LevelCommand.java index a9c9efc6..c47d2a59 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/LevelCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/LevelCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.util.UUID; @@ -31,13 +31,6 @@ import me.goodandevil.skyblock.visit.VisitManager; public class LevelCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public LevelCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -179,13 +172,6 @@ public class LevelCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "levelling", "points" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/MembersCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/MembersCommand.java similarity index 87% rename from src/main/java/me/goodandevil/skyblock/command/commands/MembersCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/MembersCommand.java index 57817dd1..52fe17aa 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/MembersCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/MembersCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -16,13 +16,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class MembersCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public MembersCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { SoundManager soundManager = skyblock.getSoundManager(); @@ -58,13 +51,6 @@ public class MembersCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/OpenCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/OpenCommand.java similarity index 91% rename from src/main/java/me/goodandevil/skyblock/command/commands/OpenCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/OpenCommand.java index 44a236f2..9193e479 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/OpenCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/OpenCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -20,13 +20,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class OpenCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public OpenCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -74,13 +67,6 @@ public class OpenCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/OwnerCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/OwnerCommand.java similarity index 97% rename from src/main/java/me/goodandevil/skyblock/command/commands/OwnerCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/OwnerCommand.java index 2094e83d..78027d7b 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/OwnerCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/OwnerCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.util.UUID; @@ -40,13 +40,6 @@ import net.md_5.bungee.chat.ComponentSerializer; public class OwnerCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public OwnerCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { CooldownManager cooldownManager = skyblock.getCooldownManager(); @@ -273,13 +266,6 @@ public class OwnerCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "ownership", "transfer", "makeleader", "makeowner" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/PromoteCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/PromoteCommand.java similarity index 96% rename from src/main/java/me/goodandevil/skyblock/command/commands/PromoteCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/PromoteCommand.java index 356cc979..e46939fa 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/PromoteCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/PromoteCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import me.goodandevil.skyblock.SkyBlock; import me.goodandevil.skyblock.command.CommandManager; @@ -24,13 +24,6 @@ import java.util.UUID; public class PromoteCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public PromoteCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -155,13 +148,6 @@ public class PromoteCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/PublicCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/PublicCommand.java similarity index 91% rename from src/main/java/me/goodandevil/skyblock/command/commands/PublicCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/PublicCommand.java index 69d65016..0f6093d8 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/PublicCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/PublicCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -20,13 +20,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class PublicCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public PublicCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -76,13 +69,6 @@ public class PublicCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "pub", "private", "pri" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/SetSpawnCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/SetSpawnCommand.java similarity index 96% rename from src/main/java/me/goodandevil/skyblock/command/commands/SetSpawnCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/SetSpawnCommand.java index 467d023a..62b3fbd1 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/SetSpawnCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/SetSpawnCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -29,14 +29,6 @@ import me.goodandevil.skyblock.utils.world.LocationUtil; public class SetSpawnCommand extends SubCommand { - private final SkyBlock skyblock; - - private String info; - - public SetSpawnCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -188,13 +180,6 @@ public class SetSpawnCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/SettingsCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/SettingsCommand.java similarity index 91% rename from src/main/java/me/goodandevil/skyblock/command/commands/SettingsCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/SettingsCommand.java index 1417aca8..61362972 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/SettingsCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/SettingsCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -20,13 +20,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class SettingsCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public SettingsCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -76,13 +69,6 @@ public class SettingsCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "permissions", "perms", "p" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/TeleportCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/TeleportCommand.java similarity index 95% rename from src/main/java/me/goodandevil/skyblock/command/commands/TeleportCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/TeleportCommand.java index d72cc6a7..0a4efcfb 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/TeleportCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/TeleportCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.util.UUID; @@ -26,13 +26,6 @@ import me.goodandevil.skyblock.visit.VisitManager; public class TeleportCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public TeleportCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -156,13 +149,6 @@ public class TeleportCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "tp", "spawn", "home", "go", "warp" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/UnbanCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/UnbanCommand.java similarity index 96% rename from src/main/java/me/goodandevil/skyblock/command/commands/UnbanCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/UnbanCommand.java index 7500d927..102acc9e 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/UnbanCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/UnbanCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.util.UUID; @@ -25,13 +25,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class UnbanCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public UnbanCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/UnlockCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/UnlockCommand.java similarity index 93% rename from src/main/java/me/goodandevil/skyblock/command/commands/UnlockCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/UnlockCommand.java index 5d520302..e705097d 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/UnlockCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/UnlockCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import me.goodandevil.skyblock.SkyBlock; import me.goodandevil.skyblock.command.CommandManager.Type; @@ -21,13 +21,6 @@ import java.io.File; public class UnlockCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public UnlockCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -106,13 +99,6 @@ public class UnlockCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/UpgradeCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/UpgradeCommand.java similarity index 89% rename from src/main/java/me/goodandevil/skyblock/command/commands/UpgradeCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/UpgradeCommand.java index a0732143..56793400 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/UpgradeCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/UpgradeCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -18,13 +18,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class UpgradeCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public UpgradeCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -65,13 +58,6 @@ public class UpgradeCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[] { "upgrades" }; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/ValueCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/ValueCommand.java similarity index 93% rename from src/main/java/me/goodandevil/skyblock/command/commands/ValueCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/ValueCommand.java index 609ece1e..b8fd7d6c 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/ValueCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/ValueCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -24,13 +24,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class ValueCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public ValueCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @SuppressWarnings("deprecation") @Override public void onCommandByPlayer(Player player, String[] args) { @@ -95,13 +88,6 @@ public class ValueCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/VisitCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/VisitCommand.java similarity index 88% rename from src/main/java/me/goodandevil/skyblock/command/commands/VisitCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/VisitCommand.java index 5130f109..2d398ed7 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/VisitCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/VisitCommand.java @@ -1,8 +1,9 @@ -package me.goodandevil.skyblock.command.commands; +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; @@ -18,13 +19,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class VisitCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public VisitCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -64,14 +58,7 @@ public class VisitCommand extends SubCommand { @Override public String getInfo() { - return info; - } - - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; + return this.info; } @Override diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/VisitorsCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/VisitorsCommand.java similarity index 90% rename from src/main/java/me/goodandevil/skyblock/command/commands/VisitorsCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/VisitorsCommand.java index 2d389e55..b3688071 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/VisitorsCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/VisitorsCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -20,13 +20,6 @@ import me.goodandevil.skyblock.command.SubCommand; public class VisitorsCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public VisitorsCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -68,13 +61,6 @@ public class VisitorsCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/VoteCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/VoteCommand.java similarity index 95% rename from src/main/java/me/goodandevil/skyblock/command/commands/VoteCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/VoteCommand.java index e95e6329..31dc2347 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/VoteCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/VoteCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; import java.util.UUID; @@ -27,13 +27,6 @@ import me.goodandevil.skyblock.visit.VisitManager; public class VoteCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public VoteCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); @@ -144,13 +137,6 @@ public class VoteCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/WeatherCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/WeatherCommand.java similarity index 90% rename from src/main/java/me/goodandevil/skyblock/command/commands/WeatherCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/WeatherCommand.java index e2fbde9c..80a73172 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/WeatherCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/WeatherCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island; import java.io.File; @@ -20,13 +20,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class WeatherCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public WeatherCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -67,13 +60,6 @@ public class WeatherCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/ResetCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/ResetCommand.java similarity index 93% rename from src/main/java/me/goodandevil/skyblock/command/commands/ResetCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/ResetCommand.java index 5fe7cd9f..9cfa4736 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/ResetCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/ResetCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island.disabled; import java.io.File; @@ -28,13 +28,6 @@ import net.md_5.bungee.api.chat.HoverEvent; public class ResetCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public ResetCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -99,13 +92,6 @@ public class ResetCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/command/commands/RollbackCommand.java b/src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/RollbackCommand.java similarity index 89% rename from src/main/java/me/goodandevil/skyblock/command/commands/RollbackCommand.java rename to src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/RollbackCommand.java index 9113f0ac..e369b633 100644 --- a/src/main/java/me/goodandevil/skyblock/command/commands/RollbackCommand.java +++ b/src/main/java/me/goodandevil/skyblock/command/commands/island/disabled/RollbackCommand.java @@ -1,4 +1,4 @@ -package me.goodandevil.skyblock.command.commands; +package me.goodandevil.skyblock.command.commands.island.disabled; import java.io.File; @@ -21,13 +21,6 @@ import me.goodandevil.skyblock.utils.version.Sounds; public class RollbackCommand extends SubCommand { - private final SkyBlock skyblock; - private String info; - - public RollbackCommand(SkyBlock skyblock) { - this.skyblock = skyblock; - } - @Override public void onCommandByPlayer(Player player, String[] args) { MessageManager messageManager = skyblock.getMessageManager(); @@ -66,13 +59,6 @@ public class RollbackCommand extends SubCommand { return info; } - @Override - public SubCommand setInfo(String info) { - this.info = info; - - return this; - } - @Override public String[] getAliases() { return new String[0]; diff --git a/src/main/java/me/goodandevil/skyblock/utils/reflection/PackageClassLoader.java b/src/main/java/me/goodandevil/skyblock/utils/reflection/PackageClassLoader.java new file mode 100644 index 00000000..50599d43 --- /dev/null +++ b/src/main/java/me/goodandevil/skyblock/utils/reflection/PackageClassLoader.java @@ -0,0 +1,72 @@ +package me.goodandevil.skyblock.utils.reflection; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +public class PackageClassLoader { + + public static List> getClassesOfTypeFromPackage(String packageName, Class classType) { + try { + List> classes = new ArrayList<>(); + for (String className : getClassNamesFromPackage(packageName)) { + Class clazz = Class.forName(className); + if (clazz.isAssignableFrom(classType)) { + classes.add((Class) clazz); + } + } + return classes; + } catch (Exception ignored) { + return new ArrayList<>(); + } + } + + public static List getClassNamesFromPackage(String packageName) throws IOException, URISyntaxException { + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + URL packageURL; + List names = new ArrayList<>(); + + packageName = packageName.replace(".", "/"); + packageURL = classLoader.getResource(packageName); + + if (packageURL.getProtocol().equals("jar")) { + String jarFileName; + JarFile jf; + Enumeration jarEntries; + String entryName; + + jarFileName = URLDecoder.decode(packageURL.getFile(), "UTF-8"); + jarFileName = jarFileName.substring(5, jarFileName.indexOf("!")); + + jf = new JarFile(jarFileName); + jarEntries = jf.entries(); + while (jarEntries.hasMoreElements()) { + entryName = jarEntries.nextElement().getName(); + if (entryName.startsWith(packageName) && entryName.length() > packageName.length() + 5) { + entryName = entryName.substring(packageName.length(), entryName.lastIndexOf('.')); + names.add(entryName); + } + } + } else { + URI uri = new URI(packageURL.toString()); + File folder = new File(uri.getPath()); + File[] contenuti = folder.listFiles(); + String entryName; + for (File actual : contenuti) { + entryName = actual.getName(); + entryName = entryName.substring(0, entryName.lastIndexOf('.')); + names.add(entryName); + } + } + return names; + } + +} diff --git a/src/main/resources/language.yml b/src/main/resources/language.yml index 2fd1dc1d..0206ae02 100644 --- a/src/main/resources/language.yml +++ b/src/main/resources/language.yml @@ -1,4 +1,9 @@ Command: + PermissionDenied: + Island: + Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command" + Admin: + Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command" Island: Argument: Unrecognised: @@ -688,46 +693,31 @@ Command: Private: Message: "&bSkyBlock &8| &aInfo&8: &eYour Island is now &cPrivate&e." Admin: - Help: - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Create: Info: Message: "&f&oManage Structures for the Island Creator menu." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Upgrade: Info: Message: "&f&oManager Upgrades for the Island Upgrade menu." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Disabled: Message: "&bSkyBlock &8| &cError&8: &eYou cannot peform that command because upgrades have been disabled." Generator: Info: Message: "&f&oManager generators for cobblestone generators." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Disabled: Message: "&bSkyBlock &8| &cError&8: &eYou cannot peform that command because the generator has been disabled." Level: Info: Message: "&f&oChange Island level materials and points." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Settings: Info: Message: "&f&oChange the default settings for when an Island is created." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Structure: Info: Message: "&f&oCreate structures for Islands." Tool: Info: Message: "&f&oGives the player the Structure tool item." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Inventory: Message: "&bSkyBlock &8| &cError&8: &eYou already have the Structure tool in your Inventory." Equiped: @@ -735,8 +725,6 @@ Command: Save: Info: Message: "&f&oSaves a selected Structure." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Invalid: Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island admin structure save " Position: @@ -759,15 +747,11 @@ Command: SetSpawn: Info: Message: "&f&oSets the spawn point to your location." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Set: Message: "&bSkyBlock &8| &aInfo&8: &eThe spawn point has been set to your location." SetHologram: Info: Message: "&f&oSets the location of a hologram." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Invalid: Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island admin sethologram " Set: @@ -775,8 +759,6 @@ Command: RemoveHologram: Info: Message: "&f&oRemoves an existing hologram." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Invalid: Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island admin removehologram " Set: @@ -786,8 +768,6 @@ Command: SetSize: Info: Message: "&f&oSets the size of a players Island." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Invalid: Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island admin setsize " Numerical: @@ -807,8 +787,6 @@ Command: AddUpgrade: Info: Message: "&f&oAdd an upgrade to a players Island." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Invalid: Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island admin addupgrade " Island: @@ -826,8 +804,6 @@ Command: RemoveUpgrade: Info: Message: "&f&oRemoves an upgrade from a players Island." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Invalid: Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island admin removeupgrade " Island: @@ -845,8 +821,6 @@ Command: Delete: Info: Message: "&f&oDelete a players Island permanently." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Invalid: Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island admin delete " Owner: @@ -858,8 +832,6 @@ Command: Owner: Info: Message: "&f&oGet the owner of a player's Island." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." Invalid: Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island admin owner " Island: @@ -871,9 +843,7 @@ Command: Message: "&bSkyBlock &8| &aInfo&8: &eThe player &d%player &eis an Island owner." Reload: Info: - Message: "&f&oReload all loaded files." - Permission: - Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to perform that command." + Message: "&f&oReload all loaded files." Reloaded: Message: "&bSkyBlock &8| &aInfo&8: &eAll loaded files have been reloaded." Island: @@ -3190,8 +3160,6 @@ Menu: Displayname: "&aSet Biome" Weather: Displayname: "&aSet Weather" - CoopPlayers: - Displayname: "&aCoop Players" Owner: Title: "&8Settings Editor - Island" Item: