Search in sources :

Example 26 with Location

use of org.bukkit.Location in project AuthMeReloaded by AuthMe.

the class SetFirstSpawnCommandTest method shouldSetFirstSpawn.

@Test
public void shouldSetFirstSpawn() {
    // given
    Player player = mock(Player.class);
    Location location = mock(Location.class);
    given(player.getLocation()).willReturn(location);
    given(spawnLoader.setFirstSpawn(location)).willReturn(true);
    // when
    command.executeCommand(player, Collections.emptyList());
    // then
    verify(spawnLoader).setFirstSpawn(location);
    verify(player).sendMessage(argThat(containsString("defined new first spawn")));
}
Also used : Player(org.bukkit.entity.Player) Location(org.bukkit.Location) Test(org.junit.Test)

Example 27 with Location

use of org.bukkit.Location in project AuthMeReloaded by AuthMe.

the class SetSpawnCommandTest method shouldHandleError.

@Test
public void shouldHandleError() {
    // given
    Player player = mock(Player.class);
    Location location = mock(Location.class);
    given(player.getLocation()).willReturn(location);
    given(spawnLoader.setSpawn(location)).willReturn(false);
    // when
    command.executeCommand(player, Collections.emptyList());
    // then
    verify(spawnLoader).setSpawn(location);
    verify(player).sendMessage(argThat(containsString("has failed")));
}
Also used : Player(org.bukkit.entity.Player) Location(org.bukkit.Location) Test(org.junit.Test)

Example 28 with Location

use of org.bukkit.Location in project AuthMeReloaded by AuthMe.

the class SpawnCommandTest method shouldTeleportToSpawn.

@Test
public void shouldTeleportToSpawn() {
    // given
    Location spawn = mock(Location.class);
    given(spawnLoader.getSpawn()).willReturn(spawn);
    Player player = mock(Player.class);
    // when
    command.executeCommand(player, Collections.emptyList());
    // then
    verify(player).teleport(spawn);
    verify(spawnLoader, atLeastOnce()).getSpawn();
}
Also used : Player(org.bukkit.entity.Player) Location(org.bukkit.Location) Test(org.junit.Test)

Example 29 with Location

use of org.bukkit.Location in project AuthMeReloaded by AuthMe.

the class PluginHookServiceTest method shouldGetMultiverseSpawn.

@Test
public void shouldGetMultiverseSpawn() {
    // given
    Location location = mock(Location.class);
    MultiverseWorld multiverseWorld = mock(MultiverseWorld.class);
    given(multiverseWorld.getSpawnLocation()).willReturn(location);
    World world = mock(World.class);
    MVWorldManager mvWorldManager = mock(MVWorldManager.class);
    given(mvWorldManager.isMVWorld(world)).willReturn(true);
    given(mvWorldManager.getMVWorld(world)).willReturn(multiverseWorld);
    MultiverseCore multiverse = mock(MultiverseCore.class);
    given(multiverse.getMVWorldManager()).willReturn(mvWorldManager);
    PluginManager pluginManager = mock(PluginManager.class);
    setPluginAvailable(pluginManager, MULTIVERSE, multiverse);
    PluginHookService pluginHookService = new PluginHookService(pluginManager);
    // when
    Location spawn = pluginHookService.getMultiverseSpawn(world);
    // then
    assertThat(spawn, equalTo(location));
    verify(mvWorldManager).isMVWorld(world);
    verify(mvWorldManager).getMVWorld(world);
    verify(multiverseWorld).getSpawnLocation();
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) MultiverseWorld(com.onarandombox.MultiverseCore.api.MultiverseWorld) MultiverseCore(com.onarandombox.MultiverseCore.MultiverseCore) MVWorldManager(com.onarandombox.MultiverseCore.api.MVWorldManager) World(org.bukkit.World) MultiverseWorld(com.onarandombox.MultiverseCore.api.MultiverseWorld) Location(org.bukkit.Location) Test(org.junit.Test)

Example 30 with Location

use of org.bukkit.Location in project AuthMeReloaded by AuthMe.

the class PluginHookServiceTest method shouldReturnNullForUnavailableMultiverse.

@Test
public void shouldReturnNullForUnavailableMultiverse() {
    // given
    PluginManager pluginManager = mock(PluginManager.class);
    PluginHookService pluginHookService = new PluginHookService(pluginManager);
    World world = mock(World.class);
    // when
    Location result = pluginHookService.getMultiverseSpawn(world);
    // then
    assertThat(result, nullValue());
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) World(org.bukkit.World) MultiverseWorld(com.onarandombox.MultiverseCore.api.MultiverseWorld) Location(org.bukkit.Location) Test(org.junit.Test)

Aggregations

Location (org.bukkit.Location)351 Player (org.bukkit.entity.Player)90 World (org.bukkit.World)56 EventHandler (org.bukkit.event.EventHandler)43 Test (org.junit.Test)43 Vector (org.bukkit.util.Vector)38 ArrayList (java.util.ArrayList)29 Block (org.bukkit.block.Block)18 Entity (org.bukkit.entity.Entity)17 User (com.earth2me.essentials.User)16 ItemStack (org.bukkit.inventory.ItemStack)15 PlayerAuth (fr.xephi.authme.data.auth.PlayerAuth)14 LimboPlayer (fr.xephi.authme.data.limbo.LimboPlayer)14 net.aufdemrand.denizen.objects.dLocation (net.aufdemrand.denizen.objects.dLocation)14 List (java.util.List)12 NotRegisteredException (com.palmergames.bukkit.towny.exceptions.NotRegisteredException)11 BlockState (org.bukkit.block.BlockState)11 UUID (java.util.UUID)10 LivingEntity (org.bukkit.entity.LivingEntity)10 MinigamePlayer (au.com.mineauz.minigames.MinigamePlayer)9