use of org.bukkit.entity.Projectile in project AuthMeReloaded by AuthMe.
the class EntityListenerTest method shouldRejectProjectileLaunchFromUnauthed.
@Test
public void shouldRejectProjectileLaunchFromUnauthed() {
// given
Projectile projectile = mock(Projectile.class);
Player player = mock(Player.class);
given(projectile.getShooter()).willReturn(player);
ProjectileLaunchEvent event = mock(ProjectileLaunchEvent.class);
given(event.getEntity()).willReturn(projectile);
given(listenerService.shouldCancelEvent(player)).willReturn(true);
// when
listener.onProjectileLaunch(event);
// then
verify(listenerService).shouldCancelEvent(player);
verify(event).setCancelled(true);
}
Aggregations