Added End Infusion

This commit is contained in:
Auxilor 2020-08-29 14:00:21 +01:00
parent 7115699973
commit 4c9d14761e
6 changed files with 73 additions and 5 deletions

View File

@ -189,6 +189,7 @@ public class EcoEnchants {
public static final EcoEnchant LIFE_STEAL = new LifeSteal();
public static final EcoEnchant LIME_ARTIFACT = new LimeArtifact();
public static final EcoEnchant FORCE = new Force();
public static final EcoEnchant END_INFUSION = new EndInfusion();
/**
* Get all registered {@link EcoEnchant}s

View File

@ -0,0 +1,39 @@
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.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
public class EndInfusion extends EcoEnchant {
public EndInfusion() {
super(
new EcoEnchantBuilder("end_infusion", EnchantmentType.NORMAL, Target.Applicable.SWORD, 4.0)
);
}
// START OF LISTENERS
@EventHandler
public void onHit(EntityDamageByEntityEvent event) {
if (!(event.getDamager() instanceof Player))
return;
Player player = (Player) event.getDamager();
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

@ -12,7 +12,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
public class NetherInfusion extends EcoEnchant {
public NetherInfusion() {
super(
new EcoEnchantBuilder("nether_infusion", EnchantmentType.NORMAL, Target.Applicable.SWORD, 4.0)
new EcoEnchantBuilder("nether_infusion", EnchantmentType.NORMAL, Target.Applicable.SWORD, 4.01)
);
}

View File

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

View File

@ -2,12 +2,11 @@
# Nether Infusion EcoEnchant
#
config-version: 4.0 # Don't edit this.
config-version: 4.01 # Don't edit this.
name: "Nether Infusion"
description: Increases damage dealt in
the nether.
description: Increases damage dealt in the nether.
obtaining:
table: true
@ -17,7 +16,8 @@ obtaining:
general-config:
grindstoneable: true
conflicts: []
conflicts:
- end_infusion
maximum-level: 5
config:

View File

@ -208,6 +208,7 @@ permissions:
ecoenchants.fromtable.lifesteal: true
ecoenchants.fromtable.limeartifact: true
ecoenchants.fromtable.force: true
ecoenchants.fromtable.endinfusion: true
ecoenchants.updateannounce:
description: Informs admins of a new update
@ -704,4 +705,7 @@ permissions:
default: true
ecoenchants.fromtable.force:
description: Allows getting force from an enchanting table
default: true
ecoenchants.fromtable.endinfusion:
description: Allows getting end infusion from an enchanting table
default: true