Forgot to remove the debug messages from the last change
This commit is contained in:
parent
1e38bd6b29
commit
6bd9bddd8d
@ -41,7 +41,6 @@ public class OnEntityDamageByEntityEvent implements Listener {
|
||||
Player damager = null;
|
||||
if (event.getDamager() instanceof Player) {
|
||||
damager = (Player) event.getDamager();
|
||||
System.out.println("[DEBUG] EntityDamageByEntity: Player = " + player.getName() + " / Damager = " + damager.getName() + " / Cause = " + event.getCause());
|
||||
} else {
|
||||
if ((event.getCause() == DamageCause.PROJECTILE) && (event.getDamager() instanceof Arrow)) {
|
||||
// If damage was caused by an arrow, find out who shot the arrow
|
||||
@ -51,13 +50,11 @@ public class OnEntityDamageByEntityEvent implements Listener {
|
||||
damager = (Player) shooter;
|
||||
}
|
||||
}
|
||||
System.out.println("[DEBUG] EntityDamageByEntity: Player = " + player.getName() + " / Damager = " + event.getDamager() + " / Cause = " + event.getCause());
|
||||
}
|
||||
|
||||
// Always block all damage not dealt by a player
|
||||
if (damager == null || !(damager instanceof Player)) {
|
||||
event.setCancelled(true);
|
||||
System.out.println("[DEBUG] EntityDamageByEntity: isCancelled = " + event.isCancelled());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -66,7 +63,6 @@ public class OnEntityDamageByEntityEvent implements Listener {
|
||||
if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) {
|
||||
// Always cancel damage when players are waiting
|
||||
event.setCancelled(true);
|
||||
System.out.println("[DEBUG] EntityDamageByEntity: isCancelled = " + event.isCancelled());
|
||||
return;
|
||||
} else {
|
||||
// Seeker receiving damage
|
||||
@ -75,29 +71,24 @@ public class OnEntityDamageByEntityEvent implements Listener {
|
||||
// Seeker damaged by seeker
|
||||
if (!arena.seekersCanHurtSeekers) {
|
||||
event.setCancelled(true);
|
||||
System.out.println("[DEBUG] EntityDamageByEntity: isCancelled = " + event.isCancelled());
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Seeker damaged by hider
|
||||
if (!arena.hidersCanHurtSeekers) {
|
||||
event.setCancelled(true);
|
||||
System.out.println("[DEBUG] EntityDamageByEntity: isCancelled = " + event.isCancelled());
|
||||
return;
|
||||
}
|
||||
}
|
||||
event.setCancelled(true);
|
||||
System.out.println("[DEBUG] EntityDamageByEntity: isCancelled = " + event.isCancelled());
|
||||
return;
|
||||
} else {
|
||||
// Hider damaged by hider
|
||||
if (!arena.hidersCanHurtHiders && !arena.seekers.contains(damager)) {
|
||||
event.setCancelled(true);
|
||||
System.out.println("[DEBUG] EntityDamageByEntity: isCancelled = " + event.isCancelled());
|
||||
return;
|
||||
}
|
||||
}
|
||||
System.out.println("[DEBUG] EntityDamageByEntity: isCancelled = " + event.isCancelled());
|
||||
|
||||
// The damage is allowed, so lets handle it!
|
||||
player.getWorld().playSound(player.getLocation(), Sound.HURT_FLESH, 1, 1);
|
||||
@ -105,7 +96,6 @@ public class OnEntityDamageByEntityEvent implements Listener {
|
||||
if (event.getDamage() >= player.getHealth()) {
|
||||
player.setHealth(20);
|
||||
event.setCancelled(true);
|
||||
System.out.println("[DEBUG] EntityDamageByEntity: isCancelled = " + event.isCancelled() + "(handling fake damage)");
|
||||
|
||||
DisguiseAPI.undisguiseToAll(player);
|
||||
W.pBlock.remove(player);
|
||||
|
@ -25,7 +25,6 @@ public class OnEntityDamageEvent implements Listener {
|
||||
for (Arena arena : W.arenaList) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
DamageCause cause = event.getCause();
|
||||
System.out.println("[DEBUG] EntityDamage: Player = " + player.getName() + " / Cause = " + cause);
|
||||
switch (cause) {
|
||||
case ENTITY_ATTACK:
|
||||
// Do nothing about damage from an entity
|
||||
@ -37,14 +36,12 @@ public class OnEntityDamageEvent implements Listener {
|
||||
if (!arena.seekersTakeFallDamage) {
|
||||
// Prevent seeker fall damage (if configured)
|
||||
event.setCancelled(true);
|
||||
System.out.println("[DEBUG] EntityDamage: isCancelled = " + event.isCancelled());
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!arena.hidersTakeFallDamage) {
|
||||
// Prevent hider fall damage (if configured)
|
||||
event.setCancelled(true);
|
||||
System.out.println("[DEBUG] EntityDamage: isCancelled = " + event.isCancelled());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -52,10 +49,8 @@ public class OnEntityDamageEvent implements Listener {
|
||||
default:
|
||||
// Cancel all non-entity damage for all players (lava, drowning, fire, etc)
|
||||
event.setCancelled(true);
|
||||
System.out.println("[DEBUG] EntityDamage: isCancelled = " + event.isCancelled());
|
||||
break;
|
||||
}
|
||||
System.out.println("[DEBUG] EntityDamage: isCancelled = " + event.isCancelled());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user