/*
 * EnderpearlsFeature.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.enderpearls;

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.EntityDamageByEntityEvent;
import org.bukkit.permissions.Permissible;
import org.bukkit.plugin.Plugin;


/**
 * EnderpearlsFeature
 * Handles the damage taken from throwing enderpearls
 *
 * @author ghowden
 */
@Singleton
public class EnderpearlsFeature extends UHCFeature {

    public static final String NO_ENDERPEARL_DAMAGE = BASE_PERMISSION + "noEnderpearlDamage";

    /**
     * Enderpearls cause no damage
     * @param plugin the plugin
     * @param configManager the config manager
     * @param translate the translator
     */
    @Inject
    private EnderpearlsFeature(Plugin plugin, Configurator configManager, Translate translate) {
        super(plugin, configManager, translate);
    }

    /**
     * Whenever an entity is hurt
     * @param ede the damage event
     */
    @EventHandler
    public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent ede) {
        if (isEnabled()) {
            if (ede.getDamager().getType() == EntityType.ENDER_PEARL) {
                if (((Permissible) ede.getEntity()).hasPermission(NO_ENDERPEARL_DAMAGE)) {
                    ede.setCancelled(true);
                }
            }
        }
    }

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

    @Override
    public String getDescription() {
        return "Enderpearls cause no teleport damage";
    }
}

@@ -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
@@ -1158,41 +1158,8 @@
 le;%0A
-import org.bukkit.plugin.Plugin;%0A
 %0A%0A/*
@@ -1385,27 +1385,13 @@
 E = 
-BASE_PERMISSION + %22
+%22UHC.
 noEn
@@ -1412,427 +1412,8 @@
 %22;%0A%0A
-    /**%0A     * Enderpearls cause no damage%0A     * @param plugin the plugin%0A     * @param configManager the config manager%0A     * @param translate the translator%0A     */%0A    @Inject%0A    private EnderpearlsFeature(Plugin plugin, Configurator configManager, Translate translate) %7B%0A        super(plugin, configManager, translate);%0A    %7D%0A%0A    /**%0A     * Whenever an entity is hurt%0A     * @param ede the damage event%0A     */%0A
     

update enderpeals feature