Search in sources :

Example 1 with PlayerMock

use of be.seeseemelk.mockbukkit.entity.PlayerMock in project IridiumSkyblock by Iridium-Development.

the class CreateCommandTest method executeWithName.

@Test
public void executeWithName() {
    PlayerMock playerMock = new UserBuilder(serverMock).buildPlayer();
    serverMock.dispatchCommand(playerMock, "is create IslandName");
    assertTrue(playerMock.getOpenInventory().getTopInventory().getHolder() instanceof IslandCreateGUI);
    IslandCreateGUI islandCreateGUI = (IslandCreateGUI) playerMock.getOpenInventory().getTopInventory().getHolder();
    assertEquals("IslandName", islandCreateGUI.getIslandName());
}
Also used : IslandCreateGUI(com.iridium.iridiumskyblock.gui.IslandCreateGUI) PlayerMock(be.seeseemelk.mockbukkit.entity.PlayerMock) UserBuilder(com.iridium.iridiumskyblock.UserBuilder) Test(org.junit.jupiter.api.Test)

Example 2 with PlayerMock

use of be.seeseemelk.mockbukkit.entity.PlayerMock in project IridiumSkyblock by Iridium-Development.

the class CreateCommandTest method executeWithExistingIslandName.

@Test
public void executeWithExistingIslandName() {
    new IslandBuilder("IslandName").build();
    PlayerMock playerMock = new UserBuilder(serverMock).buildPlayer();
    serverMock.dispatchCommand(playerMock, "is create IslandName " + TestingHelper.getSchematicKey());
    playerMock.assertSaid(StringUtils.color(IridiumSkyblock.getInstance().getMessages().islandWithNameAlreadyExists.replace("%prefix%", IridiumSkyblock.getInstance().getConfiguration().prefix)));
}
Also used : PlayerMock(be.seeseemelk.mockbukkit.entity.PlayerMock) IslandBuilder(com.iridium.iridiumskyblock.IslandBuilder) UserBuilder(com.iridium.iridiumskyblock.UserBuilder) Test(org.junit.jupiter.api.Test)

Example 3 with PlayerMock

use of be.seeseemelk.mockbukkit.entity.PlayerMock in project IridiumSkyblock by Iridium-Development.

the class IslandManagerTest method teleportOtherIslandHomePublic.

@Test
public void teleportOtherIslandHomePublic() {
    Island island = new IslandBuilder().build();
    PlayerMock player = new UserBuilder(serverMock).buildPlayer();
    IridiumSkyblock.getInstance().getIslandManager().teleportHome(player, island, 0);
    assertEquals(island.getHome(), player.getLocation());
    player.assertSaid(StringUtils.color(IridiumSkyblock.getInstance().getMessages().teleportingHomeOther.replace("%prefix%", IridiumSkyblock.getInstance().getConfiguration().prefix).replace("%owner%", island.getOwner().getName())));
}
Also used : PlayerMock(be.seeseemelk.mockbukkit.entity.PlayerMock) IslandBuilder(com.iridium.iridiumskyblock.IslandBuilder) UserBuilder(com.iridium.iridiumskyblock.UserBuilder) Test(org.junit.jupiter.api.Test)

Example 4 with PlayerMock

use of be.seeseemelk.mockbukkit.entity.PlayerMock in project IridiumSkyblock by Iridium-Development.

the class IslandManagerTest method teleportOtherIslandHomeTrusted.

@Test
public void teleportOtherIslandHomeTrusted() {
    Island island = new IslandBuilder().build();
    PlayerMock player = new UserBuilder(serverMock).buildPlayer();
    User user = IridiumSkyblock.getInstance().getUserManager().getUser(player);
    island.setVisitable(false);
    IridiumSkyblock.getInstance().getDatabaseManager().getIslandTrustedTableManager().addEntry(new IslandTrusted(island, user, user));
    IridiumSkyblock.getInstance().getIslandManager().teleportHome(player, island, 0);
    assertEquals(island.getHome(), player.getLocation());
    player.assertSaid(StringUtils.color(IridiumSkyblock.getInstance().getMessages().teleportingHomeOther.replace("%prefix%", IridiumSkyblock.getInstance().getConfiguration().prefix).replace("%owner%", island.getOwner().getName())));
}
Also used : PlayerMock(be.seeseemelk.mockbukkit.entity.PlayerMock) IslandBuilder(com.iridium.iridiumskyblock.IslandBuilder) UserBuilder(com.iridium.iridiumskyblock.UserBuilder) Test(org.junit.jupiter.api.Test)

Example 5 with PlayerMock

use of be.seeseemelk.mockbukkit.entity.PlayerMock in project IridiumSkyblock by Iridium-Development.

the class IslandManagerTest method teleportIslandHomePrivate.

@Test
public void teleportIslandHomePrivate() {
    Island island = new IslandBuilder().build();
    PlayerMock player = new UserBuilder(serverMock).buildPlayer();
    island.setVisitable(false);
    IridiumSkyblock.getInstance().getIslandManager().teleportHome(player, island, 0);
    assertNotEquals(island.getHome(), player.getLocation());
    player.assertSaid(StringUtils.color(IridiumSkyblock.getInstance().getMessages().islandIsPrivate.replace("%prefix%", IridiumSkyblock.getInstance().getConfiguration().prefix)));
}
Also used : PlayerMock(be.seeseemelk.mockbukkit.entity.PlayerMock) IslandBuilder(com.iridium.iridiumskyblock.IslandBuilder) UserBuilder(com.iridium.iridiumskyblock.UserBuilder) Test(org.junit.jupiter.api.Test)

Aggregations

PlayerMock (be.seeseemelk.mockbukkit.entity.PlayerMock)60 Test (org.junit.jupiter.api.Test)48 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)23 OfflinePlayerMock (be.seeseemelk.mockbukkit.entity.OfflinePlayerMock)18 UserBuilder (com.iridium.iridiumskyblock.UserBuilder)13 IslandBuilder (com.iridium.iridiumskyblock.IslandBuilder)9 DisplayName (org.junit.jupiter.api.DisplayName)9 SlimefunItemStack (io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack)4 SlimefunItemTest (io.github.thebusybiscuit.slimefun4.test.presets.SlimefunItemTest)4 ItemStack (org.bukkit.inventory.ItemStack)4 Location (org.bukkit.Location)3 Player (org.bukkit.entity.Player)3 ValueSource (org.junit.jupiter.params.provider.ValueSource)3 BlockMock (be.seeseemelk.mockbukkit.block.BlockMock)2 IslandCreateGUI (com.iridium.iridiumskyblock.gui.IslandCreateGUI)2 CustomItemStack (io.github.bakedlibs.dough.items.CustomItemStack)2 OfflinePlayer (org.bukkit.OfflinePlayer)2 Test (org.junit.Test)2 JoinCommand (au.com.mineauz.minigames.commands.JoinCommand)1 MinigamePlayer (au.com.mineauz.minigames.objects.MinigamePlayer)1