Merge branch 'bleeding' of github.com:garbagemule/MobArena into bleeding

This commit is contained in:
garbagemule
2014-07-24 05:00:05 +02:00
3 changed files with 30 additions and 11 deletions
+1 -1
View File
@@ -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.3
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault] softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
commands: commands:
ma: ma:
+2 -1
View File
@@ -1041,7 +1041,8 @@ public class ArenaImpl implements Arena
PlayerData mp = playerData.remove(p); PlayerData mp = playerData.remove(p);
// Health must be handled in a certain way because of Heroes // Health must be handled in a certain way because of Heroes
setHealth(p, mp.health()); // Math.min to guard for ItemLoreStats weirdness
setHealth(p, Math.min(p.getMaxHealth(), mp.health()));
// Put out fire. // Put out fire.
Delays.douse(plugin, p, 3); Delays.douse(plugin, p, 3);
@@ -776,20 +776,38 @@ 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 a potion has harmful effects, remove all players. if (potion.getShooter() instanceof Player) {
for (PotionEffect effect : potion.getEffects()) { // Check for PvP stuff if the shooter is a player
PotionEffectType type = effect.getType(); if (!pvpEnabled) {
if (type.equals(PotionEffectType.HARM) || type.equals(PotionEffectType.POISON)) { // If a potion has harmful effects, remove all players.
for (LivingEntity le : event.getAffectedEntities()) { for (PotionEffect effect : potion.getEffects()) {
if (le instanceof Player) { PotionEffectType type = effect.getType();
event.setIntensity(le, 0.0); if (type.equals(PotionEffectType.HARM) || type.equals(PotionEffectType.POISON)) {
for (LivingEntity le : event.getAffectedEntities()) {
if (le instanceof Player) {
event.setIntensity(le, 0.0);
}
}
break;
} }
} }
break; }
} 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;
}
} }
} }
} }