/*
 * WitchSpawnsFeature.java
 *
 * Copyright (c) 2014 Graham Howden <graham_howden1 at yahoo.co.uk>.
 *
 * This file is part of UltraHardcore.
 *
 * UltraHardcore is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * UltraHardcore is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with UltraHardcore.  If not, see <http ://www.gnu.org/licenses/>.
 */

package com.publicuhc.ultrahardcore.pluginfeatures.witchspawns;

import com.publicuhc.pluginframework.configuration.Configurator;
import com.publicuhc.pluginframework.shaded.inject.Inject;
import com.publicuhc.pluginframework.shaded.inject.Singleton;
import com.publicuhc.pluginframework.translate.Translate;
import com.publicuhc.ultrahardcore.pluginfeatures.UHCFeature;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.plugin.Plugin;

@Singleton
public class WitchSpawnsFeature extends UHCFeature {

    /**
     * Feature allows witches to spawn when enabled, disables it when disabled
     * @param plugin the plugin
     * @param configManager the config manager
     * @param translate the translator
     */
    @Inject
    private WitchSpawnsFeature(Plugin plugin, Configurator configManager, Translate translate) {
        super(plugin, configManager, translate);
    }

    /**
     * Whenever a creature spawns
     * @param ese the creaturespawnevent
     */
    @EventHandler
    public void onCreatureSpawnEvent(CreatureSpawnEvent ese) {
        //when enabled witches can spawn, when not enabled they are cancelled
        if (!isEnabled() && ese.getSpawnReason() == CreatureSpawnEvent.SpawnReason.NATURAL && ese.getEntity().getType() == EntityType.WITCH) {
            ese.setCancelled(true);
        }
    }

    @Override
    public String getFeatureID() {
        return "WitchSpawns";
    }

    @Override
    public String getDescription() {
        return "Allows natural witch spawns";
    }
}

@@ -901,213 +901,31 @@
 ork.
-configuration.Configurator;%0Aimport com.publicuhc.pluginframework.shaded.inject.Inject;%0Aimport com.publicuhc.pluginframework.shaded.inject.Singleton;%0Aimport com.publicuhc.pluginframework.translate.Translate
+shaded.inject.Singleton
 ;%0Aim
@@ -949,38 +949,32 @@
 c.ultrahardcore.
-plugin
 features.UHCFeat
@@ -1108,177 +1108,53 @@
 nt;%0A
-import org.bukkit.plugin.Plugin;%0A%0A@Singleton%0Apublic class WitchSpawnsFeature extends UHCFeature %7B%0A%0A    /**%0A     * Feature allows witches to spawn when e
+%0A%0A/**%0A * WitchSpawns%0A *%0A * E
 nabled
-, d
+: D
 isables 
 it w
@@ -1153,314 +1153,111 @@
 les 
+w
 it
- when disabled%0A     * @param plugin the plugin%0A     * @param configManager the config manager%0A     * @param translate the translator%0A     */%0A    @Inject%0A    private WitchSpawnsFeature(Plugin plugin, Configurator configManager, Translate translate) %7B%0A        super(plugin, configManager, translate);%0A    %7D
+ch spawning%0A * Disabled: Nothing%0A */%0A@Singleton%0Apublic class WitchSpawnsFeature extends UHCFeature %7B
 %0A%0A  
@@ -1430,86 +1430,8 @@
 ) %7B%0A
-        //when enabled witches can spawn, when not enabled they are cancelled%0A
     
@@ -1442,9 +1442,8 @@
 if (
-!
 isEn
@@ -1778,13 +1778,15 @@
 rn %22
-Allow
+Disable
 s na

update witch spawning feature