Added Vitalize

This commit is contained in:
Auxilor
2020-11-07 13:08:41 +00:00
parent 0bb5e896d8
commit f47023ac60
5 changed files with 48 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ 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 com.willfp.ecoenchants.enchantments.ecoenchants.spell.Vitalize;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
@@ -251,6 +252,7 @@ public class EcoEnchants {
public static final EcoEnchant PLASMIC = new Plasmic();
public static final EcoEnchant MISSILE = new Missile();
public static final EcoEnchant QUAKE = new Quake();
public static final EcoEnchant VITALIZE = new Vitalize();
/**
* Get all registered {@link EcoEnchant}s

View File

@@ -0,0 +1,16 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.spell;
import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;
public class Vitalize extends Spell {
public Vitalize() {
super("vitalize");
}
@Override
public void onRightClick(Player player, int level) {
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
}
}

View File

@@ -31,7 +31,7 @@ public abstract class Spell extends EcoEnchant {
@EventHandler
public void onRightClickEventHandler(PlayerInteractEvent event) {
if(!event.getAction().equals(Action.RIGHT_CLICK_AIR))
if(!(event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)))
return;
Player player = event.getPlayer();
@@ -59,6 +59,8 @@ public abstract class Spell extends EcoEnchant {
return;
}
String message = ConfigManager.getLang().getMessage("used-spell").replaceAll("%name%", EnchantmentCache.getEntry(this).getRawName());
player.sendMessage(message);
runnable.run();
}

View File

@@ -0,0 +1,26 @@
#
# Vitalize EcoEnchant
#
name: "Vitalize"
description: Puts you back on max health
enabled: true
obtaining:
table: true
villager: true
loot: true
rarity: special
general-config:
targets:
- sword
- axe
- pickaxe
- shovel
grindstoneable: true
conflicts: []
maximum-level: 1
config:
cooldown: 60 # In seconds

View File

@@ -17,6 +17,7 @@ messages:
&9Conflicts with: &r%conflicts%
outdated: "You are running an outdated version of &aEcoEnchants! &fCurrently running &e%ver%&f, newest version &e%newver%&f. Download at &a&lhttps://www.spigotmc.org/resources/ecoenchants.79573/"
on-cooldown: "&fThis spell is on cooldown! Wait &a%seconds% Seconds&f to use &a%name%&f again."
used-spell: "&fUsed &a%name%&f spell!"
no-targets: "&cCannot be applied"
no-conflicts: "&cNo conflicts"