Fully support wither blocking in protect

This commit is contained in:
Iaccidentally 2012-10-28 12:53:12 -04:00
parent 4a18130354
commit 91c193b773
3 changed files with 29 additions and 0 deletions

View file

@ -460,6 +460,9 @@ protect:
fireball-explosion: false
fireball-fire: false
fireball-playerdamage: false
witherskull-explosion: flase
witherskull-playerdamage: false
witherskull-spawnexplosion: flase
creeper-explosion: false
creeper-playerdamage: false
creeper-blockdamage: false

View file

@ -114,6 +114,16 @@ public class EssentialsProtectEntityListener implements Listener
event.setCancelled(true);
return;
}
if ((event.getEntity() instanceof WitherSkull
&& prot.getSettingBool(ProtectConfig.prevent_witherskull_playerdmg)
&& !(target instanceof Player
&& user.isAuthorized("essentials.protect.damage.witherskull")
&& !user.isAuthorized("essentials.protect.damage.disable"))))
{
event.setCancelled(true);
return;
}
if (eAttack instanceof TNTPrimed && prot.getSettingBool(ProtectConfig.prevent_tnt_playerdmg)
&& !(target instanceof Player
@ -214,6 +224,12 @@ public class EssentialsProtectEntityListener implements Listener
}
return;
}
if (event.getEntity() instanceof WitherSkull
&& prot.getSettingBool(ProtectConfig.prevent_witherskull_spawnexplosion))
{
event.setCancelled(true);
return;
}
else if (event.getEntity() instanceof Creeper
&& (prot.getSettingBool(ProtectConfig.prevent_creeper_explosion)
|| prot.getSettingBool(ProtectConfig.prevent_creeper_blockdmg)
@ -236,6 +252,13 @@ public class EssentialsProtectEntityListener implements Listener
event.setCancelled(true);
return;
}
else if ((event.getEntity() instanceof WitherSkull)
&& prot.getSettingBool(ProtectConfig.prevent_witherskull_explosion))
{
event.setCancelled(true);
return;
}
// This code will prevent explosions near protected rails, signs or protected chests
// TODO: Use protect db instead of this code

View file

@ -35,6 +35,9 @@ public enum ProtectConfig
prevent_fireball_explosion("protect.prevent.fireball-explosion", false),
prevent_fireball_fire("protect.prevent.fireball-fire", false),
prevent_fireball_playerdmg("protect.prevent.fireball-playerdamage", false),
prevent_witherskull_explosion("protect.prevent.witherskull-explosion", false),
prevent_witherskull_playerdmg("protect.prevent.witherskull-playerdamage", false),
prevent_witherskull_spawnexplosion("protect.prevent.witherskull-spawnexplosion", false),
prevent_creeper_explosion("protect.prevent.creeper-explosion", true),
prevent_creeper_playerdmg("protect.prevent.creeper-playerdamage", false),
prevent_creeper_blockdmg("protect.prevent.creeper-blockdamage", false),