mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-22 15:05:18 +01:00
Added Netheric and Enderism
This commit is contained in:
parent
e765b7c989
commit
b85252d481
@ -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)));
|
||||
}
|
||||
}
|
24
Plugin/src/main/resources/enchants/normal/enderism.yml
Normal file
24
Plugin/src/main/resources/enchants/normal/enderism.yml
Normal 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)
|
24
Plugin/src/main/resources/enchants/normal/netheric.yml
Normal file
24
Plugin/src/main/resources/enchants/normal/netheric.yml
Normal 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)
|
@ -217,6 +217,8 @@ permissions:
|
||||
ecoenchants.fromtable.sickening: true
|
||||
ecoenchants.fromtable.blind: true
|
||||
ecoenchants.fromtable.defender: true
|
||||
ecoenchants.fromtable.netheric: true
|
||||
ecoenchants.fromtable.enderism: true
|
||||
|
||||
ecoenchants.updateannounce:
|
||||
description: Informs admins of a new update
|
||||
@ -740,4 +742,10 @@ permissions:
|
||||
default: true
|
||||
ecoenchants.fromtable.defender:
|
||||
description: Allows getting defender from an enchanting table
|
||||
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
|
Loading…
Reference in New Issue
Block a user