Added Hellish and Void Affinity
This commit is contained in:
@@ -215,6 +215,8 @@ public class EcoEnchants {
|
||||
public static final EcoEnchant PACIFY = new Pacify();
|
||||
public static final EcoEnchant ABATTOIR = new Abattoir();
|
||||
public static final EcoEnchant DISABLE = new Disable();
|
||||
public static final EcoEnchant HELLISH = new Hellish();
|
||||
public static final EcoEnchant VOID_AFFINITY = new VoidAffinity();
|
||||
|
||||
/**
|
||||
* Get all registered {@link EcoEnchant}s
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
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.World;
|
||||
import org.bukkit.entity.Arrow;
|
||||
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 Hellish extends EcoEnchant {
|
||||
public Hellish() {
|
||||
super(
|
||||
new EcoEnchantBuilder("hellish", 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;
|
||||
|
||||
Player player = (Player) ((Trident) event.getDamager()).getShooter();
|
||||
Trident trident = (Trident) event.getDamager();
|
||||
ItemStack item = TridentStack.getTridentStack(trident);
|
||||
|
||||
assert player != null;
|
||||
if(!player.getWorld().getEnvironment().equals(World.Environment.NETHER))
|
||||
return;
|
||||
|
||||
if (!EnchantChecks.item(item, this)) return;
|
||||
|
||||
int level = EnchantChecks.getItemLevel(item, this);
|
||||
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "per-level-multiplier");
|
||||
|
||||
event.setDamage(event.getDamage() * (1 + (level * multiplier)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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.World;
|
||||
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 VoidAffinity extends EcoEnchant {
|
||||
public VoidAffinity() {
|
||||
super(
|
||||
new EcoEnchantBuilder("void_affinity", 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;
|
||||
|
||||
Player player = (Player) ((Trident) event.getDamager()).getShooter();
|
||||
Trident trident = (Trident) event.getDamager();
|
||||
ItemStack item = TridentStack.getTridentStack(trident);
|
||||
|
||||
assert player != null;
|
||||
if(!player.getWorld().getEnvironment().equals(World.Environment.THE_END))
|
||||
return;
|
||||
|
||||
if (!EnchantChecks.item(item, this)) return;
|
||||
|
||||
int level = EnchantChecks.getItemLevel(item, this);
|
||||
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "per-level-multiplier");
|
||||
|
||||
event.setDamage(event.getDamage() * (1 + (level * multiplier)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user