mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-23 19:57:36 +01:00
Prevented spells activating on block click
This commit is contained in:
parent
1559cb5c05
commit
c7c949f990
@ -11,6 +11,7 @@ import com.willfp.ecoenchants.enchantments.util.SpellRunnable;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.SoundCategory;
|
||||
import org.bukkit.block.Container;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
@ -116,6 +117,17 @@ public abstract class Spell extends EcoEnchant {
|
||||
|
||||
int cooldown = getCooldown(this, player);
|
||||
|
||||
if (event.getClickedBlock() != null) {
|
||||
if (event.getClickedBlock().getState() instanceof Container
|
||||
|| event.getClickedBlock().getType() == Material.CRAFTING_TABLE
|
||||
|| event.getClickedBlock().getType() == Material.GRINDSTONE
|
||||
|| event.getClickedBlock().getType() == Material.ENCHANTING_TABLE
|
||||
|| event.getClickedBlock().getType() == Material.ANVIL
|
||||
|| event.getClickedBlock().getType() == Material.FURNACE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (cooldown > 0) {
|
||||
String message = Configs.LANG.getMessage("on-cooldown").replace("%seconds%", String.valueOf(cooldown)).replace("%name%", EnchantmentCache.getEntry(this).getRawName());
|
||||
player.sendMessage(message);
|
||||
|
Loading…
Reference in New Issue
Block a user