mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-23 19:16:41 +01:00
Make potion splash handling witch-aware.
This commit is contained in:
parent
6ae083c993
commit
5dc35728c1
@ -1,7 +1,7 @@
|
|||||||
name: MobArena
|
name: MobArena
|
||||||
author: garbagemule
|
author: garbagemule
|
||||||
main: com.garbagemule.MobArena.MobArena
|
main: com.garbagemule.MobArena.MobArena
|
||||||
version: 0.96.6.1
|
version: 0.96.6.2
|
||||||
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
|
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
|
||||||
commands:
|
commands:
|
||||||
ma:
|
ma:
|
||||||
|
@ -776,10 +776,13 @@ public class ArenaListener
|
|||||||
|
|
||||||
public void onPotionSplash(PotionSplashEvent event) {
|
public void onPotionSplash(PotionSplashEvent event) {
|
||||||
ThrownPotion potion = event.getPotion();
|
ThrownPotion potion = event.getPotion();
|
||||||
if (!region.contains(potion.getLocation()) || pvpEnabled) {
|
if (!region.contains(potion.getLocation())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (potion.getShooter() instanceof Player) {
|
||||||
|
// Check for PvP stuff if the shooter is a player
|
||||||
|
if (!pvpEnabled) {
|
||||||
// If a potion has harmful effects, remove all players.
|
// If a potion has harmful effects, remove all players.
|
||||||
for (PotionEffect effect : potion.getEffects()) {
|
for (PotionEffect effect : potion.getEffects()) {
|
||||||
PotionEffectType type = effect.getType();
|
PotionEffectType type = effect.getType();
|
||||||
@ -793,6 +796,21 @@ public class ArenaListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (!monsterInfight) {
|
||||||
|
// Otherwise, check for monster infighting
|
||||||
|
for (PotionEffect effect : potion.getEffects()) {
|
||||||
|
PotionEffectType type = effect.getType();
|
||||||
|
if (type.equals(PotionEffectType.HARM) || type.equals(PotionEffectType.POISON)) {
|
||||||
|
for (LivingEntity le : event.getAffectedEntities()) {
|
||||||
|
if (!(le instanceof Player)) {
|
||||||
|
event.setIntensity(le, 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||||
if (arena.getRegion().contains(event.getBlock().getLocation()))
|
if (arena.getRegion().contains(event.getBlock().getLocation()))
|
||||||
|
Loading…
Reference in New Issue
Block a user