mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-26 15:45:12 +01:00
Added Quake
This commit is contained in:
parent
42e1b05c06
commit
0bb5e896d8
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
25
Plugin/src/main/resources/enchants/spell/quake.yml
Normal file
25
Plugin/src/main/resources/enchants/spell/quake.yml
Normal 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
|
Loading…
Reference in New Issue
Block a user