From e11f173ca3a8e51c8dac0ae41153fabffd0dd7aa Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Tue, 14 Aug 2018 21:11:46 +0200 Subject: [PATCH] Made /is reset use the command cooldown API + switched "wait" settings to int Aaaand had to update some tests. Lots of tests. --- .../world/bentobox/bentobox/Settings.java | 18 ++++++++--------- .../commands/island/IslandResetCommand.java | 20 +++---------------- .../api/commands/DefaultHelpCommandTest.java | 1 - .../admin/AdminClearResetsAllCommandTest.java | 2 +- .../admin/AdminClearResetsCommandTest.java | 1 - .../admin/AdminDeleteCommandTest.java | 2 +- .../commands/admin/AdminInfoCommandTest.java | 5 ----- .../admin/AdminRegisterCommandTest.java | 5 ----- .../admin/AdminUnregisterCommandTest.java | 5 ----- .../admin/range/AdminRangeCommandTest.java | 5 ----- .../range/AdminRangeDisplayCommandTest.java | 5 ----- .../range/AdminRangeResetCommandTest.java | 5 ----- .../admin/range/AdminRangeSetCommandTest.java | 5 ----- .../admin/team/AdminTeamAddCommandTest.java | 5 ----- .../team/AdminTeamDisbandCommandTest.java | 5 ----- .../admin/team/AdminTeamKickCommandTest.java | 5 ----- .../team/AdminTeamMakeLeaderCommandTest.java | 5 ----- .../commands/island/IslandBanCommandTest.java | 1 - .../island/IslandBanlistCommandTest.java | 2 -- .../commands/island/IslandGoCommandTest.java | 2 -- .../island/IslandResetCommandTest.java | 3 +-- .../island/IslandUnbanCommandTest.java | 1 - .../team/IslandTeamCoopCommandTest.java | 1 - .../team/IslandTeamInviteCommandTest.java | 2 -- .../team/IslandTeamKickCommandTest.java | 2 -- .../team/IslandTeamLeaveCommandTest.java | 5 ++--- .../team/IslandTeamTrustCommandTest.java | 1 - .../team/IslandTeamUncoopCommandTest.java | 1 - .../team/IslandTeamUntrustCommandTest.java | 1 - .../flags/clicklisteners/CycleClickTest.java | 1 - .../flags/LockAndBanListenerTest.java | 2 -- .../bentobox/managers/IslandsManagerTest.java | 2 -- 32 files changed, 17 insertions(+), 109 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/Settings.java b/src/main/java/world/bentobox/bentobox/Settings.java index a5ed6a3af..2e6c30136 100644 --- a/src/main/java/world/bentobox/bentobox/Settings.java +++ b/src/main/java/world/bentobox/bentobox/Settings.java @@ -135,20 +135,20 @@ public class Settings implements DataObject { private boolean kickConfirmation = true; @ConfigEntry(path = "island.require-confirmation.kick-wait") - private long kickWait = 10L; + private int kickWait = 10; @ConfigEntry(path = "island.require-confirmation.leave") private boolean leaveConfirmation = true; @ConfigEntry(path = "island.require-confirmation.leave-wait") - private long leaveWait = 10L; + private int leaveWait = 10; @ConfigEntry(path = "island.require-confirmation.reset") private boolean resetConfirmation = true; @ConfigComment("How long a player must wait before they can reset their island again in seconds") @ConfigEntry(path = "island.reset-wait") - private long resetWait = 300; + private int resetWait = 300; @ConfigComment("These set the minimum and maximum size of a name.") @ConfigEntry(path = "island.name.min-length") @@ -475,7 +475,7 @@ public class Settings implements DataObject { /** * @return the kickWait */ - public long getKickWait() { + public int getKickWait() { return kickWait; } @@ -489,7 +489,7 @@ public class Settings implements DataObject { /** * @return the leaveWait */ - public long getLeaveWait() { + public int getLeaveWait() { return leaveWait; } @@ -503,7 +503,7 @@ public class Settings implements DataObject { /** * @param kickWait the kickWait to set */ - public void setKickWait(long kickWait) { + public void setKickWait(int kickWait) { this.kickWait = kickWait; } @@ -517,21 +517,21 @@ public class Settings implements DataObject { /** * @param leaveWait the leaveWait to set */ - public void setLeaveWait(long leaveWait) { + public void setLeaveWait(int leaveWait) { this.leaveWait = leaveWait; } /** * @return the resetWait */ - public long getResetWait() { + public int getResetWait() { return resetWait; } /** * @param resetWait the resetWait to set */ - public void setResetWait(long resetWait) { + public void setResetWait(int resetWait) { this.resetWait = resetWait; } diff --git a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandResetCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandResetCommand.java index 724d3db36..41a49953c 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandResetCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandResetCommand.java @@ -19,15 +19,12 @@ import world.bentobox.bentobox.managers.island.NewIsland; public class IslandResetCommand extends ConfirmableCommand { - private Map cooldown; - public IslandResetCommand(CompositeCommand islandCommand) { super(islandCommand, "reset", "restart"); } @Override public void setup() { - cooldown = new HashMap<>(); setPermission("island.create"); setOnlyPlayer(true); setDescription("commands.island.reset.description"); @@ -36,10 +33,10 @@ public class IslandResetCommand extends ConfirmableCommand { @Override 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))); + if (getSettings().getResetWait() > 0 && checkCooldown(user, null)) { return false; } + if (!getIslands().hasIsland(getWorld(), user.getUniqueId())) { user.sendMessage("general.errors.no-island"); return false; @@ -104,18 +101,7 @@ public class IslandResetCommand extends ConfirmableCommand { user.sendMessage("commands.island.create.unable-create-island"); return false; } - setCooldown(user); + setCooldown(user.getUniqueId(), null, getSettings().getResetWait()); return true; } - - private int onRestartWaitTime(User user) { - if (!cooldown.containsKey(user.getUniqueId())) { - return 0; - } - return (int) (System.currentTimeMillis() - cooldown.get(user.getUniqueId()) / 1000); - } - - private void setCooldown(User user) { - cooldown.put(user.getUniqueId(), System.currentTimeMillis() + (getIWM().getResetLimit(getWorld()) * 1000L)); - } } diff --git a/src/test/java/world/bentobox/bentobox/api/commands/DefaultHelpCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/DefaultHelpCommandTest.java index 38521c1fd..f454571ee 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/DefaultHelpCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/DefaultHelpCommandTest.java @@ -52,7 +52,6 @@ public class DefaultHelpCommandTest { // Settings Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminClearResetsAllCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminClearResetsAllCommandTest.java index 8d539a5fa..a8bc02f15 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminClearResetsAllCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminClearResetsAllCommandTest.java @@ -54,7 +54,7 @@ public class AdminClearResetsAllCommandTest { // Settings Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); + when(s.getResetWait()).thenReturn(0); when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminClearResetsCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminClearResetsCommandTest.java index cdcb5d5d8..23d51eb5d 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminClearResetsCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminClearResetsCommandTest.java @@ -64,7 +64,6 @@ public class AdminClearResetsCommandTest { // Settings Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminDeleteCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminDeleteCommandTest.java index 3f3c1f4e5..7a513e3a9 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminDeleteCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminDeleteCommandTest.java @@ -66,7 +66,7 @@ public class AdminDeleteCommandTest { // Settings Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); + when(s.getResetWait()).thenReturn(0); when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminInfoCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminInfoCommandTest.java index 7c4cec1b9..ca79ea5e2 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminInfoCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminInfoCommandTest.java @@ -66,11 +66,6 @@ public class AdminInfoCommandTest { CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); - // Settings - Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); - // Player Player p = mock(Player.class); // Sometimes use Mockito.withSettings().verboseLogging() diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminRegisterCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminRegisterCommandTest.java index 90a07fa70..b503c5ef1 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminRegisterCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminRegisterCommandTest.java @@ -65,11 +65,6 @@ public class AdminRegisterCommandTest { CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); - // Settings - Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); - // Player Player p = mock(Player.class); // Sometimes use Mockito.withSettings().verboseLogging() diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminUnregisterCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminUnregisterCommandTest.java index 367f683c6..1e8581cf8 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminUnregisterCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminUnregisterCommandTest.java @@ -63,11 +63,6 @@ public class AdminUnregisterCommandTest { CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); - // Settings - Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); - // Player Player p = mock(Player.class); // Sometimes use Mockito.withSettings().verboseLogging() diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeCommandTest.java index b666d7995..d4f34a4f4 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeCommandTest.java @@ -53,11 +53,6 @@ public class AdminRangeCommandTest { CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); - // Settings - Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); - // Player Player p = mock(Player.class); // Sometimes use Mockito.withSettings().verboseLogging() diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommandTest.java index 759dbf9da..ab55a15b6 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommandTest.java @@ -58,11 +58,6 @@ public class AdminRangeDisplayCommandTest { CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); - // Settings - Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); - // Player Player p = mock(Player.class); // Sometimes use Mockito.withSettings().verboseLogging() diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeResetCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeResetCommandTest.java index 4477f112d..06b11bfb3 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeResetCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeResetCommandTest.java @@ -66,11 +66,6 @@ public class AdminRangeResetCommandTest { CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); - // Settings - Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); - // Player Player p = mock(Player.class); // Sometimes use Mockito.withSettings().verboseLogging() diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeSetCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeSetCommandTest.java index d5063d6cb..d0308130e 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeSetCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeSetCommandTest.java @@ -66,11 +66,6 @@ public class AdminRangeSetCommandTest { CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); - // Settings - Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); - // Player Player p = mock(Player.class); // Sometimes use Mockito.withSettings().verboseLogging() diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamAddCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamAddCommandTest.java index 4491041df..d0cbba268 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamAddCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamAddCommandTest.java @@ -63,11 +63,6 @@ public class AdminTeamAddCommandTest { CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); - // Settings - Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); - // Player Player p = mock(Player.class); // Sometimes use Mockito.withSettings().verboseLogging() diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamDisbandCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamDisbandCommandTest.java index 2dbc6a1da..68190f216 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamDisbandCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamDisbandCommandTest.java @@ -64,11 +64,6 @@ public class AdminTeamDisbandCommandTest { CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); - // Settings - Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); - // Player Player p = mock(Player.class); // Sometimes use Mockito.withSettings().verboseLogging() diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamKickCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamKickCommandTest.java index e5738af03..e18221b8a 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamKickCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamKickCommandTest.java @@ -66,11 +66,6 @@ public class AdminTeamKickCommandTest { CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); - // Settings - Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); - // Player Player p = mock(Player.class); // Sometimes use Mockito.withSettings().verboseLogging() diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamMakeLeaderCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamMakeLeaderCommandTest.java index f8e9416ce..39cff8e25 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamMakeLeaderCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamMakeLeaderCommandTest.java @@ -64,11 +64,6 @@ public class AdminTeamMakeLeaderCommandTest { CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); - // Settings - Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); - // Player Player p = mock(Player.class); // Sometimes use Mockito.withSettings().verboseLogging() diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandBanCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandBanCommandTest.java index a14044f56..0b0734171 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandBanCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandBanCommandTest.java @@ -76,7 +76,6 @@ public class IslandBanCommandTest { // Settings Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); when(s.getRankCommand(Mockito.anyString())).thenReturn(RanksManager.OWNER_RANK); when(plugin.getSettings()).thenReturn(s); diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandBanlistCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandBanlistCommandTest.java index 0b6a5df65..6f145840b 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandBanlistCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandBanlistCommandTest.java @@ -69,8 +69,6 @@ public class IslandBanlistCommandTest { // Settings Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandGoCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandGoCommandTest.java index ba608ab32..cc8c801ae 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandGoCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandGoCommandTest.java @@ -66,8 +66,6 @@ public class IslandGoCommandTest { // Settings Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandResetCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandResetCommandTest.java index 6b06fe649..9eceb143e 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandResetCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandResetCommandTest.java @@ -70,8 +70,7 @@ public class IslandResetCommandTest { // Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - + when(s.getResetWait()).thenReturn(0); when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandUnbanCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandUnbanCommandTest.java index 23849c550..5ba479a33 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandUnbanCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandUnbanCommandTest.java @@ -73,7 +73,6 @@ public class IslandUnbanCommandTest { // Settings Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); when(s.getRankCommand(Mockito.anyString())).thenReturn(RanksManager.OWNER_RANK); when(plugin.getSettings()).thenReturn(s); diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamCoopCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamCoopCommandTest.java index e1661d579..13cc7ab3f 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamCoopCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamCoopCommandTest.java @@ -69,7 +69,6 @@ public class IslandTeamCoopCommandTest { // Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); when(s.getRankCommand(Mockito.anyString())).thenReturn(RanksManager.OWNER_RANK); when(plugin.getSettings()).thenReturn(s); diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamInviteCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamInviteCommandTest.java index 9e1a5520a..bf6c727ba 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamInviteCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamInviteCommandTest.java @@ -68,9 +68,7 @@ public class IslandTeamInviteCommandTest { // Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); when(s.getRankCommand(Mockito.anyString())).thenReturn(RanksManager.OWNER_RANK); - when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamKickCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamKickCommandTest.java index ff9ab37f5..51cb08957 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamKickCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamKickCommandTest.java @@ -74,8 +74,6 @@ public class IslandTeamKickCommandTest { // Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamLeaveCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamLeaveCommandTest.java index 4752069d9..fe8fcb10e 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamLeaveCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamLeaveCommandTest.java @@ -66,8 +66,7 @@ public class IslandTeamLeaveCommandTest { // Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - + when(s.getResetWait()).thenReturn(0); when(plugin.getSettings()).thenReturn(s); // Player @@ -150,7 +149,7 @@ public class IslandTeamLeaveCommandTest { public void testExecuteWithConfirmation() { when(s.isLeaveConfirmation()).thenReturn(true); // 3 second timeout - when(s.getLeaveWait()).thenReturn(3L); + when(s.getLeaveWait()).thenReturn(3); when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(false); when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(false); // Add a team leader - null diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamTrustCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamTrustCommandTest.java index 1fd7559c2..971fa5f9c 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamTrustCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamTrustCommandTest.java @@ -69,7 +69,6 @@ public class IslandTeamTrustCommandTest { // Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); when(s.getRankCommand(Mockito.anyString())).thenReturn(RanksManager.OWNER_RANK); when(plugin.getSettings()).thenReturn(s); diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamUncoopCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamUncoopCommandTest.java index fb8e0de8e..9ab9eaa23 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamUncoopCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamUncoopCommandTest.java @@ -69,7 +69,6 @@ public class IslandTeamUncoopCommandTest { // Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); when(s.getRankCommand(Mockito.anyString())).thenReturn(RanksManager.OWNER_RANK); when(plugin.getSettings()).thenReturn(s); diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamUntrustCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamUntrustCommandTest.java index 80e03090e..ac0d42cbc 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamUntrustCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamUntrustCommandTest.java @@ -69,7 +69,6 @@ public class IslandTeamUntrustCommandTest { // Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); when(s.getRankCommand(Mockito.anyString())).thenReturn(RanksManager.OWNER_RANK); when(plugin.getSettings()).thenReturn(s); diff --git a/src/test/java/world/bentobox/bentobox/api/flags/clicklisteners/CycleClickTest.java b/src/test/java/world/bentobox/bentobox/api/flags/clicklisteners/CycleClickTest.java index 53b707c0a..3e72c02c9 100644 --- a/src/test/java/world/bentobox/bentobox/api/flags/clicklisteners/CycleClickTest.java +++ b/src/test/java/world/bentobox/bentobox/api/flags/clicklisteners/CycleClickTest.java @@ -77,7 +77,6 @@ public class CycleClickTest { // Settings Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/world/bentobox/bentobox/listeners/flags/LockAndBanListenerTest.java b/src/test/java/world/bentobox/bentobox/listeners/flags/LockAndBanListenerTest.java index 40eebccb6..3f148b66f 100644 --- a/src/test/java/world/bentobox/bentobox/listeners/flags/LockAndBanListenerTest.java +++ b/src/test/java/world/bentobox/bentobox/listeners/flags/LockAndBanListenerTest.java @@ -85,8 +85,6 @@ public class LockAndBanListenerTest { // Settings Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/world/bentobox/bentobox/managers/IslandsManagerTest.java b/src/test/java/world/bentobox/bentobox/managers/IslandsManagerTest.java index 5b02babcb..bd20b4e5b 100644 --- a/src/test/java/world/bentobox/bentobox/managers/IslandsManagerTest.java +++ b/src/test/java/world/bentobox/bentobox/managers/IslandsManagerTest.java @@ -96,8 +96,6 @@ public class IslandsManagerTest { // Settings Settings s = mock(Settings.class); - when(s.getResetWait()).thenReturn(0L); - when(plugin.getSettings()).thenReturn(s); // Player