Permalink
Browse files

Added an option to block conduit effects

  • Loading branch information...
me4502 committed Jan 2, 2019
1 parent cd39387 commit 9804c69044780533a44c4429b2f31356bfe53ea1
@@ -71,6 +71,7 @@
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);
}
}
}

}

0 comments on commit 9804c69

Please sign in to comment.