org.bukkit.TravelAgent Java Examples
The following examples show how to use
org.bukkit.TravelAgent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityPortalEventListenerTest.java From PerWorldInventory with GNU General Public License v3.0 | 6 votes |
@Test public void shouldTeleportBecauseSameGroup() { // given Group group = mockGroup("test_group", GameMode.SURVIVAL, false); Item entity = mock(Item.class); World world = mock(World.class); given(world.getName()).willReturn("test_group"); Location from = new Location(world, 1, 2, 3); World worldNether = mock(World.class); given(worldNether.getName()).willReturn("test_group_nether"); Location to = new Location(worldNether, 1, 2, 3); given(groupManager.getGroupFromWorld("test_group")).willReturn(group); given(groupManager.getGroupFromWorld("test_group_nether")).willReturn(group); EntityPortalEvent event = new EntityPortalEvent(entity, from, to, mock(TravelAgent.class)); // when listener.onEntityPortalTeleport(event); // then assertThat(event.isCancelled(), equalTo(false)); }
Example #2
Source File: EntityPortalEventListenerTest.java From PerWorldInventory with GNU General Public License v3.0 | 6 votes |
@Test public void shouldTeleportBecauseNotItem() { // given Pig entity = mock(Pig.class); World world = mock(World.class); Location from = new Location(world, 1, 2, 3); World worldNether = mock(World.class); Location to = new Location(worldNether, 1, 2, 3); EntityPortalEvent event = new EntityPortalEvent(entity, from, to, mock(TravelAgent.class)); // when listener.onEntityPortalTeleport(event); // then assertThat(event.isCancelled(), equalTo(false)); }
Example #3
Source File: EntityPortalEventListenerTest.java From PerWorldInventory with GNU General Public License v3.0 | 6 votes |
@Test public void shouldTeleportBecauseSameGroup() { // given Group group = mockGroup("test_group", GameMode.SURVIVAL, false); Item entity = mock(Item.class); World world = mock(World.class); given(world.getName()).willReturn("test_group"); Location from = new Location(world, 1, 2, 3); World worldNether = mock(World.class); given(worldNether.getName()).willReturn("test_group_nether"); Location to = new Location(worldNether, 1, 2, 3); given(groupManager.getGroupFromWorld("test_group")).willReturn(group); given(groupManager.getGroupFromWorld("test_group_nether")).willReturn(group); EntityPortalEvent event = new EntityPortalEvent(entity, from, to, mock(TravelAgent.class)); // when listener.onEntityPortalTeleport(event); // then assertThat(event.isCancelled(), equalTo(false)); }
Example #4
Source File: EntityPortalEventListenerTest.java From PerWorldInventory with GNU General Public License v3.0 | 6 votes |
@Test public void shouldTeleportBecauseNotItem() { // given Pig entity = mock(Pig.class); World world = mock(World.class); Location from = new Location(world, 1, 2, 3); World worldNether = mock(World.class); Location to = new Location(worldNether, 1, 2, 3); EntityPortalEvent event = new EntityPortalEvent(entity, from, to, mock(TravelAgent.class)); // when listener.onEntityPortalTeleport(event); // then assertThat(event.isCancelled(), equalTo(false)); }
Example #5
Source File: EntityPortalEventListenerTest.java From PerWorldInventory with GNU General Public License v3.0 | 5 votes |
@Test public void shouldNotTeleportBecauseDifferentGroups() { // given Group group = mockGroup("test_group", GameMode.SURVIVAL, false); Group otherGroup = mockGroup("other_group", GameMode.SURVIVAL, false); Item entity = mock(Item.class); World world = mock(World.class); given(world.getName()).willReturn("test_group"); Location from = new Location(world, 1, 2, 3); World worldNether = mock(World.class); given(worldNether.getName()).willReturn("other_group_nether"); Location to = new Location(worldNether, 1, 2, 3); given(groupManager.getGroupFromWorld("test_group")).willReturn(group); given(groupManager.getGroupFromWorld("other_group_nether")).willReturn(otherGroup); EntityPortalEvent event = new EntityPortalEvent(entity, from, to, mock(TravelAgent.class)); // when listener.onEntityPortalTeleport(event); // then assertThat(event.isCancelled(), equalTo(true)); }
Example #6
Source File: EntityPortalEventListenerTest.java From PerWorldInventory with GNU General Public License v3.0 | 5 votes |
@Test public void shouldNotTeleportBecauseDifferentGroups() { // given Group group = mockGroup("test_group", GameMode.SURVIVAL, false); Group otherGroup = mockGroup("other_group", GameMode.SURVIVAL, false); Item entity = mock(Item.class); World world = mock(World.class); given(world.getName()).willReturn("test_group"); Location from = new Location(world, 1, 2, 3); World worldNether = mock(World.class); given(worldNether.getName()).willReturn("other_group_nether"); Location to = new Location(worldNether, 1, 2, 3); given(groupManager.getGroupFromWorld("test_group")).willReturn(group); given(groupManager.getGroupFromWorld("other_group_nether")).willReturn(otherGroup); EntityPortalEvent event = new EntityPortalEvent(entity, from, to, mock(TravelAgent.class)); // when listener.onEntityPortalTeleport(event); // then assertThat(event.isCancelled(), equalTo(true)); }
Example #7
Source File: CraftTravelAgent.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public TravelAgent setCreationRadius(int radius) { this.creationRadius = radius < 2 ? 0 : radius; return this; }
Example #8
Source File: CraftTravelAgent.java From Thermos with GNU General Public License v3.0 | 4 votes |
public TravelAgent setCreationRadius(int radius) { this.creationRadius = radius < 2 ? 0 : radius; return this; }
Example #9
Source File: CraftTravelAgent.java From Thermos with GNU General Public License v3.0 | 4 votes |
public TravelAgent setSearchRadius(int radius) { this.searchRadius = radius; return this; }
Example #10
Source File: EntityPortalEvent.java From Kettle with GNU General Public License v3.0 | 4 votes |
public EntityPortalEvent(final Entity entity, final Location from, final Location to, final TravelAgent pta) { super(entity, from, to); this.travelAgent = pta; }
Example #11
Source File: CraftTravelAgent.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public TravelAgent setSearchRadius(int radius) { this.searchRadius = radius; return this; }
Example #12
Source File: PlayerPortalEvent.java From Kettle with GNU General Public License v3.0 | 4 votes |
public PlayerPortalEvent(Player player, Location from, Location to, TravelAgent pta, TeleportCause cause) { super(player, from, to, cause); this.travelAgent = pta; }
Example #13
Source File: PlayerPortalEvent.java From Kettle with GNU General Public License v3.0 | 4 votes |
public PlayerPortalEvent(final Player player, final Location from, final Location to, final TravelAgent pta) { super(player, from, to); this.travelAgent = pta; }
Example #14
Source File: PlayerPortalEvent.java From Kettle with GNU General Public License v3.0 | 2 votes |
/** * Sets the Travel Agent used (or not) in this event. * * @param travelAgent the Travel Agent used (or not) in this event */ public void setPortalTravelAgent(TravelAgent travelAgent) { this.travelAgent = travelAgent; }
Example #15
Source File: PlayerPortalEvent.java From Kettle with GNU General Public License v3.0 | 2 votes |
/** * Gets the Travel Agent used (or not) in this event. * * @return the Travel Agent used (or not) in this event */ public TravelAgent getPortalTravelAgent() { return this.travelAgent; }
Example #16
Source File: EntityPortalEvent.java From Kettle with GNU General Public License v3.0 | 2 votes |
/** * Sets the Travel Agent used (or not) in this event. * * @param travelAgent the Travel Agent used (or not) in this event */ public void setPortalTravelAgent(TravelAgent travelAgent) { this.travelAgent = travelAgent; }
Example #17
Source File: EntityPortalEvent.java From Kettle with GNU General Public License v3.0 | 2 votes |
/** * Gets the Travel Agent used (or not) in this event. * * @return the Travel Agent used (or not) in this event */ public TravelAgent getPortalTravelAgent() { return this.travelAgent; }