package net.simpvp.Misc;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityPotionEffectEvent;
import org.bukkit.potion.PotionEffectType;

//This file disables elder guardians from giving mining fatigue within 100 blocks of spawn
public class PotionEffectListener implements Listener {
	@EventHandler
	public void potionEffectEvent(EntityPotionEffectEvent event) {
		//If entity is less than 100 blocks from spawn
		if (event.getEntity().getLocation().distance(event.getEntity().getWorld().getSpawnLocation()) <= 100) {
			//If potion equals mining fatigue and the event is from the "attack" cause
			if (event.getModifiedType().equals(PotionEffectType.SLOW_DIGGING) && event.getCause().equals(EntityPotionEffectEvent.Cause.ATTACK)) {
				//Cancel event
				event.setCancelled(true);
			}
		}
	}
}

@@ -347,16 +347,19 @@
 ener %7B%0D%0A
+%09%0D%0A
 %09@EventH
@@ -431,16 +431,202 @@
 ent) %7B%0D%0A
+%09%09%0D%0A%09%09//Check if world name is in the config%0D%0A%09%09if (!Misc.instance.getConfig().getList(%22disableElderGuardians%22).contains(event.getEntity().getWorld().getName())) %7B%0D%0A%09%09%09return;%0D%0A%09%09%7D%0D%0A%09%09%0D%0A
 %09%09//If e

Update PotionEffectListener.java