diff --git a/src/main/java/us/tastybento/bskyblock/api/commands/BSBCommand.java b/src/main/java/us/tastybento/bskyblock/api/commands/BSBCommand.java index 96da0df76..5f7be5969 100644 --- a/src/main/java/us/tastybento/bskyblock/api/commands/BSBCommand.java +++ b/src/main/java/us/tastybento/bskyblock/api/commands/BSBCommand.java @@ -20,11 +20,12 @@ public interface BSBCommand { /** * What will be executed when this command is run - * @param user - the User - * @param args - command arguments + * @param user the User who is executing the command + * @param label the label which has been used to execute the command (can be the command's label OR an alias) + * @param args the command arguments * @return true or false - true if the command executed successfully */ - boolean execute(User user, List args); + boolean execute(User user, String label, List args); /** * Tab Completer for CompositeCommands. Note that any registered sub-commands will be automatically diff --git a/src/main/java/us/tastybento/bskyblock/api/commands/CompositeCommand.java b/src/main/java/us/tastybento/bskyblock/api/commands/CompositeCommand.java index 309fbd8e3..93f142395 100644 --- a/src/main/java/us/tastybento/bskyblock/api/commands/CompositeCommand.java +++ b/src/main/java/us/tastybento/bskyblock/api/commands/CompositeCommand.java @@ -198,7 +198,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi return false; } // Execute and trim args - return cmd.execute(user, Arrays.asList(args).subList(cmd.subCommandLevel, args.length)); + return cmd.execute(user, args[cmd.subCommandLevel-1], Arrays.asList(args).subList(cmd.subCommandLevel, args.length)); } /** @@ -508,7 +508,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi * @return result of help command or false if no help defined */ protected boolean showHelp(CompositeCommand command, User user) { - return command.getSubCommand("help").map(helpCommand -> helpCommand.execute(user, new ArrayList<>())).orElse(false); + return command.getSubCommand("help").map(helpCommand -> helpCommand.execute(user, helpCommand.getLabel(), new ArrayList<>())).orElse(false); } /** diff --git a/src/main/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommand.java b/src/main/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommand.java index cecda1f06..5de58f9c5 100644 --- a/src/main/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommand.java +++ b/src/main/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommand.java @@ -37,7 +37,7 @@ public class DefaultHelpCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { int depth = 0; if (args.size() == 1) { if (NumberUtils.isDigits(args.get(0))) { @@ -82,7 +82,7 @@ public class DefaultHelpCommand extends CompositeCommand { if (!subCommand.getLabel().equals(HELP)) { // Every command should have help because every command has a default help Optional sub = subCommand.getSubCommand(HELP); - sub.ifPresent(compositeCommand -> compositeCommand.execute(user, Collections.singletonList(String.valueOf(newDepth)))); + sub.ifPresent(compositeCommand -> compositeCommand.execute(user, HELP, Collections.singletonList(String.valueOf(newDepth)))); } } } diff --git a/src/main/java/us/tastybento/bskyblock/commands/IslandCommand.java b/src/main/java/us/tastybento/bskyblock/commands/IslandCommand.java index 07b1218fc..d7cfac96f 100755 --- a/src/main/java/us/tastybento/bskyblock/commands/IslandCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/IslandCommand.java @@ -58,17 +58,17 @@ public class IslandCommand extends CompositeCommand { * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) */ @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (user == null) { return false; } if (args.isEmpty()) { // If user has an island, go if (getPlugin().getIslands().getIsland(getWorld(), user.getUniqueId()) != null) { - return getSubCommand("go").map(goCmd -> goCmd.execute(user, new ArrayList<>())).orElse(false); + return getSubCommand("go").map(goCmd -> goCmd.execute(user, goCmd.getLabel(), new ArrayList<>())).orElse(false); } // No islands currently - return getSubCommand("create").map(createCmd -> createCmd.execute(user, new ArrayList<>())).orElse(false); + return getSubCommand("create").map(createCmd -> createCmd.execute(user, createCmd.getLabel(), new ArrayList<>())).orElse(false); } user.sendMessage("general.errors.unknown-command", TextVariables.LABEL, getTopLabel()); return false; diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminGetRankCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminGetRankCommand.java index 66da8b39a..c97fd1741 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminGetRankCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminGetRankCommand.java @@ -39,7 +39,7 @@ public class AdminGetRankCommand extends CompositeCommand { * @see us.tastybento.bskyblock.api.commands.BSBCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List) */ @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (args.size() != 1) { // Show help showHelp(this, user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommand.java index a259a3b6d..991391a11 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommand.java @@ -21,7 +21,7 @@ public class AdminInfoCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (args.size() > 1 || (args.isEmpty() && !user.isPlayer())) { // Show help showHelp(this, user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommand.java index 8ebfeeadd..356dd7056 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommand.java @@ -28,7 +28,7 @@ public class AdminRegisterCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { // If args are not right, show help if (args.size() != 1) { showHelp(this, user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminReloadCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminReloadCommand.java index 61543ecdd..b95837c2a 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminReloadCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminReloadCommand.java @@ -30,7 +30,7 @@ public class AdminReloadCommand extends CompositeCommand { * @see us.tastybento.bskyblock.api.commands.BSBCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List) */ @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { return true; } diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminSchemCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminSchemCommand.java index e2137ea96..e77d13ca3 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminSchemCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminSchemCommand.java @@ -33,7 +33,7 @@ public class AdminSchemCommand extends CompositeCommand { @Override @SuppressWarnings("deprecation") - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (args.isEmpty()) { showHelp(this, user); return false; diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminSetRankCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminSetRankCommand.java index 369da93d5..0ec49b4f9 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminSetRankCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminSetRankCommand.java @@ -36,7 +36,7 @@ public class AdminSetRankCommand extends CompositeCommand { * @see us.tastybento.bskyblock.api.commands.BSBCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List) */ @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (args.size() != 2) { // Show help showHelp(this, user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminTeleportCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminTeleportCommand.java index 7dbc0b242..144c8bb0c 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminTeleportCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminTeleportCommand.java @@ -28,7 +28,7 @@ public class AdminTeleportCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (args.isEmpty()) { this.showHelp(this, user); return true; diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommand.java index 893a17bc1..190a24424 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommand.java @@ -23,7 +23,7 @@ public class AdminUnregisterCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { // If args are not right, show help if (args.size() != 1) { showHelp(this, user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminVersionCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminVersionCommand.java index 6880745e3..852ff740f 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminVersionCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/AdminVersionCommand.java @@ -19,7 +19,7 @@ public class AdminVersionCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { return false; } diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommand.java index e52eb92b0..a504b179a 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommand.java @@ -11,7 +11,6 @@ public class AdminTeamAddCommand extends CompositeCommand { public AdminTeamAddCommand(CompositeCommand parent) { super(parent, "add"); - } @Override @@ -22,7 +21,7 @@ public class AdminTeamAddCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { // If args are not right, show help if (args.size() != 2) { showHelp(this, user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommand.java index 4f93a5eff..4c8bd4ed4 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommand.java @@ -20,7 +20,7 @@ public class AdminTeamDisbandCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { // If args are not right, show help if (args.size() != 1) { showHelp(this, user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommand.java index 2a7b80cd3..040f2c5e6 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommand.java @@ -21,7 +21,7 @@ public class AdminTeamKickCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { // If args are not right, show help if (args.size() != 1) { showHelp(this, user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommand.java b/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommand.java index 43ef899df..77733a10f 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommand.java @@ -20,7 +20,7 @@ public class AdminTeamMakeLeaderCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { // If args are not right, show help if (args.size() != 1) { showHelp(this, user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/CustomIslandMultiHomeHelp.java b/src/main/java/us/tastybento/bskyblock/commands/island/CustomIslandMultiHomeHelp.java index 0eba0c831..2eedd9624 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/CustomIslandMultiHomeHelp.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/CustomIslandMultiHomeHelp.java @@ -30,7 +30,7 @@ public class CustomIslandMultiHomeHelp extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { // This will only be shown if it is for a player if (user.isPlayer()) { // Get elements diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandAboutCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandAboutCommand.java index 13c55c3bc..11267166e 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandAboutCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandAboutCommand.java @@ -22,7 +22,7 @@ public class IslandAboutCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { user.sendRawMessage("About " + BSkyBlock.getInstance().getDescription().getName() + " v" + BSkyBlock.getInstance().getDescription().getVersion() + ":"); user.sendRawMessage("Copyright (c) 2017 - 2018 Tastybento, Poslovitch"); user.sendRawMessage("All rights reserved."); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandBanCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandBanCommand.java index 9defccd68..2618a6c8b 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandBanCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandBanCommand.java @@ -30,7 +30,7 @@ public class IslandBanCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (args.size() != 1) { // Show help showHelp(this, user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommand.java index dbce08c83..42454d315 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommand.java @@ -22,7 +22,7 @@ public class IslandBanlistCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (!args.isEmpty()) { // Show help showHelp(this, user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandCreateCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandCreateCommand.java index 39cc6f66b..e4f58d7d0 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandCreateCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandCreateCommand.java @@ -34,7 +34,7 @@ public class IslandCreateCommand extends CompositeCommand { * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) */ @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (getIslands().hasIsland(getWorld(), user.getUniqueId())) { user.sendMessage("general.errors.already-have-island"); return false; diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandGoCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandGoCommand.java index 81bbaab9a..c71e243b9 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandGoCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandGoCommand.java @@ -33,7 +33,7 @@ public class IslandGoCommand extends CompositeCommand { * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) */ @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (getIslands().getIsland(getWorld(), user.getUniqueId()) == null) { user.sendMessage("general.errors.no-island"); return false; diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandLanguageCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandLanguageCommand.java index e0ca770e1..33ba33aab 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandLanguageCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandLanguageCommand.java @@ -29,7 +29,7 @@ public class IslandLanguageCommand extends CompositeCommand { * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) */ @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { LanguagePanel.openPanel(user); return true; } diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandResetCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandResetCommand.java index 5346e9b96..5badde982 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandResetCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandResetCommand.java @@ -33,7 +33,7 @@ public class IslandResetCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { // Check cooldown if (getSettings().getResetWait() > 0 && onRestartWaitTime(user) > 0 && !user.isOp()) { user.sendMessage("general.errors.you-must-wait", TextVariables.NUMBER, String.valueOf(onRestartWaitTime(user))); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandResetnameCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandResetnameCommand.java index 4988fb5b0..640e62fb3 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandResetnameCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandResetnameCommand.java @@ -27,7 +27,7 @@ public class IslandResetnameCommand extends CompositeCommand { * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) */ @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { UUID playerUUID = user.getUniqueId(); if (!getIslands().hasIsland(getWorld(), playerUUID)) { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSethomeCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandSethomeCommand.java index 3989d1609..31bf8755d 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSethomeCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandSethomeCommand.java @@ -23,7 +23,7 @@ public class IslandSethomeCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { UUID playerUUID = user.getUniqueId(); // Check island if (getPlugin().getIslands().getIsland(getWorld(), user.getUniqueId()) == null) { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSetnameCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandSetnameCommand.java index 03a9f0bd9..af027e522 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSetnameCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandSetnameCommand.java @@ -32,7 +32,7 @@ public class IslandSetnameCommand extends CompositeCommand { * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) */ @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { UUID playerUUID = user.getUniqueId(); if (!getIslands().hasIsland(getWorld(), playerUUID)) { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSettingsCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandSettingsCommand.java index 6cd8f9c75..efb3fc770 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSettingsCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandSettingsCommand.java @@ -31,7 +31,7 @@ public class IslandSettingsCommand extends CompositeCommand { * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) */ @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { // Settings are only shown if you are in the right world if (Util.getWorld(user.getWorld()).equals(getWorld())) { SettingsPanel.openPanel(getPlugin(), user, Flag.Type.PROTECTION, getWorld()); //TODO keep track of history? diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommand.java index e4a3e11af..e77152d2f 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommand.java @@ -26,7 +26,7 @@ public class IslandUnbanCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (args.size() != 1) { // Show help showHelp(this, user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamCommand.java index f679f1020..0eba71c2b 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamCommand.java @@ -33,7 +33,7 @@ public class IslandTeamCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { // Player issuing the command must have an island UUID teamLeaderUUID = getTeamLeader(getWorld(), user); if (teamLeaderUUID == null) { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteAcceptCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteAcceptCommand.java index e49aea46f..b1883a160 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteAcceptCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteAcceptCommand.java @@ -30,7 +30,7 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { UUID playerUUID = user.getUniqueId(); // Check if player has been invited diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommand.java index 906ef3986..5f3840cc8 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommand.java @@ -35,7 +35,7 @@ public class IslandTeamInviteCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { UUID playerUUID = user.getUniqueId(); // Player issuing the command must have an island if (!getIslands().hasIsland(getWorld(), user.getUniqueId())) { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteRejectCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteRejectCommand.java index 034017653..e27fae93b 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteRejectCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteRejectCommand.java @@ -26,7 +26,7 @@ public class IslandTeamInviteRejectCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { UUID playerUUID = user.getUniqueId(); // Reject /island reject if (itc.getInviteCommand().getInviteList().containsKey(playerUUID)) { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommand.java index de43e7848..443c67dd6 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommand.java @@ -28,7 +28,7 @@ public class IslandTeamKickCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (!getIslands().inTeam(getWorld(), user.getUniqueId())) { user.sendMessage("general.errors.no-team"); return false; diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommand.java index 779829cec..e2f5500df 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommand.java @@ -21,7 +21,7 @@ public class IslandTeamLeaveCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (!getIslands().inTeam(getWorld(), user.getUniqueId())) { user.sendMessage("general.errors.no-team"); return false; diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamPromoteCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamPromoteCommand.java index 627f59413..a66eea8e6 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamPromoteCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamPromoteCommand.java @@ -26,7 +26,7 @@ public class IslandTeamPromoteCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { if (!getIslands().inTeam(getWorld(), user.getUniqueId())) { user.sendMessage("general.errors.no-team"); return true; diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamSetownerCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamSetownerCommand.java index 77210c0cc..44b7adfd2 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamSetownerCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamSetownerCommand.java @@ -26,7 +26,7 @@ public class IslandTeamSetownerCommand extends CompositeCommand { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { UUID playerUUID = user.getUniqueId(); // Can use if in a team boolean inTeam = getPlugin().getIslands().inTeam(getWorld(), playerUUID); diff --git a/src/test/java/bskyblock/TestBSkyBlock.java b/src/test/java/bskyblock/TestBSkyBlock.java index 70fd801c5..1b219166a 100644 --- a/src/test/java/bskyblock/TestBSkyBlock.java +++ b/src/test/java/bskyblock/TestBSkyBlock.java @@ -195,7 +195,7 @@ public class TestBSkyBlock { testCommand.setOnlyPlayer(true); testCommand.setPermission("default.permission"); // Test basic execution - assertTrue(testCommand.execute(user, new ArrayList<>())); + assertTrue(testCommand.execute(user, testCommand.getLabel(), new ArrayList<>())); assertEquals("test",testCommand.getLabel()); assertEquals(2, testCommand.getAliases().size()); assertEquals("t", testCommand.getAliases().get(0)); @@ -259,7 +259,7 @@ public class TestBSkyBlock { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { return true; } @@ -284,7 +284,7 @@ public class TestBSkyBlock { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { return true; } @@ -298,7 +298,7 @@ public class TestBSkyBlock { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { return true; } @@ -317,7 +317,7 @@ public class TestBSkyBlock { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { return true; } @@ -339,7 +339,7 @@ public class TestBSkyBlock { public void setup() {} @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { return args.size() == 3; } @@ -362,7 +362,7 @@ public class TestBSkyBlock { public void setup() {} @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { return args.size() == 3; } diff --git a/src/test/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommandTest.java b/src/test/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommandTest.java index ca71f247d..775e1da86 100644 --- a/src/test/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommandTest.java @@ -107,7 +107,7 @@ public class DefaultHelpCommandTest { } @Override - public boolean execute(User user, List args) { + public boolean execute(User user, String label, List args) { return false; } @@ -145,7 +145,7 @@ public class DefaultHelpCommandTest { when(user.getTranslation("parameters")).thenReturn(""); when(user.getTranslation("description")).thenReturn("the main island command"); DefaultHelpCommand dhc = new DefaultHelpCommand(parent); - dhc.execute(user, new ArrayList<>()); + dhc.execute(user, dhc.getLabel(), new ArrayList<>()); Mockito.verify(user).sendMessage("commands.help.header", "[label]", "BSkyBlock"); Mockito.verify(user).getTranslation("island"); Mockito.verify(user).getTranslation("parameters"); @@ -176,7 +176,7 @@ public class DefaultHelpCommandTest { DefaultHelpCommand dhc = new DefaultHelpCommand(parent); List args = new ArrayList<>(); args.add("1"); - dhc.execute(user, args); + dhc.execute(user, dhc.getLabel(), args); // There are no header or footer shown Mockito.verify(user).getTranslation("island"); Mockito.verify(user).getTranslation("parameters"); @@ -209,7 +209,7 @@ public class DefaultHelpCommandTest { List args = new ArrayList<>(); // Test /island help team args.add("team"); - dhc.execute(user, args); + dhc.execute(user, dhc.getLabel(), args); // There are no header or footer shown Mockito.verify(user).getTranslation("island"); Mockito.verify(user).getTranslation("commands.help.parameters"); diff --git a/src/test/java/us/tastybento/bskyblock/commands/AdminCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/AdminCommandTest.java index 4ee6e17e6..4b94165a3 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/AdminCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/AdminCommandTest.java @@ -102,11 +102,11 @@ public class AdminCommandTest { CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); AdminCommand ac = new AdminCommand(); - assertTrue(ac.execute(mock(User.class), new ArrayList<>())); + assertTrue(ac.execute(mock(User.class), ac.getLabel(), new ArrayList<>())); // No such command String[] args2 = {"random", "junk"}; - assertFalse(ac.execute(mock(User.class), Arrays.asList(args2))); + assertFalse(ac.execute(mock(User.class), ac.getLabel(), Arrays.asList(args2))); } } diff --git a/src/test/java/us/tastybento/bskyblock/commands/IslandCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/IslandCommandTest.java index 4459f3453..3c8dd8c4a 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/IslandCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/IslandCommandTest.java @@ -129,7 +129,7 @@ public class IslandCommandTest { when(plugin.getCommandsManager()).thenReturn(cm); // Setup IslandCommand ic = new IslandCommand(); - assertFalse(ic.execute(null, null)); + assertFalse(ic.execute(null, ic.getLabel(), new ArrayList<>())); IslandsManager im = mock(IslandsManager.class); when(plugin.getIslands()).thenReturn(im); User user = mock(User.class); @@ -144,7 +144,7 @@ public class IslandCommandTest { // User has an island - so go there! when(im.getIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(island); - assertTrue(ic.execute(user, new ArrayList<>())); + assertTrue(ic.execute(user, ic.getLabel(), new ArrayList<>())); when(user.getWorld()).thenReturn(world); @@ -153,11 +153,11 @@ public class IslandCommandTest { // No island yet, one will be created when(im.createIsland(Mockito.any(), Mockito.any())).thenReturn(island); when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(false); - assertTrue(ic.execute(user, new ArrayList<>())); + assertTrue(ic.execute(user, ic.getLabel(), new ArrayList<>())); // No such command String[] args2 = {"random", "junk"}; - assertFalse(ic.execute(user, Arrays.asList(args2))); + assertFalse(ic.execute(user, ic.getLabel(), Arrays.asList(args2))); } } diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommandTest.java index 21c808588..6bd3f74dd 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommandTest.java @@ -5,11 +5,7 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Optional; -import java.util.UUID; +import java.util.*; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -126,31 +122,31 @@ public class AdminInfoCommandTest { /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminInfoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminInfoCommand#execute(User, String, List)}. */ @Test public void testExecuteNoTargetConsole() { AdminInfoCommand itl = new AdminInfoCommand(ac); CommandSender sender = mock(CommandSender.class); User console = User.getInstance(sender); - assertFalse(itl.execute(console, new ArrayList<>())); + assertFalse(itl.execute(console, itl.getLabel(), new ArrayList<>())); // Show help } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminInfoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminInfoCommand#execute(User, String, List)} . */ @Test public void testExecuteUnknownPlayer() { AdminInfoCommand itl = new AdminInfoCommand(ac); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(null); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player")); } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminInfoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminInfoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. */ @Test public void testExecutePlayerHasNoIsland() { @@ -159,12 +155,12 @@ public class AdminInfoCommandTest { when(pm.getUUID(Mockito.any())).thenReturn(notUUID); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(false); when(im.inTeam(Mockito.any(), Mockito.any())).thenReturn(false); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.player-has-no-island")); } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminInfoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminInfoCommand#execute(User, String, List)}. */ @Test public void testExecuteSuccess() { @@ -174,12 +170,12 @@ public class AdminInfoCommandTest { when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true); Island is = mock(Island.class); when(im.getIsland(Mockito.any(), Mockito.eq(notUUID))).thenReturn(is); - assertTrue(itl.execute(user, Arrays.asList(name))); + assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(is).showInfo(Mockito.eq(plugin), Mockito.eq(user), Mockito.any()); } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminInfoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminInfoCommand#execute(User, String, List)}. */ @Test public void testExecuteUserNotOnIsland() { @@ -187,13 +183,13 @@ public class AdminInfoCommandTest { AdminInfoCommand itl = new AdminInfoCommand(ac); // No island here when(im.getIslandAt(Mockito.any())).thenReturn(Optional.empty()); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Confirm other verifications Mockito.verify(user).sendMessage("commands.admin.info.no-island"); } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminInfoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminInfoCommand#execute(User, String, List)}. */ @Test public void testExecuteSuccessUserOnIsland() { @@ -210,7 +206,7 @@ public class AdminInfoCommandTest { when(user.getLocation()).thenReturn(loc); - assertTrue(itl.execute(user, new ArrayList<>())); + assertTrue(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Confirm other verifications Mockito.verify(is).showInfo(Mockito.eq(plugin), Mockito.eq(user), Mockito.any()); } diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommandTest.java index 28b3f3f57..8f3a22ead 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommandTest.java @@ -130,7 +130,7 @@ public class AdminRegisterCommandTest { @Test public void testExecuteNoTarget() { AdminRegisterCommand itl = new AdminRegisterCommand(ac); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Show help } @@ -142,7 +142,7 @@ public class AdminRegisterCommandTest { AdminRegisterCommand itl = new AdminRegisterCommand(ac); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(null); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player")); } @@ -156,7 +156,7 @@ public class AdminRegisterCommandTest { when(pm.getUUID(Mockito.any())).thenReturn(notUUID); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true); when(im.inTeam(Mockito.any(), Mockito.any())).thenReturn(false); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.player-has-island")); } @@ -170,7 +170,7 @@ public class AdminRegisterCommandTest { String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); AdminRegisterCommand itl = new AdminRegisterCommand(ac); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.register.cannot-register-team-player"); } @@ -192,7 +192,7 @@ public class AdminRegisterCommandTest { when(im.getIslandAt(Mockito.any())).thenReturn(opi); when(user.getLocation()).thenReturn(loc); AdminRegisterCommand itl = new AdminRegisterCommand(ac); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.register.already-owned"); } @@ -215,7 +215,7 @@ public class AdminRegisterCommandTest { when(pm.getUUID(Mockito.any())).thenReturn(notUUID); AdminRegisterCommand itl = new AdminRegisterCommand(ac); - assertTrue(itl.execute(user, Arrays.asList(name))); + assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); // Add other verifications Mockito.verify(user).sendMessage("commands.admin.register.registered-island", "[xyz]", "123,123,432"); Mockito.verify(user).sendMessage(Mockito.eq("general.success")); diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommandTest.java index 908e48f30..ecdd540b4 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommandTest.java @@ -128,7 +128,7 @@ public class AdminUnregisterCommandTest { @Test public void testExecuteNoTarget() { AdminUnregisterCommand itl = new AdminUnregisterCommand(ac); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Show help } @@ -140,7 +140,7 @@ public class AdminUnregisterCommandTest { AdminUnregisterCommand itl = new AdminUnregisterCommand(ac); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(null); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player")); } @@ -153,7 +153,7 @@ public class AdminUnregisterCommandTest { String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(false); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.player-has-no-island")); } @@ -166,7 +166,7 @@ public class AdminUnregisterCommandTest { String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); AdminUnregisterCommand itl = new AdminUnregisterCommand(ac); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.unregister.cannot-unregister-team-player"); } @@ -185,7 +185,7 @@ public class AdminUnregisterCommandTest { when(pm.getUUID(Mockito.any())).thenReturn(notUUID); AdminUnregisterCommand itl = new AdminUnregisterCommand(ac); - assertTrue(itl.execute(user, Arrays.asList(name))); + assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); // Add other verifications Mockito.verify(user).sendMessage("commands.admin.unregister.unregistered-island", "[xyz]", "123,123,432"); Mockito.verify(user).sendMessage(Mockito.eq("general.success")); diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommandTest.java index 68c95221f..a3a6c7733 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommandTest.java @@ -124,25 +124,25 @@ public class AdminTeamAddCommandTest { /** - * Test method for {@link AdminTeamAddCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @Test public void testExecuteWrongArgs() { AdminTeamAddCommand itl = new AdminTeamAddCommand(ac); List args = new ArrayList<>(); - assertFalse(itl.execute(user, args)); + assertFalse(itl.execute(user, itl.getLabel(), args)); // Show help args.add("arg1"); - assertFalse(itl.execute(user, args)); + assertFalse(itl.execute(user, itl.getLabel(), args)); // Show help args.add("args2"); args.add("args3"); - assertFalse(itl.execute(user, args)); + assertFalse(itl.execute(user, itl.getLabel(), args)); // Show help } /** - * Test method for {@link AdminTeamAddCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @Test public void testExecuteUnknownPlayer() { @@ -152,18 +152,18 @@ public class AdminTeamAddCommandTest { // Unknown leader when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(null); when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, ac.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("general.errors.unknown-player-name", "[name]", "tastybento"); // Unknown target when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid); when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(null); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, ac.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("general.errors.unknown-player-name", "[name]", "poslovich"); } /** - * Test method for {@link AdminTeamAddCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @Test public void testExecuteTargetTargetInTeam() { @@ -175,13 +175,13 @@ public class AdminTeamAddCommandTest { when(im.inTeam(Mockito.any(), Mockito.eq(notUUID))).thenReturn(true); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("commands.island.team.invite.errors.already-on-team")); } /** - * Test method for {@link AdminTeamAddCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @Test public void testExecuteAddNoIsland() { @@ -194,13 +194,13 @@ public class AdminTeamAddCommandTest { // No island, when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(false); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("general.errors.player-has-no-island"); } /** - * Test method for {@link AdminTeamAddCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @Test public void testExecuteAddNotLeader() { @@ -219,13 +219,13 @@ public class AdminTeamAddCommandTest { Island island = mock(Island.class); when(im.getIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(island); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.team.add.name-not-leader", "[name]", "tastybento"); Mockito.verify(island).showMembers(Mockito.eq(plugin), Mockito.any(), Mockito.any()); } /** - * Test method for {@link AdminTeamAddCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @Test public void testExecuteAddTargetHasIsland() { @@ -243,13 +243,13 @@ public class AdminTeamAddCommandTest { // Target has island when(im.hasIsland(Mockito.any(), Mockito.eq(notUUID))).thenReturn(true); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.team.add.name-has-island", "[name]", "poslovich"); } /** - * Test method for {@link AdminTeamAddCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @Test public void testExecuteAddTargetHasIslandNoTeam() { @@ -266,13 +266,13 @@ public class AdminTeamAddCommandTest { // Target has island when(im.hasIsland(Mockito.any(), Mockito.eq(notUUID))).thenReturn(true); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.team.add.name-has-island", "[name]", "poslovich"); } /** - * Test method for {@link us.us.tastybento.bskyblock.commands.admin.teams.AdminTeamAddCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminTeamAddCommand#execute(User, String, List)}. */ @Test public void testExecuteSuccess() { @@ -299,7 +299,7 @@ public class AdminTeamAddCommandTest { when(plugin.getPlayers()).thenReturn(pm); // Success - assertTrue(itl.execute(user, Arrays.asList(name))); + assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(island).addMember(notUUID); Mockito.verify(user).sendMessage(Mockito.eq("general.success")); } diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommandTest.java index 57be5c934..163700642 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommandTest.java @@ -5,12 +5,7 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; +import java.util.*; import org.bukkit.Bukkit; import org.bukkit.World; @@ -123,29 +118,28 @@ public class AdminTeamDisbandCommandTest { /** - * Test method for {@link AdminTeamDisbandCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamDisbandCommand#execute(User, String, List)}. */ @Test public void testExecuteNoTarget() { AdminTeamDisbandCommand itl = new AdminTeamDisbandCommand(ac); - assertFalse(itl.execute(user, new ArrayList<>())); - // Show help + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); } /** - * Test method for {@link AdminTeamDisbandCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamDisbandCommand#execute(User, String, List)}. */ @Test public void testExecuteUnknownPlayer() { AdminTeamDisbandCommand itl = new AdminTeamDisbandCommand(ac); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(null); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player")); } /** - * Test method for {@link AdminTeamDisbandCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamDisbandCommand#execute(User, String, List)}. */ @Test public void testExecutePlayerNotInTeam() { @@ -153,12 +147,12 @@ public class AdminTeamDisbandCommandTest { String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); when(im.getMembers(Mockito.any(), Mockito.any())).thenReturn(new HashSet<>()); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.not-in-team")); } /** - * Test method for {@link AdminTeamDisbandCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamDisbandCommand#execute(User, String, List)}. */ @Test public void testExecuteDisbandNotLeader() { @@ -172,12 +166,12 @@ public class AdminTeamDisbandCommandTest { when(pm.getName(Mockito.any())).thenReturn("leader"); AdminTeamDisbandCommand itl = new AdminTeamDisbandCommand(ac); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.team.disband.use-disband-leader", "[leader]", "leader"); } /** - * Test method for {@link us.us.tastybento.bskyblock.commands.admin.teams.AdminTeamDisbandCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminTeamDisbandCommand#execute(User, String, List)}. */ @Test public void testExecuteSuccess() { @@ -195,7 +189,7 @@ public class AdminTeamDisbandCommandTest { when(im.getMembers(Mockito.any(), Mockito.any())).thenReturn(members); AdminTeamDisbandCommand itl = new AdminTeamDisbandCommand(ac); - assertTrue(itl.execute(user, Arrays.asList(name))); + assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(im, Mockito.never()).setLeaveTeam(Mockito.any(), Mockito.eq(notUUID)); Mockito.verify(im).setLeaveTeam(Mockito.any(), Mockito.eq(uuid)); Mockito.verify(user).sendMessage(Mockito.eq("general.success")); diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommandTest.java index 9a77ca781..bea3bfa3f 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommandTest.java @@ -8,11 +8,7 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.UUID; +import java.util.*; import org.bukkit.Bukkit; import org.bukkit.World; @@ -126,29 +122,29 @@ public class AdminTeamKickCommandTest { /** - * Test method for {@link AdminTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamKickCommand#execute(User, String, List)}. */ @Test public void testExecuteNoTarget() { AdminTeamKickCommand itl = new AdminTeamKickCommand(ac); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Show help } /** - * Test method for {@link AdminTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamKickCommand#execute(User, String, List)}. */ @Test public void testExecuteUnknownPlayer() { AdminTeamKickCommand itl = new AdminTeamKickCommand(ac); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(null); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player")); } /** - * Test method for {@link AdminTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamKickCommand#execute(User, String, List)}. */ @Test public void testExecutePlayerNotInTeam() { @@ -156,12 +152,12 @@ public class AdminTeamKickCommandTest { String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); when(im.getMembers(Mockito.any(), Mockito.any())).thenReturn(new HashSet<>()); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.not-in-team")); } /** - * Test method for {@link AdminTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamKickCommand#execute(User, String, List)} . */ @Test public void testExecuteKickLeader() { @@ -174,13 +170,13 @@ public class AdminTeamKickCommandTest { when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(notUUID); AdminTeamKickCommand itl = new AdminTeamKickCommand(ac); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("commands.admin.team.kick.cannot-kick-leader")); Mockito.verify(is).showMembers(Mockito.any(), Mockito.any(), Mockito.any()); } /** - * Test method for {@link us.us.tastybento.bskyblock.commands.admin.teams.AdminTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminTeamKickCommand#execute(User, String, List)}. */ @Test public void testExecute() { @@ -193,7 +189,7 @@ public class AdminTeamKickCommandTest { when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid); AdminTeamKickCommand itl = new AdminTeamKickCommand(ac); - assertTrue(itl.execute(user, Arrays.asList(name))); + assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(im).removePlayer(Mockito.any(), Mockito.eq(notUUID)); Mockito.verify(user).sendMessage(Mockito.eq("general.success")); } diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommandTest.java index 3cc6c7ff9..3eb174408 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommandTest.java @@ -5,12 +5,7 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; +import java.util.*; import org.bukkit.Bukkit; import org.bukkit.World; @@ -123,29 +118,29 @@ public class AdminTeamMakeLeaderCommandTest { /** - * Test method for {@link AdminTeamMakeLeaderCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamMakeLeaderCommand#execute(User, String, List)}. */ @Test public void testExecuteNoTarget() { AdminTeamMakeLeaderCommand itl = new AdminTeamMakeLeaderCommand(ac); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Show help } /** - * Test method for {@link AdminTeamMakeLeaderCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamMakeLeaderCommand#execute(User, String, List)}. */ @Test public void testExecuteUnknownPlayer() { AdminTeamMakeLeaderCommand itl = new AdminTeamMakeLeaderCommand(ac); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(null); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player")); } /** - * Test method for {@link AdminTeamMakeLeaderCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamMakeLeaderCommand#execute(User, String, List)}. */ @Test public void testExecutePlayerNotInTeam() { @@ -153,12 +148,12 @@ public class AdminTeamMakeLeaderCommandTest { String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); when(im.getMembers(Mockito.any(), Mockito.any())).thenReturn(new HashSet<>()); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.not-in-team")); } /** - * Test method for {@link AdminTeamMakeLeaderCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link AdminTeamMakeLeaderCommand#execute(User, String, List)}. */ @Test public void testExecuteMakeLeaderAlreadyLeader() { @@ -171,12 +166,12 @@ public class AdminTeamMakeLeaderCommandTest { when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(notUUID); AdminTeamMakeLeaderCommand itl = new AdminTeamMakeLeaderCommand(ac); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.team.makeleader.already-leader"); } /** - * Test method for {@link us.us.tastybento.bskyblock.commands.admin.teams.AdminTeamMakeLeaderCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminTeamMakeLeaderCommand#execute(User, String, List)}. */ @Test public void testExecuteSuccess() { @@ -195,7 +190,7 @@ public class AdminTeamMakeLeaderCommandTest { when(im.getMembers(Mockito.any(), Mockito.any())).thenReturn(members); AdminTeamMakeLeaderCommand itl = new AdminTeamMakeLeaderCommand(ac); - assertTrue(itl.execute(user, Arrays.asList(name))); + assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); // Add other verifications Mockito.verify(im).makeLeader(Mockito.any(), Mockito.eq(user), Mockito.eq(notUUID), Mockito.any()); Mockito.verify(user).sendMessage(Mockito.eq("general.success")); diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/IslandBanCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/island/IslandBanCommandTest.java index 65e879ea9..dd53d4133 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/IslandBanCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/island/IslandBanCommandTest.java @@ -123,7 +123,7 @@ public class IslandBanCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.island.IslandBanCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.tastybento.bskyblock.commands.island.IslandBanCommand#execute(User, String, List)}. */ // Island ban command by itself @@ -143,13 +143,13 @@ public class IslandBanCommandTest { @Test public void testNoArgs() { IslandBanCommand ibc = new IslandBanCommand(ic); - assertFalse(ibc.execute(user, new ArrayList<>())); + assertFalse(ibc.execute(user, ibc.getLabel(), new ArrayList<>())); } @Test public void testNoIsland() { IslandBanCommand ibc = new IslandBanCommand(ic); - assertFalse(ibc.execute(user, Arrays.asList("bill"))); + assertFalse(ibc.execute(user, ibc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("general.errors.no-island"); } @@ -157,7 +157,7 @@ public class IslandBanCommandTest { public void testNotOwner() { IslandBanCommand ibc = new IslandBanCommand(ic); when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); - assertFalse(ibc.execute(user, Arrays.asList("bill"))); + assertFalse(ibc.execute(user, ibc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("general.errors.not-leader"); } @@ -167,7 +167,7 @@ public class IslandBanCommandTest { when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); when(pm.getUUID(Mockito.anyString())).thenReturn(null); - assertFalse(ibc.execute(user, Arrays.asList("bill"))); + assertFalse(ibc.execute(user, ibc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("general.errors.unknown-player"); } @@ -177,7 +177,7 @@ public class IslandBanCommandTest { when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); when(pm.getUUID(Mockito.anyString())).thenReturn(uuid); - assertFalse(ibc.execute(user, Arrays.asList("bill"))); + assertFalse(ibc.execute(user, ibc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("commands.island.ban.cannot-ban-yourself"); } @@ -192,7 +192,7 @@ public class IslandBanCommandTest { members.add(uuid); members.add(teamMate); when(im.getMembers(Mockito.any(), Mockito.any())).thenReturn(members); - assertFalse(ibc.execute(user, Arrays.asList("bill"))); + assertFalse(ibc.execute(user, ibc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("commands.island.ban.cannot-ban-member"); } @@ -204,7 +204,7 @@ public class IslandBanCommandTest { UUID bannedUser = UUID.randomUUID(); when(pm.getUUID(Mockito.anyString())).thenReturn(bannedUser); when(island.isBanned(Mockito.eq(bannedUser))).thenReturn(true); - assertFalse(ibc.execute(user, Arrays.asList("bill"))); + assertFalse(ibc.execute(user, ibc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("commands.island.ban.player-already-banned"); } @@ -220,7 +220,7 @@ public class IslandBanCommandTest { when(opUser.isOp()).thenReturn(true); when(opUser.isPlayer()).thenReturn(true); when(User.getInstance(Mockito.any(UUID.class))).thenReturn(opUser); - assertFalse(ibc.execute(user, Arrays.asList("bill"))); + assertFalse(ibc.execute(user, ibc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("commands.island.ban.cannot-ban"); } @@ -241,7 +241,7 @@ public class IslandBanCommandTest { // Allow adding to ban list when(island.addToBanList(Mockito.any())).thenReturn(true); - assertTrue(ibc.execute(user, Arrays.asList("bill"))); + assertTrue(ibc.execute(user, ibc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("general.success"); Mockito.verify(targetUser).sendMessage("commands.island.ban.owner-banned-you", TextVariables.NAME, user.getName()); } @@ -262,7 +262,7 @@ public class IslandBanCommandTest { // Allow adding to ban list when(island.addToBanList(Mockito.any())).thenReturn(true); - assertTrue(ibc.execute(user, Arrays.asList("bill"))); + assertTrue(ibc.execute(user, ibc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("general.success"); Mockito.verify(targetUser).sendMessage("commands.island.ban.owner-banned-you", TextVariables.NAME, user.getName()); } @@ -283,7 +283,7 @@ public class IslandBanCommandTest { // Disallow adding to ban list - even cancelled when(island.addToBanList(Mockito.any())).thenReturn(false); - assertFalse(ibc.execute(user, Arrays.asList("bill"))); + assertFalse(ibc.execute(user, ibc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user, Mockito.never()).sendMessage("general.success"); Mockito.verify(targetUser, Mockito.never()).sendMessage("commands.island.ban.owner-banned-you", "[owner]", user.getName()); } diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommandTest.java index 891e66f40..5ffa26aa4 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommandTest.java @@ -124,14 +124,14 @@ public class IslandBanlistCommandTest { @Test public void testWithArgs() { IslandBanlistCommand iubc = new IslandBanlistCommand(ic); - assertFalse(iubc.execute(user, Arrays.asList("bill"))); + assertFalse(iubc.execute(user, iubc.getLabel(), Arrays.asList("bill"))); // Verify show help } @Test public void testNoIsland() { IslandBanlistCommand iubc = new IslandBanlistCommand(ic); - assertFalse(iubc.execute(user, new ArrayList<>())); + assertFalse(iubc.execute(user, iubc.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage("general.errors.no-island"); } @@ -139,7 +139,7 @@ public class IslandBanlistCommandTest { public void testBanlistNooneBanned() { IslandBanlistCommand iubc = new IslandBanlistCommand(ic); when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); - assertTrue(iubc.execute(user, new ArrayList<>())); + assertTrue(iubc.execute(user, iubc.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage("commands.island.banlist.noone"); } @@ -166,7 +166,7 @@ public class IslandBanlistCommandTest { } }); - assertTrue(iubc.execute(user, new ArrayList<>())); + assertTrue(iubc.execute(user, iubc.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage("commands.island.banlist.the-following"); } diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/IslandGoCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/island/IslandGoCommandTest.java index 9aabd8fa8..b8867edc2 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/IslandGoCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/island/IslandGoCommandTest.java @@ -129,7 +129,7 @@ public class IslandGoCommandTest { public void testExecuteNoArgsNoIsland() { when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(null); IslandGoCommand igc = new IslandGoCommand(ic); - assertFalse(igc.execute(user, new ArrayList<>())); + assertFalse(igc.execute(user, igc.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage("general.errors.no-island"); } @@ -141,7 +141,7 @@ public class IslandGoCommandTest { public void testExecuteNoArgs() { when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(island); IslandGoCommand igc = new IslandGoCommand(ic); - assertTrue(igc.execute(user, new ArrayList<>())); + assertTrue(igc.execute(user, igc.getLabel(), new ArrayList<>())); } /** @@ -152,7 +152,7 @@ public class IslandGoCommandTest { when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(island); when(Util.getPermValue(Mockito.any(Player.class), Mockito.anyString(), Mockito.anyInt())).thenReturn(3); IslandGoCommand igc = new IslandGoCommand(ic); - assertTrue(igc.execute(user, new ArrayList<>())); + assertTrue(igc.execute(user, igc.getLabel(), new ArrayList<>())); } /** @@ -165,7 +165,7 @@ public class IslandGoCommandTest { IslandGoCommand igc = new IslandGoCommand(ic); List args = new ArrayList<>(); args.add("1"); - assertTrue(igc.execute(user, args)); + assertTrue(igc.execute(user, igc.getLabel(), args)); } /** @@ -178,7 +178,7 @@ public class IslandGoCommandTest { IslandGoCommand igc = new IslandGoCommand(ic); List args = new ArrayList<>(); args.add("2"); - assertTrue(igc.execute(user, args)); + assertTrue(igc.execute(user, igc.getLabel(), args)); Mockito.verify(user).sendMessage("commands.island.go.tip", TextVariables.LABEL, "island"); } @@ -193,6 +193,6 @@ public class IslandGoCommandTest { IslandGoCommand igc = new IslandGoCommand(ic); List args = new ArrayList<>(); args.add("sdfsdf"); - assertTrue(igc.execute(user, args)); + assertTrue(igc.execute(user, igc.getLabel(), args)); } } diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/IslandResetCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/island/IslandResetCommandTest.java index 135dd8d9b..11c83d14b 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/IslandResetCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/island/IslandResetCommandTest.java @@ -123,7 +123,7 @@ public class IslandResetCommandTest { IslandResetCommand irc = new IslandResetCommand(ic); // Test the reset command // Does not have island - assertFalse(irc.execute(user, new ArrayList<>())); + assertFalse(irc.execute(user, irc.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage("general.errors.no-island"); } @@ -132,7 +132,7 @@ public class IslandResetCommandTest { IslandResetCommand irc = new IslandResetCommand(ic); // Now has island, but is not the leader when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); - assertFalse(irc.execute(user, new ArrayList<>())); + assertFalse(irc.execute(user, irc.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage("general.errors.not-leader"); } @@ -143,7 +143,7 @@ public class IslandResetCommandTest { when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); // Now is owner, but still has team when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); - assertFalse(irc.execute(user, new ArrayList<>())); + assertFalse(irc.execute(user, irc.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage("commands.island.reset.must-remove-members"); } @@ -160,7 +160,7 @@ public class IslandResetCommandTest { // Block based on no resets left when(pm.getResetsLeft(Mockito.eq(uuid))).thenReturn(0); - assertFalse(irc.execute(user, new ArrayList<>())); + assertFalse(irc.execute(user, irc.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage("commands.island.reset.none-left"); } @@ -192,7 +192,7 @@ public class IslandResetCommandTest { when(NewIsland.builder()).thenReturn(builder); // Reset command, no confirmation required - assertTrue(irc.execute(user, new ArrayList<>())); + assertTrue(irc.execute(user, irc.getLabel(), new ArrayList<>())); // Verify that build new island was called and the number of resets left shown Mockito.verify(builder).build(); Mockito.verify(user).sendMessage("commands.island.reset.resets-left", "[number]", "1"); @@ -228,7 +228,7 @@ public class IslandResetCommandTest { when(s.getResetLimit()).thenReturn(-1); // Reset - assertTrue(irc.execute(user, new ArrayList<>())); + assertTrue(irc.execute(user, irc.getLabel(), new ArrayList<>())); // Verify that build new island was called and the number of resets left shown Mockito.verify(builder).build(); // This should not be shown @@ -267,12 +267,12 @@ public class IslandResetCommandTest { when(s.getConfirmationTime()).thenReturn(20); // Reset - assertTrue(irc.execute(user, new ArrayList<>())); + assertTrue(irc.execute(user, irc.getLabel(), new ArrayList<>())); // Check for message Mockito.verify(user).sendMessage("general.confirm", "[seconds]", String.valueOf(s.getConfirmationTime())); // Send command again to confirm - assertTrue(irc.execute(user, new ArrayList<>())); + assertTrue(irc.execute(user, irc.getLabel(), new ArrayList<>())); } @@ -307,7 +307,7 @@ public class IslandResetCommandTest { when(s.isResetConfirmation()).thenReturn(false); // Reset - assertFalse(irc.execute(user, new ArrayList<>())); + assertFalse(irc.execute(user, irc.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage("commands.island.create.unable-create-island"); diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommandTest.java index 8ba79ffc6..d4064d554 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommandTest.java @@ -135,13 +135,13 @@ public class IslandUnbanCommandTest { @Test public void testNoArgs() { IslandUnbanCommand iubc = new IslandUnbanCommand(ic); - assertFalse(iubc.execute(user, new ArrayList<>())); + assertFalse(iubc.execute(user, iubc.getLabel(), new ArrayList<>())); } @Test public void testNoIsland() { IslandUnbanCommand iubc = new IslandUnbanCommand(ic); - assertFalse(iubc.execute(user, Arrays.asList("bill"))); + assertFalse(iubc.execute(user, iubc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("general.errors.no-island"); } @@ -149,7 +149,7 @@ public class IslandUnbanCommandTest { public void testNotOwner() { IslandUnbanCommand iubc = new IslandUnbanCommand(ic); when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); - assertFalse(iubc.execute(user, Arrays.asList("bill"))); + assertFalse(iubc.execute(user, iubc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("general.errors.not-leader"); } @@ -159,7 +159,7 @@ public class IslandUnbanCommandTest { when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); when(pm.getUUID(Mockito.anyString())).thenReturn(null); - assertFalse(iubc.execute(user, Arrays.asList("bill"))); + assertFalse(iubc.execute(user, iubc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("general.errors.unknown-player"); } @@ -169,7 +169,7 @@ public class IslandUnbanCommandTest { when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); when(pm.getUUID(Mockito.anyString())).thenReturn(uuid); - assertFalse(iubc.execute(user, Arrays.asList("bill"))); + assertFalse(iubc.execute(user, iubc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("commands.island.unban.cannot-unban-yourself"); } @@ -181,7 +181,7 @@ public class IslandUnbanCommandTest { UUID bannedUser = UUID.randomUUID(); when(pm.getUUID(Mockito.anyString())).thenReturn(bannedUser); when(island.isBanned(Mockito.eq(bannedUser))).thenReturn(false); - assertFalse(iubc.execute(user, Arrays.asList("bill"))); + assertFalse(iubc.execute(user, iubc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("commands.island.unban.player-not-banned"); } @@ -204,7 +204,7 @@ public class IslandUnbanCommandTest { // Allow removing from ban list when(island.removeFromBanList(Mockito.any())).thenReturn(true); - assertTrue(iubc.execute(user, Arrays.asList("bill"))); + assertTrue(iubc.execute(user, iubc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("general.success"); Mockito.verify(targetUser).sendMessage("commands.island.unban.you-are-unbanned", TextVariables.NAME, user.getName()); } @@ -228,7 +228,7 @@ public class IslandUnbanCommandTest { // Allow removing from ban list when(island.removeFromBanList(Mockito.any())).thenReturn(false); - assertFalse(iubc.execute(user, Arrays.asList("bill"))); + assertFalse(iubc.execute(user, iubc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user, Mockito.never()).sendMessage("general.success"); Mockito.verify(targetUser, Mockito.never()).sendMessage("commands.island.unban.you-are-unbanned", "[owner]", user.getName()); } diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommandTest.java index 0095d82c1..bba1e7eff 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommandTest.java @@ -125,7 +125,7 @@ public class IslandTeamInviteCommandTest { public void testExecuteNoIsland() { when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(false); IslandTeamInviteCommand itl = new IslandTeamInviteCommand(ic); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.no-island")); } @@ -136,7 +136,7 @@ public class IslandTeamInviteCommandTest { public void testExecuteNotTeamLeader() { when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(notUUID); IslandTeamInviteCommand itl = new IslandTeamInviteCommand(ic); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.not-leader")); } @@ -146,7 +146,7 @@ public class IslandTeamInviteCommandTest { @Test public void testExecuteNoTarget() { IslandTeamInviteCommand itl = new IslandTeamInviteCommand(ic); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Show help } @@ -158,7 +158,7 @@ public class IslandTeamInviteCommandTest { IslandTeamInviteCommand itl = new IslandTeamInviteCommand(ic); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(null); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player")); } @@ -174,7 +174,7 @@ public class IslandTeamInviteCommandTest { IslandTeamInviteCommand itl = new IslandTeamInviteCommand(ic); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(uuid); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.offline-player")); } @@ -189,7 +189,7 @@ public class IslandTeamInviteCommandTest { IslandTeamInviteCommand itl = new IslandTeamInviteCommand(ic); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(uuid); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("commands.island.team.invite.cannot-invite-self")); } @@ -206,7 +206,7 @@ public class IslandTeamInviteCommandTest { String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); when(im.inTeam(Mockito.any(), Mockito.any())).thenReturn(true); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("commands.island.team.invite.already-on-team")); } diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommandTest.java index 427a3469f..c47da8458 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommandTest.java @@ -131,7 +131,7 @@ public class IslandTeamKickCommandTest { public void testExecuteNoTeam() { when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(false); IslandTeamKickCommand itl = new IslandTeamKickCommand(ic); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.no-team")); } @@ -142,7 +142,7 @@ public class IslandTeamKickCommandTest { public void testExecuteNotTeamLeader() { when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(notUUID); IslandTeamKickCommand itl = new IslandTeamKickCommand(ic); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.not-leader")); } @@ -152,7 +152,7 @@ public class IslandTeamKickCommandTest { @Test public void testExecuteNoTarget() { IslandTeamKickCommand itl = new IslandTeamKickCommand(ic); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Show help } @@ -164,7 +164,7 @@ public class IslandTeamKickCommandTest { IslandTeamKickCommand itl = new IslandTeamKickCommand(ic); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(null); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player")); } @@ -176,7 +176,7 @@ public class IslandTeamKickCommandTest { IslandTeamKickCommand itl = new IslandTeamKickCommand(ic); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(uuid); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("commands.island.kick.cannot-kick")); } @@ -190,7 +190,7 @@ public class IslandTeamKickCommandTest { String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); when(im.getMembers(Mockito.any(), Mockito.any())).thenReturn(new HashSet<>()); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.not-in-team")); } @@ -209,7 +209,7 @@ public class IslandTeamKickCommandTest { when(im.getMembers(Mockito.any(), Mockito.any())).thenReturn(members); IslandTeamKickCommand itl = new IslandTeamKickCommand(ic); - assertTrue(itl.execute(user, Arrays.asList(name))); + assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(im).removePlayer(Mockito.any(), Mockito.eq(notUUID)); Mockito.verify(user).sendMessage(Mockito.eq("general.success")); } @@ -229,7 +229,7 @@ public class IslandTeamKickCommandTest { when(im.getMembers(Mockito.any(), Mockito.any())).thenReturn(members); IslandTeamKickCommand itl = new IslandTeamKickCommand(ic); - assertFalse(itl.execute(user, Arrays.asList(name))); + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); // Confirmation required Mockito.verify(user).sendMessage(Mockito.eq("commands.island.team.kick.type-again")); } @@ -258,7 +258,7 @@ public class IslandTeamKickCommandTest { when(iwm.isOnLeaveResetMoney(Mockito.any())).thenReturn(true); IslandTeamKickCommand itl = new IslandTeamKickCommand(ic); - assertTrue(itl.execute(user, Arrays.asList(name))); + assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(im).removePlayer(Mockito.any(), Mockito.eq(notUUID)); Mockito.verify(user).sendMessage(Mockito.eq("general.success")); diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommandTest.java index a087c4d93..b5df3c960 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommandTest.java +++ b/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommandTest.java @@ -112,7 +112,7 @@ public class IslandTeamLeaveCommandTest { public void testExecuteNoTeam() { when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(false); IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.no-team")); } @@ -122,7 +122,7 @@ public class IslandTeamLeaveCommandTest { @Test public void testExecuteInTeamLeader() { IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage(Mockito.eq("commands.island.team.leave.cannot-leave")); } @@ -138,7 +138,7 @@ public class IslandTeamLeaveCommandTest { when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(null); IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic); - assertTrue(itl.execute(user, new ArrayList<>())); + assertTrue(itl.execute(user, itl.getLabel(), new ArrayList<>())); Mockito.verify(im).setLeaveTeam(Mockito.any(), Mockito.eq(uuid)); Mockito.verify(user).sendMessage(Mockito.eq("general.success")); } @@ -157,7 +157,7 @@ public class IslandTeamLeaveCommandTest { when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(null); IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic); - assertFalse(itl.execute(user, new ArrayList<>())); + assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Confirmation required Mockito.verify(user).sendMessage(Mockito.eq("general.confirm"), Mockito.eq("[seconds]"), Mockito.eq("0")); } @@ -183,7 +183,7 @@ public class IslandTeamLeaveCommandTest { when(iwm.isOnLeaveResetMoney(Mockito.any())).thenReturn(true); IslandTeamLeaveCommand itl = new IslandTeamLeaveCommand(ic); - assertTrue(itl.execute(user, new ArrayList<>())); + assertTrue(itl.execute(user, itl.getLabel(), new ArrayList<>())); Mockito.verify(im).setLeaveTeam(Mockito.any(), Mockito.eq(uuid)); Mockito.verify(user).sendMessage(Mockito.eq("general.success"));