mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-27 05:05:18 +01:00
Citizen NPCs are not island visitors so do not protect them.
https://github.com/BentoBoxWorld/BentoBox/issues/1518
This commit is contained in:
parent
5a5435d815
commit
4609881542
@ -103,6 +103,7 @@ public class InvincibleVisitorsListener extends FlagListener implements ClickHan
|
||||
World world = e.getEntity().getWorld();
|
||||
if (!(e.getEntity() instanceof Player)
|
||||
|| !getIWM().inWorld(world)
|
||||
|| e.getEntity().hasMetadata("NPC")
|
||||
|| !getIWM().getIvSettings(world).contains(e.getCause().name())
|
||||
|| getIslands().userIsOnIsland(world, User.getInstance(e.getEntity()))) {
|
||||
return;
|
||||
|
@ -256,6 +256,14 @@ public class InvincibleVisitorsListenerTest {
|
||||
verify(player, never()).setGameMode(eq(GameMode.SPECTATOR));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnVisitorGetDamageNPC() {
|
||||
when(player.hasMetadata(eq("NPC"))).thenReturn(true);
|
||||
EntityDamageEvent e = new EntityDamageEvent(player, EntityDamageEvent.DamageCause.CRAMMING, 0D);
|
||||
listener.onVisitorGetDamage(e);
|
||||
assertFalse(e.isCancelled());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testOnVisitorGetDamageVoidIslandHere() {
|
||||
|
Loading…
Reference in New Issue
Block a user