Refactored commands and added permissions

This commit is contained in:
Esophose 2019-03-10 05:14:38 -06:00
parent ceb059bc3e
commit 686facd6cb
62 changed files with 347 additions and 1216 deletions

View File

@ -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

View File

@ -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<CommandManager.Type, List<SubCommand>> subCommands = new HashMap<>();
private List<SubCommand> islandCommands;
private List<SubCommand> 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<SubCommand> 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<String> arguments = new ArrayList<>();
List<String> 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<String> 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<String> arguments = getArguments(Type.Default, args[0], args[1]);
List<String> 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<String> arguments = getArguments(Type.Admin, args[1], args[2]);
List<String> 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<String> getArguments(Type type, String arg1, String arg2) {
public List<String> getIslandArguments(String arg1, String arg2) {
return this.getArguments(islandCommands, arg1, arg2);
}
public List<String> getAdminArguments(String arg1, String arg2) {
return this.getArguments(adminCommands, arg1, arg2);
}
public List<String> getArguments(List<SubCommand> subCommands, String arg1, String arg2) {
List<String> 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<SubCommand> 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<SubCommand> 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;
}
}

View File

@ -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();
}

View File

@ -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];

View File

@ -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];

View File

@ -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" };

View File

@ -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];

View File

@ -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" };

View File

@ -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" };

View File

@ -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];

View File

@ -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];

View File

@ -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];

View File

@ -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];

View File

@ -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];

View File

@ -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];

View File

@ -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" };

View File

@ -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];

View File

@ -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];

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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" };

View File

@ -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];

View File

@ -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];

View File

@ -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];

View File

@ -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" };

View File

@ -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" };

View File

@ -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];

View File

@ -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" };

View File

@ -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" };

View File

@ -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" };

View File

@ -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];

View File

@ -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];

View File

@ -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" };

View File

@ -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];

View File

@ -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];

View File

@ -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];

View File

@ -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" };

View File

@ -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];

View File

@ -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" };

View File

@ -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];

View File

@ -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];

View File

@ -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" };

View File

@ -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];

View File

@ -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" };

View File

@ -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];

View File

@ -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" };

View File

@ -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" };

View File

@ -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();

View File

@ -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];

View File

@ -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" };

View File

@ -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];

View File

@ -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

View File

@ -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];

View File

@ -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];

View File

@ -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];

View File

@ -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];

View File

@ -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];

View File

@ -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 <T> List<Class<? extends T>> getClassesOfTypeFromPackage(String packageName, Class<T> classType) {
try {
List<Class<? extends T>> classes = new ArrayList<>();
for (String className : getClassNamesFromPackage(packageName)) {
Class<?> clazz = Class.forName(className);
if (clazz.isAssignableFrom(classType)) {
classes.add((Class<? extends T>) clazz);
}
}
return classes;
} catch (Exception ignored) {
return new ArrayList<>();
}
}
public static List<String> getClassNamesFromPackage(String packageName) throws IOException, URISyntaxException {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL packageURL;
List<String> names = new ArrayList<>();
packageName = packageName.replace(".", "/");
packageURL = classLoader.getResource(packageName);
if (packageURL.getProtocol().equals("jar")) {
String jarFileName;
JarFile jf;
Enumeration<JarEntry> 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;
}
}

View File

@ -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 <name>"
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 <Level|Votes>"
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 <Level|Votes>"
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 <player> <size>"
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 <player> <upgrade>"
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 <player> <upgrade>"
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 <player_name>"
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 <player_name>"
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: