Removed constants that reference the island and admin commands.

Fixed bug where addon onLoad was being called twice.
This commit is contained in:
tastybento 2018-05-26 18:20:02 -07:00
parent a5a75c6854
commit 66d9ef857d
25 changed files with 170 additions and 71 deletions

View File

@ -43,7 +43,7 @@ general:
commands:
help:
header: "&7=========== &c%bsb_plugin_name% &7==========="
header: "&7=========== &c[label] help &7==========="
syntax: "&b[usage] &a[parameters]&7: &e[description]"
end: "&7================================="
parameters: "[command]"
@ -122,12 +122,13 @@ commands:
rank-set: "&aRank set from [from] to [to]."
island:
about:
description: "display info about %bsb_plugin_name%"
description: "display copyright and license info"
go:
parameters: "<home number>"
description: "teleport you to your island"
teleport: "&aTeleporting you to your island. &b/[label] help &afor help."
teleport: "&aTeleporting you to your island."
teleported: "&aTeleported you to home &e#[number]."
tip: "&bType /[label] help &afor help."
help:
description: "The main island command"
pick-world: "&cSpecify world from [worlds]"

View File

@ -12,13 +12,6 @@ public class Constants {
}
public static final GameType GAMETYPE = GameType.BSKYBLOCK;
// Permission prefix
public static final String PERMPREFIX = "bskyblock.";
// The island command
public static final String ISLANDCOMMAND = "island";
// The spawn command (Essentials spawn for example)
public static final String SPAWNCOMMAND = "spawn";
// Admin command
public static final String ADMINCOMMAND = "bsadmin";
}

View File

@ -19,6 +19,7 @@ import org.bukkit.entity.Player;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.Settings;
import us.tastybento.bskyblock.api.addons.Addon;
import us.tastybento.bskyblock.api.events.command.CommandEvent;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.managers.IslandWorldManager;
@ -80,6 +81,16 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
*/
private World world;
/**
* The addon creating this command, if any
*/
private Addon addon;
/**
* The top level label
*/
private String topLabel = "";
/**
* Used only for testing....
*/
@ -98,6 +109,33 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
}
}
/**
* Top level command
* @param addon - addon creating the command
* @param label - string for this command
* @param aliases - aliases
*/
public CompositeCommand(Addon addon, String label, String... aliases) {
super(label);
this.topLabel = label;
this.addon = addon;
this.plugin = BSkyBlock.getInstance();
setAliases(new ArrayList<>(Arrays.asList(aliases)));
parent = null;
setUsage("");
subCommandLevel = 0; // Top level
subCommands = new LinkedHashMap<>();
subCommandAliases = new LinkedHashMap<>();
// Register command if it is not already registered
if (plugin.getCommand(label) == null) {
plugin.getCommandsManager().registerCommand(this);
}
setup();
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
new DefaultHelpCommand(this);
}
}
/**
* This is the top-level command constructor for commands that have no parent.
* @param label - string for this command
@ -105,6 +143,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
*/
public CompositeCommand(String label, String... aliases) {
super(label);
this.topLabel = label;
this.plugin = BSkyBlock.getInstance();
setAliases(new ArrayList<>(Arrays.asList(aliases)));
parent = null;
@ -130,6 +169,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
*/
public CompositeCommand(CompositeCommand parent, String label, String... aliases) {
super(label);
this.topLabel = parent.getTopLabel();
this.plugin = BSkyBlock.getInstance();
this.parent = parent;
subCommandLevel = parent.getLevel() + 1;
@ -143,17 +183,17 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
parent.getSubCommandAliases().put(alias, this);
}
setUsage("");
// Inherit permission prefix
this.permissionPrefix = parent.getPermissionPrefix();
// Inherit world
this.world = parent.getWorld();
setup();
// If this command does not define its own help class, then use the default help command
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
new DefaultHelpCommand(this);
}
// Inherit permission prefix
this.permissionPrefix = parent.getPermissionPrefix();
// Inherit world
this.world = parent.getWorld();
}
}
/*
* This method deals with the command execution. It traverses the tree of
* subcommands until it finds the right object and then runs execute on it.
@ -505,4 +545,17 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
this.world = world;
}
/**
* @return the addon
*/
public Addon getAddon() {
return addon;
}
/**
* @return top level label, e.g., island
*/
public String getTopLabel() {
return topLabel;
}
}

View File

@ -51,7 +51,7 @@ public class DefaultHelpCommand extends CompositeCommand {
}
}
if (depth == 0) {
user.sendMessage("commands.help.header");
user.sendMessage("commands.help.header", "[label]", getIWM().getFriendlyName(getWorld()));
}
if (depth < MAX_DEPTH) {
if (!parent.getLabel().equals(HELP)) {

View File

@ -2,7 +2,6 @@ package us.tastybento.bskyblock.commands;
import java.util.List;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.admin.AdminGetRankCommand;
@ -20,7 +19,16 @@ import us.tastybento.bskyblock.commands.admin.teams.AdminTeamMakeLeaderCommand;
public class AdminCommand extends CompositeCommand {
public AdminCommand() {
super(Constants.ADMINCOMMAND, "bsb");
super("bsbadmin", "bsb");
}
@Override
public void setup() {
setPermissionPrefix("bskyblock");
setPermission("admin.*");
setOnlyPlayer(false);
setParameters("commands.admin.help.parameters");
setDescription("commands.admin.help.description");
setWorld(getPlugin().getIWM().getIslandWorld());
new AdminVersionCommand(this);
new AdminReloadCommand(this);
@ -39,19 +47,10 @@ public class AdminCommand extends CompositeCommand {
new AdminSchemCommand(this);
}
@Override
public void setup() {
setPermissionPrefix("bskyblock");
setPermission("admin.*");
setOnlyPlayer(false);
setParameters("commands.admin.help.parameters");
setDescription("commands.admin.help.description");
}
@Override
public boolean execute(User user, List<String> args) {
if (!args.isEmpty()) {
user.sendMessage("general.errors.unknown-command", "[label]", Constants.ADMINCOMMAND);
user.sendMessage("general.errors.unknown-command", "[label]", getTopLabel());
return false;
}
// By default run the attached help command, if it exists (it should)

View File

@ -5,7 +5,6 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.island.IslandAboutCommand;
@ -26,7 +25,19 @@ import us.tastybento.bskyblock.util.Util;
public class IslandCommand extends CompositeCommand {
public IslandCommand() {
super(Constants.ISLANDCOMMAND, "is");
super("island", "is");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.CompositeCommand#setup()
*/
@Override
public void setup() {
setDescription("commands.island.help.description");
setOnlyPlayer(true);
// Permission
setPermissionPrefix("bskyblock");
setPermission("island");
setWorld(getPlugin().getIWM().getIslandWorld());
// Set up subcommands
new IslandAboutCommand(this);
@ -45,18 +56,6 @@ public class IslandCommand extends CompositeCommand {
new IslandTeamCommand(this);
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.CompositeCommand#setup()
*/
@Override
public void setup() {
setDescription("commands.island.help.description");
setOnlyPlayer(true);
// Permission
setPermissionPrefix("bskyblock");
setPermission("island");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[])
*/
@ -74,7 +73,7 @@ public class IslandCommand extends CompositeCommand {
// No islands currently
return getSubCommand("create").map(createCmd -> createCmd.execute(user, new ArrayList<>())).orElse(false);
}
user.sendMessage("general.errors.unknown-command", "[label]", Constants.ISLANDCOMMAND);
user.sendMessage("general.errors.unknown-command", "[label]", getTopLabel());
return false;
}

View File

@ -5,7 +5,6 @@ import java.util.UUID;
import org.bukkit.World;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
@ -64,7 +63,7 @@ public class AdminTeamAddCommand extends CompositeCommand {
User target = User.getInstance(targetUUID);
User leader = User.getInstance(leaderUUID);
leader.sendMessage("commands.island.team.invite.accept.name-joined-your-island", "[name]", getPlugin().getPlayers().getName(targetUUID));
target.sendMessage("commands.island.team.invite.accept.you-joined-island", "[label]", Constants.ISLANDCOMMAND);
target.sendMessage("commands.island.team.invite.accept.you-joined-island", "[label]", getTopLabel());
getIslands().getIsland(world, leaderUUID).addMember(targetUUID);
user.sendMessage("general.success");
return true;

View File

@ -19,7 +19,6 @@ public class IslandGoCommand extends CompositeCommand {
public IslandGoCommand(CompositeCommand islandCommand) {
super(islandCommand, "go", "home", "h");
new CustomIslandMultiHomeHelp(this);
}
/* (non-Javadoc)
@ -30,6 +29,7 @@ public class IslandGoCommand extends CompositeCommand {
setPermission("island.home");
setOnlyPlayer(true);
setDescription("commands.island.go.description");
new CustomIslandMultiHomeHelp(this);
}
/* (non-Javadoc)
@ -47,6 +47,7 @@ public class IslandGoCommand extends CompositeCommand {
int maxHomes = Util.getPermValue(user.getPlayer(), "island.maxhomes", getSettings().getMaxHomes());
if (homeValue > 1 && homeValue <= maxHomes) {
getIslands().homeTeleport(getWorld(), user.getPlayer(), homeValue);
user.sendMessage("commands.island.go.tip", "[label]", getTopLabel());
return true;
}
}

View File

@ -10,7 +10,6 @@ import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
import us.tastybento.bskyblock.api.user.User;
@ -81,13 +80,13 @@ public class IslandResetCommand extends CompositeCommand {
} else {
// Show how many seconds left to confirm
int time = (int)((confirm.get(user.getUniqueId()) - System.currentTimeMillis()) / 1000D);
user.sendMessage("commands.island.reset.confirm", "[label]", Constants.ISLANDCOMMAND, SECONDS_PLACEHOLDER, String.valueOf(time));
user.sendMessage("commands.island.reset.confirm", "[label]", getTopLabel(), SECONDS_PLACEHOLDER, String.valueOf(time));
}
return true;
}
private void requestConfirmation(User user) {
user.sendMessage("commands.island.reset.confirm", "[label]", Constants.ISLANDCOMMAND, SECONDS_PLACEHOLDER, String.valueOf(getSettings().getConfirmationTime()));
user.sendMessage("commands.island.reset.confirm", "[label]", getTopLabel(), SECONDS_PLACEHOLDER, String.valueOf(getSettings().getConfirmationTime()));
// Require confirmation
confirm.put(user.getUniqueId(), System.currentTimeMillis() + getSettings().getConfirmationTime() * 1000L);
Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {

View File

@ -11,7 +11,6 @@ public class IslandSethomeCommand extends CompositeCommand {
public IslandSethomeCommand(CompositeCommand islandCommand) {
super(islandCommand, "sethome");
new CustomIslandMultiHomeHelp(this);
}
@Override
@ -19,6 +18,7 @@ public class IslandSethomeCommand extends CompositeCommand {
setPermission("island.sethome");
setOnlyPlayer(true);
setDescription("commands.island.sethome.description");
new CustomIslandMultiHomeHelp(this);
}
@Override

View File

@ -15,14 +15,6 @@ public class IslandTeamCommand extends CompositeCommand {
public IslandTeamCommand(CompositeCommand parent) {
super(parent, "team");
// Register commands
inviteCommand = new IslandTeamInviteCommand(this);
new IslandTeamLeaveCommand(this);
new IslandTeamSetownerCommand(this);
new IslandTeamKickCommand(this);
new IslandTeamInviteAcceptCommand(this);
new IslandTeamInviteRejectCommand(this);
}
@Override
@ -30,6 +22,13 @@ public class IslandTeamCommand extends CompositeCommand {
setPermission("island.team");
setOnlyPlayer(true);
setDescription("commands.island.team.description");
// Register commands
inviteCommand = new IslandTeamInviteCommand(this);
new IslandTeamLeaveCommand(this);
new IslandTeamSetownerCommand(this);
new IslandTeamKickCommand(this);
new IslandTeamInviteAcceptCommand(this);
new IslandTeamInviteRejectCommand(this);
}
@Override

View File

@ -6,7 +6,6 @@ import java.util.UUID;
import org.bukkit.GameMode;
import org.bukkit.Location;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.api.events.team.TeamEvent;
@ -91,7 +90,7 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
// Put player back into normal mode
user.setGameMode(GameMode.SURVIVAL);
user.sendMessage("commands.island.team.invite.accept.you-joined-island", "[label]", Constants.ISLANDCOMMAND);
user.sendMessage("commands.island.team.invite.accept.you-joined-island", "[label]", getTopLabel());
User inviter = User.getInstance(itc.getInviteCommand().getInviteList().get(playerUUID));
if (inviter != null) {
inviter.sendMessage("commands.island.team.invite.accept.name-joined-your-island", "[name]", user.getName());

View File

@ -142,9 +142,6 @@ public class AddonsManager {
// Inform the console
plugin.log("Loading BSkyBlock addon " + addon.getDescription().getName() + "...");
// Run the onLoad() method
addon.onLoad();
}
} catch (Exception e) {

View File

@ -30,4 +30,8 @@ public class CommandsManager {
return commands.get(command);
}
public String listCommands() {
return commands.keySet().toString();
}
}

View File

@ -421,7 +421,7 @@ public class IslandWorldManager {
/**
* Get max team size for this world
* @param world
* @param world - world
* @return max team size
*/
public int getMaxTeamSize(World world) {
@ -430,11 +430,19 @@ public class IslandWorldManager {
/**
* Get max homes for world
* @param world
* @param world - world
* @return max homes
*/
public int getMaxHomes(World world) {
return worldSettings.get(Util.getWorld(world)).getMaxHomes();
}
/**
* Get the friendly name for world or related nether or end
* @param world - world
* @return Friendly name
*/
public String getFriendlyName(World world) {
return worldSettings.get(Util.getWorld(world)).getFriendlyName();
}
}

View File

@ -522,7 +522,7 @@ public class IslandsManager {
}
player.teleport(home);
if (number == 1) {
user.sendMessage("commands.island.go.teleport", "[label]", Constants.ISLANDCOMMAND);
user.sendMessage("commands.island.go.teleport");
} else {
user.sendMessage("commands.island.go.teleported", "[number]", String.valueOf(number));
}

View File

@ -27,6 +27,7 @@ import us.tastybento.bskyblock.api.events.command.CommandEvent;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.IslandCommand;
import us.tastybento.bskyblock.managers.CommandsManager;
import us.tastybento.bskyblock.managers.IslandWorldManager;
import us.tastybento.bskyblock.managers.IslandsManager;
import us.tastybento.bskyblock.managers.PlayersManager;
@ -95,6 +96,11 @@ public class DefaultHelpCommandTest {
PowerMockito.mockStatic(Bukkit.class);
when(Bukkit.getScheduler()).thenReturn(sch);
// IWM friendly name
IslandWorldManager iwm = mock(IslandWorldManager.class);
when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock");
when(plugin.getIWM()).thenReturn(iwm);
}
class FakeParent extends CompositeCommand {
@ -146,7 +152,7 @@ public class DefaultHelpCommandTest {
when(user.getTranslation("description")).thenReturn("the main island command");
DefaultHelpCommand dhc = new DefaultHelpCommand(parent);
dhc.execute(user, new ArrayList<>());
Mockito.verify(user).sendMessage("commands.help.header");
Mockito.verify(user).sendMessage("commands.help.header", "[label]", "BSkyBlock");
Mockito.verify(user).getTranslation("island");
Mockito.verify(user).getTranslation("parameters");
Mockito.verify(user).getTranslation("description");

View File

@ -96,6 +96,7 @@ public class AdminInfoCommandTest {
IslandWorldManager iwm = mock(IslandWorldManager.class);
World world = mock(World.class);
when(iwm.getIslandWorld()).thenReturn(world);
when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock");
when(plugin.getIWM()).thenReturn(iwm);

View File

@ -89,6 +89,7 @@ public class AdminTeamAddCommandTest {
// Parent command has no aliases
ac = mock(AdminCommand.class);
when(ac.getSubCommandAliases()).thenReturn(new HashMap<>());
when(ac.getTopLabel()).thenReturn("bsb");
// Player has island to begin with
im = mock(IslandsManager.class);
@ -118,6 +119,7 @@ public class AdminTeamAddCommandTest {
IslandWorldManager iwm = mock(IslandWorldManager.class);
World world = mock(World.class);
when(iwm.getIslandWorld()).thenReturn(world);
when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock");
when(plugin.getIWM()).thenReturn(iwm);
}

View File

@ -40,6 +40,7 @@ import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.IslandCommand;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.CommandsManager;
import us.tastybento.bskyblock.managers.IslandWorldManager;
import us.tastybento.bskyblock.managers.IslandsManager;
import us.tastybento.bskyblock.managers.PlayersManager;
@ -115,6 +116,11 @@ public class IslandBanCommandTest {
when(island.isBanned(Mockito.any())).thenReturn(false);
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(island);
// IWM friendly name
IslandWorldManager iwm = mock(IslandWorldManager.class);
when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock");
when(plugin.getIWM()).thenReturn(iwm);
}
/**

View File

@ -36,6 +36,7 @@ import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.IslandCommand;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.CommandsManager;
import us.tastybento.bskyblock.managers.IslandWorldManager;
import us.tastybento.bskyblock.managers.IslandsManager;
import us.tastybento.bskyblock.managers.PlayersManager;
@ -88,6 +89,7 @@ public class IslandBanlistCommandTest {
// Parent command has no aliases
ic = mock(IslandCommand.class);
when(ic.getSubCommandAliases()).thenReturn(new HashMap<>());
when(ic.getTopLabel()).thenReturn("island");
// No island for player to begin with (set it later in the tests)
im = mock(IslandsManager.class);
@ -111,6 +113,11 @@ public class IslandBanlistCommandTest {
when(island.isBanned(Mockito.any())).thenReturn(false);
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(island);
// IWM friendly name
IslandWorldManager iwm = mock(IslandWorldManager.class);
when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock");
when(plugin.getIWM()).thenReturn(iwm);
}
/**

View File

@ -27,12 +27,12 @@ import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.Constants;
import us.tastybento.bskyblock.Settings;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.IslandCommand;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.CommandsManager;
import us.tastybento.bskyblock.managers.IslandWorldManager;
import us.tastybento.bskyblock.managers.IslandsManager;
import us.tastybento.bskyblock.managers.PlayersManager;
import us.tastybento.bskyblock.managers.island.NewIsland;
@ -74,6 +74,7 @@ public class IslandResetCommandTest {
// Player
Player p = mock(Player.class);
// User, sometime use Mockito.withSettings().verboseLogging()
user = mock(User.class);
when(user.isOp()).thenReturn(false);
uuid = UUID.randomUUID();
@ -83,6 +84,7 @@ public class IslandResetCommandTest {
// Parent command has no aliases
ic = mock(IslandCommand.class);
when(ic.getSubCommandAliases()).thenReturn(new HashMap<>());
when(ic.getTopLabel()).thenReturn("island");
// No island for player to begin with (set it later in the tests)
im = mock(IslandsManager.class);
@ -90,6 +92,7 @@ public class IslandResetCommandTest {
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(false);
when(plugin.getIslands()).thenReturn(im);
// Has team
pm = mock(PlayersManager.class);
when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
@ -100,6 +103,12 @@ public class IslandResetCommandTest {
PowerMockito.mockStatic(Bukkit.class);
when(Bukkit.getScheduler()).thenReturn(sch);
// IWM friendly name
IslandWorldManager iwm = mock(IslandWorldManager.class);
when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock");
when(plugin.getIWM()).thenReturn(iwm);
}
/**
@ -272,7 +281,7 @@ public class IslandResetCommandTest {
// Reset
assertTrue(irc.execute(user, new ArrayList<>()));
Mockito.verify(user).sendMessage("commands.island.reset.confirm", "[label]", Constants.ISLANDCOMMAND, "[seconds]", String.valueOf(s.getConfirmationTime()));
Mockito.verify(user).sendMessage("commands.island.reset.confirm", "[label]", "island", "[seconds]", String.valueOf(s.getConfirmationTime()));
// Reset confirm
assertTrue(irc.execute(user, Arrays.asList("confirm")));

View File

@ -36,6 +36,7 @@ import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.IslandCommand;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.CommandsManager;
import us.tastybento.bskyblock.managers.IslandWorldManager;
import us.tastybento.bskyblock.managers.IslandsManager;
import us.tastybento.bskyblock.managers.PlayersManager;
@ -111,6 +112,10 @@ public class IslandUnbanCommandTest {
when(island.isBanned(Mockito.any())).thenReturn(false);
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(island);
// IWM friendly name
IslandWorldManager iwm = mock(IslandWorldManager.class);
when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock");
when(plugin.getIWM()).thenReturn(iwm);
}
/**

View File

@ -29,6 +29,7 @@ import us.tastybento.bskyblock.Settings;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.IslandCommand;
import us.tastybento.bskyblock.managers.CommandsManager;
import us.tastybento.bskyblock.managers.IslandWorldManager;
import us.tastybento.bskyblock.managers.IslandsManager;
import us.tastybento.bskyblock.managers.LocalesManager;
import us.tastybento.bskyblock.managers.PlayersManager;
@ -112,6 +113,11 @@ public class IslandTeamInviteCommandTest {
LocalesManager lm = mock(LocalesManager.class);
when(lm.get(Mockito.any(), Mockito.any())).thenReturn("mock translation");
when(plugin.getLocalesManager()).thenReturn(lm);
// IWM friendly name
IslandWorldManager iwm = mock(IslandWorldManager.class);
when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock");
when(plugin.getIWM()).thenReturn(iwm);
}
/**

View File

@ -32,6 +32,7 @@ import us.tastybento.bskyblock.Settings;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.IslandCommand;
import us.tastybento.bskyblock.managers.CommandsManager;
import us.tastybento.bskyblock.managers.IslandWorldManager;
import us.tastybento.bskyblock.managers.IslandsManager;
import us.tastybento.bskyblock.managers.LocalesManager;
import us.tastybento.bskyblock.managers.PlayersManager;
@ -113,6 +114,11 @@ public class IslandTeamKickCommandTest {
LocalesManager lm = mock(LocalesManager.class);
when(lm.get(Mockito.any(), Mockito.any())).thenReturn("mock translation");
when(plugin.getLocalesManager()).thenReturn(lm);
// IWM friendly name
IslandWorldManager iwm = mock(IslandWorldManager.class);
when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock");
when(plugin.getIWM()).thenReturn(iwm);
}
/**