mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-26 15:45:12 +01:00
Added Impact
Fixed Supercritical
This commit is contained in:
parent
b897592071
commit
7d660a5871
@ -201,6 +201,7 @@ public class EcoEnchants {
|
||||
public static final EcoEnchant NETHERIC = new Netheric();
|
||||
public static final EcoEnchant ENDERISM = new Enderism();
|
||||
public static final EcoEnchant RAGE = new Rage();
|
||||
public static final EcoEnchant IMPACT = new Impact();
|
||||
|
||||
/**
|
||||
* Get all registered {@link EcoEnchant}s
|
||||
|
@ -0,0 +1,53 @@
|
||||
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 com.willfp.ecoenchants.util.Rand;
|
||||
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 Impact extends EcoEnchant {
|
||||
public Impact() {
|
||||
super(
|
||||
new EcoEnchantBuilder("impact", EnchantmentType.NORMAL, Target.Applicable.TRIDENT, 4.0)
|
||||
);
|
||||
}
|
||||
|
||||
// START OF LISTENERS
|
||||
|
||||
@EventHandler
|
||||
public void onHit(EntityDamageByEntityEvent event) {
|
||||
if (!(event.getDamager() instanceof Trident))
|
||||
return;
|
||||
|
||||
if(!(((Trident) event.getDamager()).getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
if (!(event.getEntity() instanceof LivingEntity))
|
||||
return;
|
||||
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
Player player = (Player) ((Trident) event.getDamager()).getShooter();
|
||||
Trident trident = (Trident) event.getDamager();
|
||||
ItemStack item = TridentStack.getTridentStack(trident);
|
||||
|
||||
if (!EnchantChecks.item(item, this)) return;
|
||||
|
||||
int level = EnchantChecks.getItemLevel(item, this);
|
||||
|
||||
if (Rand.randFloat(0, 1) > level * 0.01 * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "chance-per-level"))
|
||||
return;
|
||||
|
||||
event.setDamage(event.getDamage() * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-multiplier"));
|
||||
}
|
||||
}
|
@ -34,9 +34,6 @@ public class Supercritical extends EcoEnchant {
|
||||
|
||||
if (!EnchantChecks.mainhand(player, this)) return;
|
||||
|
||||
if (!(((LivingEntity) event.getEntity()).getHealth() == ((LivingEntity) event.getEntity()).getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()))
|
||||
return;
|
||||
|
||||
if (Cooldown.getCooldown(player) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
|
||||
|
24
Plugin/src/main/resources/enchants/normal/impact.yml
Normal file
24
Plugin/src/main/resources/enchants/normal/impact.yml
Normal file
@ -0,0 +1,24 @@
|
||||
#
|
||||
# Impact EcoEnchant
|
||||
#
|
||||
|
||||
config-version: 4.0 # Don't edit this.
|
||||
|
||||
name: "Impact"
|
||||
|
||||
description: Small chance to deal extreme damage.
|
||||
|
||||
obtaining:
|
||||
table: true
|
||||
villager: true
|
||||
loot: true
|
||||
rarity: legendary
|
||||
|
||||
general-config:
|
||||
grindstoneable: true
|
||||
conflicts: []
|
||||
maximum-level: 3
|
||||
|
||||
config:
|
||||
damage-multiplier: 3
|
||||
chance-per-level: 0.5 # Chance to deal more (as percentage)
|
@ -220,6 +220,7 @@ permissions:
|
||||
ecoenchants.fromtable.netheric: true
|
||||
ecoenchants.fromtable.enderism: true
|
||||
ecoenchants.fromtable.rage: true
|
||||
ecoenchants.fromtable.impact: true
|
||||
|
||||
ecoenchants.updateannounce:
|
||||
description: Informs admins of a new update
|
||||
@ -752,4 +753,7 @@ permissions:
|
||||
default: true
|
||||
ecoenchants.fromtable.rage:
|
||||
description: Allows getting rage from an enchanting table
|
||||
default: true
|
||||
ecoenchants.fromtable.impact:
|
||||
description: Allows getting impact from an enchanting table
|
||||
default: true
|
Loading…
Reference in New Issue
Block a user