mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-02-04 22:41:23 +01:00
Added an option to block conduit effects
This commit is contained in:
parent
cd39387e7f
commit
9804c69044
@ -71,6 +71,7 @@ public abstract class WorldConfiguration {
|
||||
public boolean itemDurability;
|
||||
public boolean disableExpDrops;
|
||||
public boolean blockPotionsAlways;
|
||||
public boolean disableConduitEffects;
|
||||
public boolean pumpkinScuba;
|
||||
public boolean noPhysicsGravel;
|
||||
public boolean noPhysicsSand;
|
||||
|
@ -164,6 +164,7 @@ public void loadConfiguration() {
|
||||
}
|
||||
}
|
||||
blockPotionsAlways = getBoolean("gameplay.block-potions-overly-reliably", false);
|
||||
disableConduitEffects = getBoolean("gameplay.disable-conduit-effects", false);
|
||||
|
||||
simulateSponge = getBoolean("simulation.sponge.enable", false);
|
||||
spongeRadius = Math.max(1, getInt("simulation.sponge.radius", 3)) - 1;
|
||||
|
@ -26,6 +26,7 @@
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||
|
||||
public class WorldRulesListener extends AbstractListener {
|
||||
|
||||
@ -40,17 +41,24 @@ public WorldRulesListener(WorldGuardPlugin plugin) {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onSpawnEntity(final SpawnEntityEvent event) {
|
||||
WorldConfiguration config = getWorldConfig(BukkitAdapter.adapt(event.getWorld()));
|
||||
|
||||
// ================================================================
|
||||
// EXP_DROPS flag
|
||||
// ================================================================
|
||||
|
||||
if (event.getEffectiveType() == EntityType.EXPERIENCE_ORB) {
|
||||
WorldConfiguration config = getWorldConfig(BukkitAdapter.adapt(event.getWorld()));
|
||||
|
||||
if (config.disableExpDrops) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPotionEffect(EntityPotionEffectEvent event) {
|
||||
if (event.getCause() == EntityPotionEffectEvent.Cause.CONDUIT) {
|
||||
WorldConfiguration config = getWorldConfig(BukkitAdapter.adapt(event.getEntity().getWorld()));
|
||||
|
||||
if (config.disableConduitEffects) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user