Added Quake

This commit is contained in:
Auxilor 2020-11-07 11:53:02 +00:00
parent 42e1b05c06
commit 0bb5e896d8
3 changed files with 62 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import com.willfp.ecoenchants.enchantments.ecoenchants.curse.PermanenceCurse;
import com.willfp.ecoenchants.enchantments.ecoenchants.normal.*;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.*;
import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Missile;
import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Quake;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
@ -249,6 +250,7 @@ public class EcoEnchants {
public static final EcoEnchant STALWART = new Stalwart();
public static final EcoEnchant PLASMIC = new Plasmic();
public static final EcoEnchant MISSILE = new Missile();
public static final EcoEnchant QUAKE = new Quake();
/**
* Get all registered {@link EcoEnchant}s

View File

@ -0,0 +1,35 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.spell;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import java.util.Collection;
public class Quake extends Spell {
public Quake() {
super("quake");
}
@Override
public void onRightClick(Player player, int level) {
int radius = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "radius-per-level") * level;
int damage = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * level;
Collection<Entity> entities = player.getWorld().getNearbyEntities(player.getLocation(), radius, 3, radius);
for (Entity entity : entities) {
if (entity.equals(player))
continue;
if(!(entity instanceof LivingEntity)) continue;
if(!AntigriefManager.canInjure(player, (LivingEntity) entity))
continue;
((LivingEntity) entity).damage(damage);
}
}
}

View File

@ -0,0 +1,25 @@
#
# Quake EcoEnchant
#
name: "Quake"
description: Damages all nearby entities
enabled: true
obtaining:
table: true
villager: true
loot: true
rarity: epic
general-config:
targets:
- sword
grindstoneable: true
conflicts: []
maximum-level: 3
config:
cooldown: 20 # In seconds
damage-per-level: 3
radius-per-level: 2