mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-02-16 04:31:22 +01:00
Added Conclude
This commit is contained in:
parent
d9a5d46c14
commit
02299669e2
@ -220,6 +220,7 @@ public class EcoEnchants {
|
||||
public static final EcoEnchant CUBISM = new Cubism();
|
||||
public static final EcoEnchant QUADRILATERALISM = new Quadrilateralism();
|
||||
public static final EcoEnchant LESION = new Lesion();
|
||||
public static final EcoEnchant CONCLUDE = new Conclude();
|
||||
|
||||
/**
|
||||
* 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.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.checks.EnchantChecks;
|
||||
import com.willfp.ecoenchants.nms.Target;
|
||||
import com.willfp.ecoenchants.nms.TridentStack;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Trident;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Conclude extends EcoEnchant {
|
||||
public Conclude() {
|
||||
super(
|
||||
new EcoEnchantBuilder("conclude", EnchantmentType.NORMAL, Target.Applicable.TRIDENT, 4.0)
|
||||
);
|
||||
}
|
||||
|
||||
// START OF LISTENERS
|
||||
|
||||
@EventHandler
|
||||
public void onHit(EntityDamageByEntityEvent event) {
|
||||
if (!(event.getDamager() instanceof Trident))
|
||||
return;
|
||||
if (!(event.getEntity() instanceof LivingEntity))
|
||||
return;
|
||||
|
||||
Trident trident = (Trident) event.getDamager();
|
||||
ItemStack item = TridentStack.getTridentStack(trident);
|
||||
LivingEntity victim = (LivingEntity) event.getEntity();
|
||||
|
||||
if (!EnchantChecks.item(item, this)) return;
|
||||
int level = EnchantChecks.getItemLevel(item, this);
|
||||
|
||||
double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level");
|
||||
if (!(victim.getHealth() <= level * minhealth))
|
||||
return;
|
||||
|
||||
event.setDamage(10000); // cba to do this properly
|
||||
}
|
||||
}
|
23
Plugin/src/main/resources/enchants/normal/conclude.yml
Normal file
23
Plugin/src/main/resources/enchants/normal/conclude.yml
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# Conclude EcoEnchant
|
||||
#
|
||||
|
||||
config-version: 4.0 # Don't edit this.
|
||||
|
||||
name: "Conclude"
|
||||
|
||||
description: Instantly kill entities on low health.
|
||||
|
||||
obtaining:
|
||||
table: true
|
||||
villager: true
|
||||
loot: true
|
||||
rarity: epic
|
||||
|
||||
general-config:
|
||||
grindstoneable: true
|
||||
conflicts: []
|
||||
maximum-level: 5
|
||||
|
||||
config:
|
||||
minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Conclude 5 kills any mobs below 2.5 hearts
|
@ -239,6 +239,7 @@ permissions:
|
||||
ecoenchants.fromtable.cubism: true
|
||||
ecoenchants.fromtable.quadrilateralism: true
|
||||
ecoenchants.fromtable.lesion: true
|
||||
ecoenchants.fromtable.conclude: true
|
||||
|
||||
ecoenchants.updateannounce:
|
||||
description: Informs admins of a new update
|
||||
@ -828,4 +829,7 @@ permissions:
|
||||
default: true
|
||||
ecoenchants.fromtable.lesion:
|
||||
description: Allows getting lesion from an enchanting table
|
||||
default: true
|
||||
ecoenchants.fromtable.conclude:
|
||||
description: Allows getting conclude from an enchanting table
|
||||
default: true
|
Loading…
Reference in New Issue
Block a user