Merge branch 'BentoBoxWorld:develop' into develop

This commit is contained in:
Lukas 2024-11-06 21:55:57 +01:00 committed by GitHub
commit 36a60fa434
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 80 additions and 11 deletions

View File

@ -88,7 +88,7 @@
<!-- Do not change unless you want different name for local builds. --> <!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number> <build.number>-LOCAL</build.number>
<!-- This allows to change between versions. --> <!-- This allows to change between versions. -->
<build.version>2.7.0</build.version> <build.version>2.7.1</build.version>
<sonar.organization>bentobox-world</sonar.organization> <sonar.organization>bentobox-world</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url> <sonar.host.url>https://sonarcloud.io</sonar.host.url>
<server.jars>${project.basedir}/lib</server.jars> <server.jars>${project.basedir}/lib</server.jars>

View File

@ -114,13 +114,14 @@ public class HurtingListener extends FlagListener {
*/ */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerFeedParrots(PlayerInteractEntityEvent e) { public void onPlayerFeedParrots(PlayerInteractEntityEvent e) {
if (e.getRightClicked() instanceof Parrot if (e.getRightClicked() instanceof Parrot parrot) {
&& (e.getHand().equals(EquipmentSlot.HAND) && e.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.COOKIE)) if ((e.getHand().equals(EquipmentSlot.HAND) && e.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.COOKIE))
|| (e.getHand().equals(EquipmentSlot.OFF_HAND) && e.getPlayer().getInventory().getItemInOffHand().getType().equals(Material.COOKIE))) { || (e.getHand().equals(EquipmentSlot.OFF_HAND) && e.getPlayer().getInventory().getItemInOffHand().getType().equals(Material.COOKIE))) {
if (((Parrot) e.getRightClicked()).isTamed()) { if (parrot.isTamed()) {
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.HURT_TAMED_ANIMALS); checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.HURT_TAMED_ANIMALS);
} else { } else {
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.HURT_ANIMALS); checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.HURT_ANIMALS);
}
} }
} }
} }

View File

@ -712,7 +712,7 @@ public class Util {
* @param player - player * @param player - player
*/ */
public static void resetHealth(Player player) { public static void resetHealth(Player player) {
double maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue(); double maxHealth = player.getAttribute(Attribute.MAX_HEALTH).getBaseValue();
player.setHealth(maxHealth); player.setHealth(maxHealth);
} }

View File

@ -1,7 +1,7 @@
name: BentoBox name: BentoBox
main: world.bentobox.bentobox.BentoBox main: world.bentobox.bentobox.BentoBox
version: ${project.version}${build.number} version: ${project.version}${build.number}
api-version: "1.20" api-version: "1.21"
authors: [tastybento, Poslovitch] authors: [tastybento, Poslovitch]
contributors: ["The BentoBoxWorld Community"] contributors: ["The BentoBoxWorld Community"]

View File

@ -24,6 +24,7 @@ import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -180,6 +181,7 @@ public class AdminBlueprintLoadCommandTest {
* Test method for {@link world.bentobox.bentobox.api.commands.admin.blueprints.AdminBlueprintLoadCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}. * Test method for {@link world.bentobox.bentobox.api.commands.admin.blueprints.AdminBlueprintLoadCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testExecuteUserStringListOfStringSuccessCaps() { public void testExecuteUserStringListOfStringSuccessCaps() {
assertTrue(abcc.execute(user, "", List.of("island"))); assertTrue(abcc.execute(user, "", List.of("island")));
verify(user).sendMessage("general.success"); verify(user).sendMessage("general.success");

View File

@ -25,6 +25,7 @@ import org.bukkit.Bukkit;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -199,6 +200,7 @@ public class AdminBlueprintSaveCommandTest {
* Test method for {@link world.bentobox.bentobox.api.commands.admin.blueprints.AdminBlueprintSaveCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}. * Test method for {@link world.bentobox.bentobox.api.commands.admin.blueprints.AdminBlueprintSaveCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testExecuteUserStringListOfString() { public void testExecuteUserStringListOfString() {
testCanExecute(); testCanExecute();
assertTrue(absc.execute(user, "", List.of("island"))); assertTrue(absc.execute(user, "", List.of("island")));
@ -210,6 +212,7 @@ public class AdminBlueprintSaveCommandTest {
* Test method for {@link world.bentobox.bentobox.api.commands.admin.blueprints.AdminBlueprintSaveCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}. * Test method for {@link world.bentobox.bentobox.api.commands.admin.blueprints.AdminBlueprintSaveCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testExecuteUserStringListOfStringFileExists() { public void testExecuteUserStringListOfStringFileExists() {
testCanExecute(); testCanExecute();
assertTrue(absc.execute(user, "", List.of("island"))); assertTrue(absc.execute(user, "", List.of("island")));

View File

@ -27,6 +27,7 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -368,6 +369,7 @@ public class IslandExpelCommandTest extends RanksManagerBeforeClassTest {
* {@link world.bentobox.bentobox.api.commands.island.IslandExpelCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}. * {@link world.bentobox.bentobox.api.commands.island.IslandExpelCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testExecuteUserStringListOfStringHasIsland() { public void testExecuteUserStringListOfStringHasIsland() {
testCanExecute(); testCanExecute();
assertTrue(iec.execute(user, "", Collections.singletonList("tasty"))); assertTrue(iec.execute(user, "", Collections.singletonList("tasty")));
@ -381,6 +383,7 @@ public class IslandExpelCommandTest extends RanksManagerBeforeClassTest {
* {@link world.bentobox.bentobox.api.commands.island.IslandExpelCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}. * {@link world.bentobox.bentobox.api.commands.island.IslandExpelCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testExecuteUserStringListOfStringNoIslandSendToSpawn() { public void testExecuteUserStringListOfStringNoIslandSendToSpawn() {
Optional<Island> optionalIsland = Optional.of(island); Optional<Island> optionalIsland = Optional.of(island);
when(im.getSpawn(any())).thenReturn(optionalIsland); when(im.getSpawn(any())).thenReturn(optionalIsland);
@ -397,6 +400,7 @@ public class IslandExpelCommandTest extends RanksManagerBeforeClassTest {
* {@link world.bentobox.bentobox.api.commands.island.IslandExpelCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}. * {@link world.bentobox.bentobox.api.commands.island.IslandExpelCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testExecuteUserStringListOfStringCreateIsland() { public void testExecuteUserStringListOfStringCreateIsland() {
GameModeAddon gma = mock(GameModeAddon.class); GameModeAddon gma = mock(GameModeAddon.class);
CompositeCommand pc = mock(CompositeCommand.class); CompositeCommand pc = mock(CompositeCommand.class);
@ -419,6 +423,7 @@ public class IslandExpelCommandTest extends RanksManagerBeforeClassTest {
* {@link world.bentobox.bentobox.api.commands.island.IslandExpelCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}. * {@link world.bentobox.bentobox.api.commands.island.IslandExpelCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testExecuteUserStringListOfStringCreateIslandFailCommand() { public void testExecuteUserStringListOfStringCreateIslandFailCommand() {
GameModeAddon gma = mock(GameModeAddon.class); GameModeAddon gma = mock(GameModeAddon.class);
CompositeCommand pc = mock(CompositeCommand.class); CompositeCommand pc = mock(CompositeCommand.class);

View File

@ -32,6 +32,7 @@ import org.bukkit.scheduler.BukkitScheduler;
import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNull;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -237,6 +238,7 @@ public class CycleClickTest {
} }
@Test @Test
@Ignore("Enums")
public void testNoPremission() { public void testNoPremission() {
when(user.hasPermission(anyString())).thenReturn(false); when(user.hasPermission(anyString())).thenReturn(false);
CycleClick udc = new CycleClick(LOCK); CycleClick udc = new CycleClick(LOCK);
@ -254,6 +256,7 @@ public class CycleClickTest {
* Test for {@link CycleClick#onClick(world.bentobox.bentobox.api.panels.Panel, User, ClickType, int)} * Test for {@link CycleClick#onClick(world.bentobox.bentobox.api.panels.Panel, User, ClickType, int)}
*/ */
@Test @Test
@Ignore("Enums")
public void testOnLeftClick() { public void testOnLeftClick() {
final int SLOT = 5; final int SLOT = 5;
CycleClick udc = new CycleClick(LOCK); CycleClick udc = new CycleClick(LOCK);
@ -273,6 +276,7 @@ public class CycleClickTest {
* Test for {@link CycleClick#onClick(world.bentobox.bentobox.api.panels.Panel, User, ClickType, int)} * Test for {@link CycleClick#onClick(world.bentobox.bentobox.api.panels.Panel, User, ClickType, int)}
*/ */
@Test @Test
@Ignore("Enums")
public void testOnLeftClickSetMinMax() { public void testOnLeftClickSetMinMax() {
// Provide a current rank value - coop // Provide a current rank value - coop
when(island.getFlag(any())).thenReturn(RanksManager.COOP_RANK); when(island.getFlag(any())).thenReturn(RanksManager.COOP_RANK);
@ -294,6 +298,7 @@ public class CycleClickTest {
* Test for {@link CycleClick#onClick(world.bentobox.bentobox.api.panels.Panel, User, ClickType, int)} * Test for {@link CycleClick#onClick(world.bentobox.bentobox.api.panels.Panel, User, ClickType, int)}
*/ */
@Test @Test
@Ignore("Enums")
public void testOnRightClick() { public void testOnRightClick() {
final int SLOT = 5; final int SLOT = 5;
CycleClick udc = new CycleClick(LOCK); CycleClick udc = new CycleClick(LOCK);
@ -313,6 +318,7 @@ public class CycleClickTest {
* Test for {@link CycleClick#onClick(world.bentobox.bentobox.api.panels.Panel, User, ClickType, int)} * Test for {@link CycleClick#onClick(world.bentobox.bentobox.api.panels.Panel, User, ClickType, int)}
*/ */
@Test @Test
@Ignore("Enums")
public void testOnRightClickMinMaxSet() { public void testOnRightClickMinMaxSet() {
// Provide a current rank value - coop // Provide a current rank value - coop
when(island.getFlag(any())).thenReturn(RanksManager.TRUSTED_RANK); when(island.getFlag(any())).thenReturn(RanksManager.TRUSTED_RANK);
@ -334,6 +340,7 @@ public class CycleClickTest {
* Test for {@link CycleClick#onClick(world.bentobox.bentobox.api.panels.Panel, User, ClickType, int)} * Test for {@link CycleClick#onClick(world.bentobox.bentobox.api.panels.Panel, User, ClickType, int)}
*/ */
@Test @Test
@Ignore("Enums")
public void testAllClicks() { public void testAllClicks() {
// Test all possible click types // Test all possible click types
CycleClick udc = new CycleClick(LOCK); CycleClick udc = new CycleClick(LOCK);
@ -364,6 +371,7 @@ public class CycleClickTest {
* Test for {@link CycleClick#onClick(world.bentobox.bentobox.api.panels.Panel, User, ClickType, int)} * Test for {@link CycleClick#onClick(world.bentobox.bentobox.api.panels.Panel, User, ClickType, int)}
*/ */
@Test @Test
@Ignore("Enums")
public void testOnShiftLeftClickIsOp() { public void testOnShiftLeftClickIsOp() {
when(user.isOp()).thenReturn(true); when(user.isOp()).thenReturn(true);
CycleClick udc = new CycleClick(LOCK); CycleClick udc = new CycleClick(LOCK);

View File

@ -19,6 +19,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -123,6 +124,7 @@ public class IslandToggleClickTest {
} }
@Test @Test
@Ignore("Enums")
public void testOnClickNoPermission() { public void testOnClickNoPermission() {
when(user.hasPermission(Mockito.anyString())).thenReturn(false); when(user.hasPermission(Mockito.anyString())).thenReturn(false);
listener.onClick(panel, user, ClickType.LEFT, 0); listener.onClick(panel, user, ClickType.LEFT, 0);
@ -130,6 +132,7 @@ public class IslandToggleClickTest {
} }
@Test @Test
@Ignore("Enums")
public void testOnClick() { public void testOnClick() {
listener.onClick(panel, user, ClickType.LEFT, 0); listener.onClick(panel, user, ClickType.LEFT, 0);
verify(island).toggleFlag(flag); verify(island).toggleFlag(flag);
@ -137,6 +140,7 @@ public class IslandToggleClickTest {
} }
@Test @Test
@Ignore("Enums")
public void testOnClickNoIsland() { public void testOnClickNoIsland() {
when(settingsTab.getIsland()).thenReturn(null); when(settingsTab.getIsland()).thenReturn(null);
listener.onClick(panel, user, ClickType.LEFT, 0); listener.onClick(panel, user, ClickType.LEFT, 0);
@ -144,6 +148,7 @@ public class IslandToggleClickTest {
} }
@Test @Test
@Ignore("Enums")
public void testOnClickNotOwner() { public void testOnClickNotOwner() {
// No permission // No permission
when(user.hasPermission(anyString())).thenReturn(false); when(user.hasPermission(anyString())).thenReturn(false);

View File

@ -19,6 +19,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -111,6 +112,7 @@ public class WorldToggleClickTest {
* Test for {@link WorldToggleClick#onClick(Panel, User, ClickType, int)} * Test for {@link WorldToggleClick#onClick(Panel, User, ClickType, int)}
*/ */
@Test @Test
@Ignore("Enums")
public void testOnClickNoPermission() { public void testOnClickNoPermission() {
when(user.hasPermission(anyString())).thenReturn(false); when(user.hasPermission(anyString())).thenReturn(false);
listener.onClick(panel, user, ClickType.LEFT, 0); listener.onClick(panel, user, ClickType.LEFT, 0);
@ -122,6 +124,7 @@ public class WorldToggleClickTest {
* Test for {@link WorldToggleClick#onClick(Panel, User, ClickType, int)} * Test for {@link WorldToggleClick#onClick(Panel, User, ClickType, int)}
*/ */
@Test @Test
@Ignore("Enums")
public void testOnClick() { public void testOnClick() {
when(user.hasPermission(anyString())).thenReturn(true); when(user.hasPermission(anyString())).thenReturn(true);
listener.onClick(panel, user, ClickType.LEFT, 0); listener.onClick(panel, user, ClickType.LEFT, 0);

View File

@ -14,6 +14,7 @@ import org.bukkit.World;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNull;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -34,6 +35,7 @@ import world.bentobox.bentobox.database.objects.Island;
*/ */
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({BentoBox.class, User.class, Bukkit.class}) @PrepareForTest({BentoBox.class, User.class, Bukkit.class})
@Ignore("Enums")
public class BlueprintPasterTest { public class BlueprintPasterTest {
private BlueprintPaster bp; private BlueprintPaster bp;

View File

@ -26,6 +26,7 @@ import org.bukkit.inventory.Inventory;
import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -162,6 +163,7 @@ public class CommandRankClickListenerTest extends RanksManagerBeforeClassTest {
* Test method for {@link world.bentobox.bentobox.listeners.flags.clicklisteners.CommandRankClickListener#onClick(world.bentobox.bentobox.api.panels.Panel, world.bentobox.bentobox.api.user.User, org.bukkit.event.inventory.ClickType, int)}. * Test method for {@link world.bentobox.bentobox.listeners.flags.clicklisteners.CommandRankClickListener#onClick(world.bentobox.bentobox.api.panels.Panel, world.bentobox.bentobox.api.user.User, org.bukkit.event.inventory.ClickType, int)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testOnClickNoPermission() { public void testOnClickNoPermission() {
when(user.isOp()).thenReturn(false); when(user.isOp()).thenReturn(false);
when(user.hasPermission(anyString())).thenReturn(false); when(user.hasPermission(anyString())).thenReturn(false);
@ -174,6 +176,7 @@ public class CommandRankClickListenerTest extends RanksManagerBeforeClassTest {
* Test method for {@link world.bentobox.bentobox.listeners.flags.clicklisteners.CommandRankClickListener#onClick(world.bentobox.bentobox.api.panels.Panel, world.bentobox.bentobox.api.user.User, org.bukkit.event.inventory.ClickType, int)}. * Test method for {@link world.bentobox.bentobox.listeners.flags.clicklisteners.CommandRankClickListener#onClick(world.bentobox.bentobox.api.panels.Panel, world.bentobox.bentobox.api.user.User, org.bukkit.event.inventory.ClickType, int)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testOnClickNoFlag() { public void testOnClickNoFlag() {
when(island.isAllowed(user, Flags.CHANGE_SETTINGS)).thenReturn(false); when(island.isAllowed(user, Flags.CHANGE_SETTINGS)).thenReturn(false);
assertTrue(crcl.onClick(panel, user, ClickType.LEFT, 0)); assertTrue(crcl.onClick(panel, user, ClickType.LEFT, 0));

View File

@ -30,6 +30,7 @@ import org.bukkit.event.vehicle.VehicleMoveEvent;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -298,6 +299,7 @@ public class LockAndBanListenerTest {
} }
@Test @Test
@Ignore("Enums")
public void testPlayerMoveIntoBannedIsland() { public void testPlayerMoveIntoBannedIsland() {
// Make player // Make player
when(player.getUniqueId()).thenReturn(uuid); when(player.getUniqueId()).thenReturn(uuid);
@ -320,6 +322,7 @@ public class LockAndBanListenerTest {
} }
@Test @Test
@Ignore("Enums")
public void testPlayerMoveInsideBannedIsland() { public void testPlayerMoveInsideBannedIsland() {
// Make player // Make player
when(player.getUniqueId()).thenReturn(uuid); when(player.getUniqueId()).thenReturn(uuid);
@ -347,6 +350,7 @@ public class LockAndBanListenerTest {
} }
@Test @Test
@Ignore("Enums")
public void testVehicleMoveIntoBannedIsland() { public void testVehicleMoveIntoBannedIsland() {
// Make player // Make player
when(player.getUniqueId()).thenReturn(uuid); when(player.getUniqueId()).thenReturn(uuid);
@ -509,6 +513,7 @@ public class LockAndBanListenerTest {
} }
@Test @Test
@Ignore("Enums")
public void testPlayerMoveIntoLockedIsland() { public void testPlayerMoveIntoLockedIsland() {
// Make player // Make player
when(player.getUniqueId()).thenReturn(uuid); when(player.getUniqueId()).thenReturn(uuid);
@ -613,6 +618,7 @@ public class LockAndBanListenerTest {
} }
@Test @Test
@Ignore("Enums")
public void testPlayerMoveInsideLockedIsland() { public void testPlayerMoveInsideLockedIsland() {
// Make player // Make player
when(player.getUniqueId()).thenReturn(uuid); when(player.getUniqueId()).thenReturn(uuid);
@ -701,6 +707,7 @@ public class LockAndBanListenerTest {
} }
@Test @Test
@Ignore("Enums")
public void testVehicleMoveIntoLockedIsland() { public void testVehicleMoveIntoLockedIsland() {
// Make player // Make player
Player player = mock(Player.class); Player player = mock(Player.class);

View File

@ -41,6 +41,7 @@ import org.bukkit.util.Vector;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -198,6 +199,7 @@ public class InvincibleVisitorsListenerTest {
} }
@Test @Test
@Ignore("Enums")
public void testOnClickNoPermission() { public void testOnClickNoPermission() {
when(user.hasPermission(anyString())).thenReturn(false); when(user.hasPermission(anyString())).thenReturn(false);
listener.onClick(panel, user, ClickType.LEFT, 0); listener.onClick(panel, user, ClickType.LEFT, 0);

View File

@ -29,6 +29,7 @@ import org.bukkit.inventory.PlayerInventory;
import org.bukkit.util.RayTraceResult; import org.bukkit.util.RayTraceResult;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -146,6 +147,7 @@ public class ObsidianScoopingListenerTest extends AbstractCommonSetup {
} }
@Test @Test
@Ignore("Enums")
public void testOnPlayerInteract() { public void testOnPlayerInteract() {
// Test incorrect items // Test incorrect items
inHand = Material.ACACIA_DOOR; inHand = Material.ACACIA_DOOR;
@ -155,6 +157,7 @@ public class ObsidianScoopingListenerTest extends AbstractCommonSetup {
} }
@Test @Test
@Ignore("Enums")
public void testOnPlayerInteractBucketInHand() { public void testOnPlayerInteractBucketInHand() {
// Test incorrect items // Test incorrect items
inHand = Material.BUCKET; inHand = Material.BUCKET;
@ -164,6 +167,7 @@ public class ObsidianScoopingListenerTest extends AbstractCommonSetup {
} }
@Test @Test
@Ignore("Enums")
public void testOnPlayerInteractObsidianAnvilInHand() { public void testOnPlayerInteractObsidianAnvilInHand() {
// Test with obsidian in hand // Test with obsidian in hand
inHand = Material.ANVIL; inHand = Material.ANVIL;
@ -173,6 +177,7 @@ public class ObsidianScoopingListenerTest extends AbstractCommonSetup {
} }
@Test @Test
@Ignore("Enums")
public void testOnPlayerInteractObsidianBucketInHand() { public void testOnPlayerInteractObsidianBucketInHand() {
// Positive test with 1 bucket in the stack // Positive test with 1 bucket in the stack
inHand = Material.BUCKET; inHand = Material.BUCKET;
@ -182,6 +187,7 @@ public class ObsidianScoopingListenerTest extends AbstractCommonSetup {
} }
@Test @Test
@Ignore("Enums")
public void testOnPlayerInteractObsidianManyBucketsInHand() { public void testOnPlayerInteractObsidianManyBucketsInHand() {
// Positive test with 1 bucket in the stack // Positive test with 1 bucket in the stack
inHand = Material.BUCKET; inHand = Material.BUCKET;

View File

@ -28,6 +28,7 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -231,6 +232,7 @@ public class BlueprintClipboardManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#loadBlueprint(java.lang.String)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#loadBlueprint(java.lang.String)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testLoadBlueprintFileInZipJSONError() throws IOException { public void testLoadBlueprintFileInZipJSONError() throws IOException {
blueprintFolder.mkdirs(); blueprintFolder.mkdirs();
// Make a blueprint file // Make a blueprint file
@ -254,6 +256,7 @@ public class BlueprintClipboardManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#loadBlueprint(java.lang.String)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#loadBlueprint(java.lang.String)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testLoadBlueprintFileInZipNoBedrock() throws IOException { public void testLoadBlueprintFileInZipNoBedrock() throws IOException {
blueprintFolder.mkdirs(); blueprintFolder.mkdirs();
// Make a blueprint file // Make a blueprint file
@ -274,6 +277,7 @@ public class BlueprintClipboardManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#loadBlueprint(java.lang.String)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#loadBlueprint(java.lang.String)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testLoadBlueprintFileInZip() throws IOException { public void testLoadBlueprintFileInZip() throws IOException {
blueprintFolder.mkdirs(); blueprintFolder.mkdirs();
// Make a blueprint file // Make a blueprint file
@ -295,6 +299,7 @@ public class BlueprintClipboardManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#load(java.lang.String)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#load(java.lang.String)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testLoadString() throws IOException { public void testLoadString() throws IOException {
blueprintFolder.mkdirs(); blueprintFolder.mkdirs();
// Make a blueprint file // Make a blueprint file
@ -317,6 +322,7 @@ public class BlueprintClipboardManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#load(world.bentobox.bentobox.api.user.User, java.lang.String)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#load(world.bentobox.bentobox.api.user.User, java.lang.String)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testLoadUserString() throws IOException { public void testLoadUserString() throws IOException {
blueprintFolder.mkdirs(); blueprintFolder.mkdirs();
// Make a blueprint file // Make a blueprint file
@ -346,6 +352,7 @@ public class BlueprintClipboardManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#save(world.bentobox.bentobox.api.user.User, java.lang.String, java.lang.String)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#save(world.bentobox.bentobox.api.user.User, java.lang.String, java.lang.String)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testSave() throws IOException { public void testSave() throws IOException {
// Load a blueprint, then save it // Load a blueprint, then save it
blueprintFolder.mkdirs(); blueprintFolder.mkdirs();
@ -367,6 +374,7 @@ public class BlueprintClipboardManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#save(world.bentobox.bentobox.api.user.User, java.lang.String, java.lang.String)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#save(world.bentobox.bentobox.api.user.User, java.lang.String, java.lang.String)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testSaveBadChars() throws IOException { public void testSaveBadChars() throws IOException {
// Load a blueprint, then save it // Load a blueprint, then save it
blueprintFolder.mkdirs(); blueprintFolder.mkdirs();
@ -388,6 +396,7 @@ public class BlueprintClipboardManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#save(world.bentobox.bentobox.api.user.User, java.lang.String, java.lang.String)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#save(world.bentobox.bentobox.api.user.User, java.lang.String, java.lang.String)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testSaveForeignChars() throws IOException { public void testSaveForeignChars() throws IOException {
// Load a blueprint, then save it // Load a blueprint, then save it
blueprintFolder.mkdirs(); blueprintFolder.mkdirs();
@ -409,6 +418,7 @@ public class BlueprintClipboardManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#save(world.bentobox.bentobox.api.user.User, java.lang.String, java.lang.String)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#save(world.bentobox.bentobox.api.user.User, java.lang.String, java.lang.String)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testSaveForeignBadChars() throws IOException { public void testSaveForeignBadChars() throws IOException {
// Load a blueprint, then save it // Load a blueprint, then save it
blueprintFolder.mkdirs(); blueprintFolder.mkdirs();
@ -443,6 +453,7 @@ public class BlueprintClipboardManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#saveBlueprint(world.bentobox.bentobox.blueprints.Blueprint)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintClipboardManager#saveBlueprint(world.bentobox.bentobox.blueprints.Blueprint)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testSaveBlueprintSuccess() { public void testSaveBlueprintSuccess() {
BlueprintClipboardManager bcm = new BlueprintClipboardManager(plugin, blueprintFolder); BlueprintClipboardManager bcm = new BlueprintClipboardManager(plugin, blueprintFolder);
Blueprint blueprint = new Blueprint(); Blueprint blueprint = new Blueprint();

View File

@ -37,6 +37,7 @@ import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -258,6 +259,7 @@ public class BlueprintsManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintsManager#loadBlueprintBundles(world.bentobox.bentobox.api.addons.GameModeAddon)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintsManager#loadBlueprintBundles(world.bentobox.bentobox.api.addons.GameModeAddon)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testLoadBlueprintBundlesNoBlueprintFolder() { public void testLoadBlueprintBundlesNoBlueprintFolder() {
// Set up running and verification // Set up running and verification
when(scheduler.runTaskAsynchronously(eq(plugin), any(Runnable.class))).thenAnswer((Answer<BukkitTask>) invocation -> { when(scheduler.runTaskAsynchronously(eq(plugin), any(Runnable.class))).thenAnswer((Answer<BukkitTask>) invocation -> {
@ -278,6 +280,7 @@ public class BlueprintsManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintsManager#loadBlueprintBundles(world.bentobox.bentobox.api.addons.GameModeAddon)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintsManager#loadBlueprintBundles(world.bentobox.bentobox.api.addons.GameModeAddon)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testLoadBlueprintBundles() { public void testLoadBlueprintBundles() {
// Set up running and verification // Set up running and verification
when(scheduler.runTaskAsynchronously(eq(plugin), any(Runnable.class))).thenAnswer((Answer<BukkitTask>) invocation -> { when(scheduler.runTaskAsynchronously(eq(plugin), any(Runnable.class))).thenAnswer((Answer<BukkitTask>) invocation -> {
@ -316,6 +319,7 @@ public class BlueprintsManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintsManager#loadBlueprints(world.bentobox.bentobox.api.addons.GameModeAddon)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintsManager#loadBlueprints(world.bentobox.bentobox.api.addons.GameModeAddon)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testLoadBlueprints() { public void testLoadBlueprints() {
// Set up running and verification // Set up running and verification
when(scheduler.runTaskAsynchronously(eq(plugin), any(Runnable.class))).thenAnswer((Answer<BukkitTask>) invocation -> { when(scheduler.runTaskAsynchronously(eq(plugin), any(Runnable.class))).thenAnswer((Answer<BukkitTask>) invocation -> {
@ -348,6 +352,7 @@ public class BlueprintsManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintsManager#saveBlueprint(world.bentobox.bentobox.api.addons.GameModeAddon, world.bentobox.bentobox.blueprints.Blueprint)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintsManager#saveBlueprint(world.bentobox.bentobox.api.addons.GameModeAddon, world.bentobox.bentobox.blueprints.Blueprint)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testSaveBlueprint() { public void testSaveBlueprint() {
// Save it // Save it
BlueprintsManager bpm = new BlueprintsManager(plugin); BlueprintsManager bpm = new BlueprintsManager(plugin);
@ -645,6 +650,7 @@ public class BlueprintsManagerTest {
* Test method for {@link world.bentobox.bentobox.managers.BlueprintsManager#renameBlueprint(world.bentobox.bentobox.api.addons.GameModeAddon, world.bentobox.bentobox.blueprints.Blueprint, java.lang.String, java.lang.String)}. * Test method for {@link world.bentobox.bentobox.managers.BlueprintsManager#renameBlueprint(world.bentobox.bentobox.api.addons.GameModeAddon, world.bentobox.bentobox.blueprints.Blueprint, java.lang.String, java.lang.String)}.
*/ */
@Test @Test
@Ignore("Enums")
public void testRenameBlueprint() { public void testRenameBlueprint() {
// Save it // Save it
BlueprintsManager bpm = new BlueprintsManager(plugin); BlueprintsManager bpm = new BlueprintsManager(plugin);

View File

@ -6,6 +6,7 @@ import static org.mockito.Mockito.when;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -26,6 +27,7 @@ import world.bentobox.bentobox.util.DeleteIslandChunks;
*/ */
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({BentoBox.class, Bukkit.class, DeleteIslandChunks.class}) @PrepareForTest({BentoBox.class, Bukkit.class, DeleteIslandChunks.class})
@Ignore("NMS")
public class IslandChunkDeletionManagerTest { public class IslandChunkDeletionManagerTest {
@Mock @Mock

View File

@ -49,6 +49,7 @@ import world.bentobox.bentobox.util.Util;
*/ */
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest( { Bukkit.class, BentoBox.class, Util.class, Location.class }) @PrepareForTest( { Bukkit.class, BentoBox.class, Util.class, Location.class })
@Ignore("NMS")
public class IslandDeletionManagerTest { public class IslandDeletionManagerTest {
@Mock @Mock

View File

@ -45,6 +45,7 @@ import org.bukkit.util.Vector;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
@ -73,6 +74,7 @@ import world.bentobox.bentobox.util.Util;
*/ */
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({ Bukkit.class, BentoBox.class, User.class, Util.class, Logger.class, DatabaseSetup.class }) @PrepareForTest({ Bukkit.class, BentoBox.class, User.class, Util.class, Logger.class, DatabaseSetup.class })
@Ignore("Enums")
public class PlayersManagerTest { public class PlayersManagerTest {
private static AbstractDatabaseHandler<Object> handler; private static AbstractDatabaseHandler<Object> handler;
@ -178,7 +180,7 @@ public class PlayersManagerTest {
when(p.getUniqueId()).thenReturn(uuid); when(p.getUniqueId()).thenReturn(uuid);
AttributeInstance at = mock(AttributeInstance.class); AttributeInstance at = mock(AttributeInstance.class);
when(at.getValue()).thenReturn(20D); when(at.getValue()).thenReturn(20D);
when(p.getAttribute(Attribute.GENERIC_MAX_HEALTH)).thenReturn(at); when(p.getAttribute(Attribute.MAX_HEALTH)).thenReturn(at);
when(p.getName()).thenReturn("tastybento"); when(p.getName()).thenReturn("tastybento");
User.getInstance(p); User.getInstance(p);