Added Cubism and Quadrilateralism

This commit is contained in:
Auxilor 2020-08-30 10:33:53 +01:00
parent 1c348fa450
commit defc44038e
6 changed files with 143 additions and 0 deletions

View File

@ -217,6 +217,8 @@ public class EcoEnchants {
public static final EcoEnchant DISABLE = new Disable();
public static final EcoEnchant HELLISH = new Hellish();
public static final EcoEnchant VOID_AFFINITY = new VoidAffinity();
public static final EcoEnchant CUBISM = new Cubism();
public static final EcoEnchant QUADRILATERALISM = new Quadrilateralism();
/**
* Get all registered {@link EcoEnchant}s

View File

@ -0,0 +1,42 @@
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 org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
public class Cubism extends EcoEnchant {
public Cubism() {
super(
new EcoEnchantBuilder("cubism", EnchantmentType.NORMAL, new Target.Applicable[]{Target.Applicable.SWORD, Target.Applicable.AXE}, 4.0)
);
}
// START OF LISTENERS
@EventHandler
public void onDamage(EntityDamageByEntityEvent event) {
if (!(event.getDamager() instanceof Player)) return;
if (!(event.getEntity() instanceof LivingEntity)) return;
Player player = (Player) event.getDamager();
LivingEntity victim = (LivingEntity) event.getEntity();
if(!(victim instanceof Slime))
return;
if (!EnchantChecks.mainhand(player, this)) return;
int level = EnchantChecks.getMainhandLevel(player, this);
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
double damageMultiplier = (level * multiplier) + 1;
event.setDamage(event.getDamage() * damageMultiplier);
}
}

View File

@ -0,0 +1,45 @@
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 org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
public class Quadrilateralism extends EcoEnchant {
public Quadrilateralism() {
super(
new EcoEnchantBuilder("quadrilateralism", EnchantmentType.NORMAL, new Target.Applicable[]{Target.Applicable.BOW, Target.Applicable.CROSSBOW}, 4.0)
);
}
// START OF LISTENERS
@EventHandler
public void onDamage(EntityDamageByEntityEvent event) {
if (!(event.getDamager() instanceof Arrow)) return;
if (!(((Arrow) event.getDamager()).getShooter() instanceof Player)) return;
if (!(event.getEntity() instanceof LivingEntity)) return;
Player player = (Player) ((Arrow) event.getDamager()).getShooter();
Arrow arrow = (Arrow) event.getDamager();
LivingEntity victim = (LivingEntity) event.getEntity();
if(!(victim instanceof Slime))
return;
if (!EnchantChecks.arrow(arrow, this)) return;
int level = EnchantChecks.getArrowLevel(arrow, this);
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
double damageMultiplier = (level * multiplier) + 1;
event.setDamage(event.getDamage() * damageMultiplier);
}
}

View File

@ -0,0 +1,23 @@
#
# Cubism EcoEnchant
#
config-version: 4.0 # Don't edit this.
name: "Cubism"
description: Increases damage dealt against slimes and magma cubes.
obtaining:
table: true
villager: true
loot: true
rarity: rare
general-config:
grindstoneable: true
conflicts: []
maximum-level: 5
config:
multiplier: 0.1 # Damage = level * multiplier + 1

View File

@ -0,0 +1,23 @@
#
# Quadrilateralism EcoEnchant
#
config-version: 4.0 # Don't edit this.
name: "Quadrilateralism"
description: Increases damage dealt against slimes and magma cubes.
obtaining:
table: true
villager: true
loot: true
rarity: rare
general-config:
grindstoneable: true
conflicts: []
maximum-level: 5
config:
multiplier: 0.1 # Damage = level * multiplier + 1

View File

@ -236,6 +236,8 @@ permissions:
ecoenchants.fromtable.disable: true
ecoenchants.fromtable.hellish: true
ecoenchants.fromtable.voidaffinity: true
ecoenchants.fromtable.cubism: true
ecoenchants.fromtable.quadrilateralism: true
ecoenchants.updateannounce:
description: Informs admins of a new update
@ -817,3 +819,9 @@ permissions:
ecoenchants.fromtable.voidaffinity:
description: Allows getting void affinity from an enchanting table
default: true
ecoenchants.fromtable.cubism:
description: Allows getting cubism from an enchanting table
default: true
ecoenchants.fromtable.quadrilateralism:
description: Allows getting quadrilateralism from an enchanting table
default: true