Added Netheric and Enderism

This commit is contained in:
Auxilor 2020-08-29 14:22:07 +01:00
parent e765b7c989
commit b85252d481
6 changed files with 144 additions and 0 deletions

View File

@ -198,6 +198,8 @@ public class EcoEnchants {
public static final EcoEnchant BLIND = new Blind(); public static final EcoEnchant BLIND = new Blind();
public static final EcoEnchant SICKENING = new Sickening(); public static final EcoEnchant SICKENING = new Sickening();
public static final EcoEnchant DEFENDER = new Defender(); 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 * Get all registered {@link EcoEnchant}s

View File

@ -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)));
}
}

View File

@ -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)));
}
}

View File

@ -0,0 +1,24 @@
#
# Enderism EcoEnchant
#
config-version: 4.0 # Don't edit this.
name: "Enderism"
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)

View File

@ -0,0 +1,24 @@
#
# Netheric EcoEnchant
#
config-version: 4.0 # Don't edit this.
name: "Netheric"
description: Increases damage dealt in the nether.
obtaining:
table: true
villager: true
loot: true
rarity: epic
general-config:
grindstoneable: true
conflicts:
- enderism
maximum-level: 5
config:
per-level-multiplier: 0.05 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier)

View File

@ -217,6 +217,8 @@ permissions:
ecoenchants.fromtable.sickening: true ecoenchants.fromtable.sickening: true
ecoenchants.fromtable.blind: true ecoenchants.fromtable.blind: true
ecoenchants.fromtable.defender: true ecoenchants.fromtable.defender: true
ecoenchants.fromtable.netheric: true
ecoenchants.fromtable.enderism: true
ecoenchants.updateannounce: ecoenchants.updateannounce:
description: Informs admins of a new update description: Informs admins of a new update
@ -741,3 +743,9 @@ permissions:
ecoenchants.fromtable.defender: ecoenchants.fromtable.defender:
description: Allows getting defender from an enchanting table description: Allows getting defender from an enchanting table
default: true default: true
ecoenchants.fromtable.netheric:
description: Allows getting netheric from an enchanting table
default: true
ecoenchants.fromtable.enderism:
description: Allows getting enderism from an enchanting table
default: true