Added Netheric and Enderism
This commit is contained in:
@@ -198,6 +198,8 @@ public class EcoEnchants {
|
||||
public static final EcoEnchant BLIND = new Blind();
|
||||
public static final EcoEnchant SICKENING = new Sickening();
|
||||
public static final EcoEnchant DEFENDER = new Defender();
|
||||
public static final EcoEnchant NETHERIC = new Netheric();
|
||||
public static final EcoEnchant ENDERISM = new Enderism();
|
||||
|
||||
/**
|
||||
* Get all registered {@link EcoEnchant}s
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
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.nms.Target;
|
||||
import com.willfp.ecoenchants.util.HasEnchant;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
|
||||
public class Enderism extends EcoEnchant {
|
||||
public Enderism() {
|
||||
super(
|
||||
new EcoEnchantBuilder("enderism", EnchantmentType.NORMAL, new Target.Applicable[]{Target.Applicable.BOW, Target.Applicable.CROSSBOW}, 4.0)
|
||||
);
|
||||
}
|
||||
|
||||
// START OF LISTENERS
|
||||
|
||||
@EventHandler
|
||||
public void onHit(EntityDamageByEntityEvent event) {
|
||||
if (!(event.getDamager() instanceof Arrow))
|
||||
return;
|
||||
if (!(((Arrow) event.getDamager()).getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) ((Arrow) event.getDamager()).getShooter();
|
||||
|
||||
assert player != null;
|
||||
if(!player.getWorld().getEnvironment().equals(World.Environment.THE_END))
|
||||
return;
|
||||
|
||||
if (!HasEnchant.playerHeld(player, this)) return;
|
||||
|
||||
int level = HasEnchant.getPlayerLevel(player, this);
|
||||
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "per-level-multiplier");
|
||||
|
||||
event.setDamage(event.getDamage() * (1 + (level * multiplier)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
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.nms.Target;
|
||||
import com.willfp.ecoenchants.util.HasEnchant;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
|
||||
public class Netheric extends EcoEnchant {
|
||||
public Netheric() {
|
||||
super(
|
||||
new EcoEnchantBuilder("netheric", EnchantmentType.NORMAL, new Target.Applicable[]{Target.Applicable.BOW, Target.Applicable.CROSSBOW}, 4.0)
|
||||
);
|
||||
}
|
||||
|
||||
// START OF LISTENERS
|
||||
|
||||
@EventHandler
|
||||
public void onHit(EntityDamageByEntityEvent event) {
|
||||
if (!(event.getDamager() instanceof Arrow))
|
||||
return;
|
||||
if (!(((Arrow) event.getDamager()).getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) ((Arrow) event.getDamager()).getShooter();
|
||||
|
||||
assert player != null;
|
||||
if(!player.getWorld().getEnvironment().equals(World.Environment.NETHER))
|
||||
return;
|
||||
|
||||
if (!HasEnchant.playerHeld(player, this)) return;
|
||||
|
||||
int level = HasEnchant.getPlayerLevel(player, 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