Merge pull request #58

disable-on-players
This commit is contained in:
Will FP 2021-09-09 12:40:35 +01:00 committed by GitHub
commit e4f7c40be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Trident;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
@ -21,6 +22,7 @@ public class Bladed extends EcoEnchant {
@NotNull final Trident trident,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
if (victim instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-players")) return;
double baseDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "base-multiplier");
double damage = event.getDamage();
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");

View File

@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
@ -21,6 +22,7 @@ public class Force extends EcoEnchant {
@NotNull final Arrow arrow,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
if (victim instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-players")) return;
double damage = event.getDamage();
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
double bonus = (multiplier * (level + 6)) + 1;

View File

@ -20,6 +20,7 @@ public class Razor extends EcoEnchant {
@NotNull final LivingEntity victim,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
if (victim instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-players")) return;
double perLevelMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
double baseDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "base-damage");
double extra = (level * perLevelMultiplier) + baseDamage;

View File

@ -31,6 +31,7 @@ general-config:
maximum-level: 5
config:
disable-on-players: false # Should this enchantment only boost damage on mobs
base-multiplier: 1.5 # Percent more damage to do as base
multiplier: 0.5 # 1 + (Level * Multiplier) is multiplied with the damage
# To explain, Bladed V would be 4x more damage: 1.5 + (5*0.5)

View File

@ -30,4 +30,5 @@ general-config:
maximum-level: 8
config:
disable-on-players: false # Should this enchantment only boost damage on mobs
multiplier: 0.25 # Formula is (multiplier * (level + 6) + 1)*damage | Default functions as power 5 + level, eg force 2 = power 7

View File

@ -32,6 +32,7 @@ general-config:
maximum-level: 8
config:
disable-on-players: false # Should this enchantment only boost damage on mobs
multiplier: 0.3 # Vanilla sharpness is 0.5*level + 0.5 extra damage. Razor formula is multiplier*level + base extra damage.
base-damage: 10 # Vanilla Smite 5/BOA 5 extra damage is 12.5
decrease-if-cooldown: true