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)));
|
||||
}
|
||||
}
|
||||
24
Plugin/src/main/resources/enchants/normal/hellish.yml
Normal file
24
Plugin/src/main/resources/enchants/normal/hellish.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# Hellish EcoEnchant
|
||||
#
|
||||
|
||||
config-version: 4.0 # Don't edit this.
|
||||
|
||||
name: "Hellish"
|
||||
|
||||
description: Increases damage dealt in the nether.
|
||||
|
||||
obtaining:
|
||||
table: true
|
||||
villager: true
|
||||
loot: true
|
||||
rarity: epic
|
||||
|
||||
general-config:
|
||||
grindstoneable: true
|
||||
conflicts:
|
||||
- void_affinity
|
||||
maximum-level: 5
|
||||
|
||||
config:
|
||||
per-level-multiplier: 0.05 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier)
|
||||
24
Plugin/src/main/resources/enchants/normal/voidaffinity.yml
Normal file
24
Plugin/src/main/resources/enchants/normal/voidaffinity.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# Void Affinity EcoEnchant
|
||||
#
|
||||
|
||||
config-version: 4.0 # Don't edit this.
|
||||
|
||||
name: "Void Affinity"
|
||||
|
||||
description: Increases damage dealt in the end.
|
||||
|
||||
obtaining:
|
||||
table: true
|
||||
villager: true
|
||||
loot: true
|
||||
rarity: epic
|
||||
|
||||
general-config:
|
||||
grindstoneable: true
|
||||
conflicts:
|
||||
- netheric
|
||||
maximum-level: 5
|
||||
|
||||
config:
|
||||
per-level-multiplier: 0.05 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier)
|
||||
@@ -234,6 +234,8 @@ permissions:
|
||||
ecoenchants.fromtable.pacify: true
|
||||
ecoenchants.fromtable.abattoir: true
|
||||
ecoenchants.fromtable.disable: true
|
||||
ecoenchants.fromtable.hellish: true
|
||||
ecoenchants.fromtable.voidaffinity: true
|
||||
|
||||
ecoenchants.updateannounce:
|
||||
description: Informs admins of a new update
|
||||
@@ -808,4 +810,10 @@ permissions:
|
||||
default: true
|
||||
ecoenchants.fromtable.disable:
|
||||
description: Allows getting disable from an enchanting table
|
||||
default: true
|
||||
ecoenchants.fromtable.hellish:
|
||||
description: Allows getting hellish from an enchanting table
|
||||
default: true
|
||||
ecoenchants.fromtable.voidaffinity:
|
||||
description: Allows getting void affinity from an enchanting table
|
||||
default: true
|
||||
Reference in New Issue
Block a user