mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-01-28 19:21:21 +01:00
Make harmful potions obey the pvp-enabled setting.
This commit is contained in:
parent
fba31d26a4
commit
2adf1678cc
BIN
MobArena.jar
BIN
MobArena.jar
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
name: MobArena
|
name: MobArena
|
||||||
author: garbagemule
|
author: garbagemule
|
||||||
main: com.garbagemule.MobArena.MobArena
|
main: com.garbagemule.MobArena.MobArena
|
||||||
version: 0.94.4.55
|
version: 0.94.4.56
|
||||||
softdepend: [Spout,MultiVerse,XcraftGate,Towny,Heroes,MagicSpells,Vault]
|
softdepend: [Spout,MultiVerse,XcraftGate,Towny,Heroes,MagicSpells,Vault]
|
||||||
commands:
|
commands:
|
||||||
ma:
|
ma:
|
||||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.entity.Slime;
|
import org.bukkit.entity.Slime;
|
||||||
|
import org.bukkit.entity.ThrownPotion;
|
||||||
import org.bukkit.entity.Wolf;
|
import org.bukkit.entity.Wolf;
|
||||||
import org.bukkit.event.Event.Result;
|
import org.bukkit.event.Event.Result;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
@ -40,6 +41,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
|
|||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.entity.EntityTeleportEvent;
|
import org.bukkit.event.entity.EntityTeleportEvent;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
|
import org.bukkit.event.entity.PotionSplashEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
@ -59,6 +61,8 @@ import org.bukkit.material.Attachable;
|
|||||||
import org.bukkit.material.Bed;
|
import org.bukkit.material.Bed;
|
||||||
import org.bukkit.material.Door;
|
import org.bukkit.material.Door;
|
||||||
import org.bukkit.material.Redstone;
|
import org.bukkit.material.Redstone;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import com.garbagemule.MobArena.MAUtils;
|
import com.garbagemule.MobArena.MAUtils;
|
||||||
import com.garbagemule.MobArena.MobArena;
|
import com.garbagemule.MobArena.MobArena;
|
||||||
@ -544,6 +548,24 @@ public class ArenaListener
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onPotionSplash(PotionSplashEvent event) {
|
||||||
|
ThrownPotion potion = event.getPotion();
|
||||||
|
if (!region.contains(potion.getLocation()) || pvpEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If a potion has harmful effects, remove all players.
|
||||||
|
for (PotionEffect effect : potion.getEffects()) {
|
||||||
|
PotionEffectType type = effect.getType();
|
||||||
|
if (type.equals(PotionEffectType.HARM) || type.equals(PotionEffectType.POISON)) {
|
||||||
|
for (Player p : arena.getPlayersInArena()) {
|
||||||
|
event.setIntensity(p, 0D);
|
||||||
|
}
|
||||||
|
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()))
|
||||||
|
@ -172,6 +172,13 @@ public class MAGlobalListener implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
public void potionSplash(PotionSplashEvent event) {
|
||||||
|
for (Arena arena : am.getArenas()) {
|
||||||
|
arena.getEventListener().onPotionSplash(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user