mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-02-23 05:41:19 +01:00
Added aversion
This commit is contained in:
parent
8ffa051c0f
commit
d94dc83e51
@ -53,6 +53,7 @@ import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Arachnid;
|
||||
import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Arborist;
|
||||
import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Arcanic;
|
||||
import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Atmospheric;
|
||||
import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Aversion;
|
||||
import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Backstab;
|
||||
import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Beheading;
|
||||
import com.willfp.ecoenchants.enchantments.ecoenchants.normal.BlastMining;
|
||||
@ -472,6 +473,7 @@ public class EcoEnchants {
|
||||
public static final EcoEnchant ASCEND = new Ascend();
|
||||
public static final EcoEnchant ARBORIST = new Arborist();
|
||||
public static final EcoEnchant LUCKY_CATCH = new LuckyCatch();
|
||||
public static final EcoEnchant AVERSION = new Aversion();
|
||||
|
||||
/**
|
||||
* Get all registered {@link EcoEnchant}s.
|
||||
|
@ -0,0 +1,46 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Enderman;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Aversion extends EcoEnchant {
|
||||
public Aversion() {
|
||||
super(
|
||||
"aversion", EnchantmentType.NORMAL
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEndermanTarget(@NotNull final EntityTargetLivingEntityEvent event) {
|
||||
if (!(event.getEntity() instanceof Enderman)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Enderman enderman = (Enderman) event.getEntity();
|
||||
LivingEntity target = event.getTarget();
|
||||
|
||||
if (target == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int level = EnchantChecks.getHelmetLevel(target, this);
|
||||
|
||||
if (level == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.getDisabledWorlds().contains(target.getWorld())) {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getLogger().info(event.getReason().name());
|
||||
//event.setCancelled(true);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
#
|
||||
# Aversion EcoEnchant
|
||||
#
|
||||
|
||||
name: "Aversion"
|
||||
description: Prevents angering endermen by looking at them.
|
||||
enabled: true
|
||||
|
||||
obtaining:
|
||||
table: true
|
||||
villager: true
|
||||
loot: true
|
||||
rarity: epic
|
||||
|
||||
general-config:
|
||||
targets:
|
||||
- helmet
|
||||
grindstoneable: true
|
||||
disabled-in-worlds: []
|
||||
conflicts: []
|
||||
|
||||
config:
|
||||
# No config is available for this enchantment.
|
Loading…
Reference in New Issue
Block a user