From 7af645dae8e45beb1908a63f93fe02b83ef8f131 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 15 Jul 2021 23:21:06 +0200 Subject: [PATCH] Added option to spells to not activate while sneaking --- .../willfp/ecoenchants/enchantments/itemtypes/Spell.java | 6 ++++++ .../src/main/resources/enchants/spell/ascend.yml | 3 ++- .../src/main/resources/enchants/spell/charge.yml | 3 ++- .../src/main/resources/enchants/spell/dynamite.yml | 3 ++- .../src/main/resources/enchants/spell/missile.yml | 3 ++- .../core-plugin/src/main/resources/enchants/spell/quake.yml | 3 ++- .../src/main/resources/enchants/spell/vitalize.yml | 3 ++- 7 files changed, 18 insertions(+), 6 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java index 28ffb0c7..d5aba8c0 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java @@ -242,6 +242,12 @@ public abstract class Spell extends EcoEnchant { } } + if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "not-while-sneaking")) { + if (player.isSneaking()) { + return; + } + } + if (cooldown > 0) { String message = this.getPlugin().getLangYml().getMessage("on-cooldown").replace("%seconds%", String.valueOf(cooldown)).replace("%name%", EnchantmentCache.getEntry(this).getRawName()); player.sendMessage(message); diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/ascend.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/ascend.yml index 8f48c5b5..29997852 100644 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/ascend.yml +++ b/eco-core/core-plugin/src/main/resources/enchants/spell/ascend.yml @@ -24,4 +24,5 @@ config: activation-sound: ENTITY_FIREWORK_ROCKET_LARGE_BLAST cooldown: 90 # In seconds power: 25 # Level of levitation to give - ticks-per-level: 6 \ No newline at end of file + ticks-per-level: 6 + not-while-sneaking: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/charge.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/charge.yml index 4d348186..3f08ee41 100644 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/charge.yml +++ b/eco-core/core-plugin/src/main/resources/enchants/spell/charge.yml @@ -23,4 +23,5 @@ general-config: config: activation-sound: ENTITY_FIREWORK_ROCKET_LAUNCH cooldown: 40 # In seconds - velocity-per-level: 1.5 \ No newline at end of file + velocity-per-level: 1.5 + not-while-sneaking: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/dynamite.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/dynamite.yml index cfcdea22..837652cb 100644 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/dynamite.yml +++ b/eco-core/core-plugin/src/main/resources/enchants/spell/dynamite.yml @@ -27,4 +27,5 @@ config: blacklisted-blocks: - bedrock base-bonus: 2 # Base extra blocks on all sides to break (1 = 3x3x3, 2 = 5x5x5, 3 = 7x7x7) - per-level-bonus: 1 # Extra blocks on all sides per level \ No newline at end of file + per-level-bonus: 1 # Extra blocks on all sides per level + not-while-sneaking: true \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/missile.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/missile.yml index c1a2d630..bf9ac674 100644 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/missile.yml +++ b/eco-core/core-plugin/src/main/resources/enchants/spell/missile.yml @@ -25,4 +25,5 @@ config: activation-sound: ENTITY_WITHER_SHOOT cooldown: 40 # In seconds velocity: 3 - damage-per-level: 8 \ No newline at end of file + damage-per-level: 8 + not-while-sneaking: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/quake.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/quake.yml index 50182bb1..6106b80d 100644 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/quake.yml +++ b/eco-core/core-plugin/src/main/resources/enchants/spell/quake.yml @@ -24,4 +24,5 @@ config: activation-sound: ENTITY_ENDER_DRAGON_GROWL cooldown: 40 # In seconds damage-per-level: 3 - radius-per-level: 2 \ No newline at end of file + radius-per-level: 2 + not-while-sneaking: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/vitalize.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/vitalize.yml index b779035f..370c78f1 100644 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/vitalize.yml +++ b/eco-core/core-plugin/src/main/resources/enchants/spell/vitalize.yml @@ -25,4 +25,5 @@ general-config: config: activation-sound: ENTITY_PLAYER_LEVELUP - cooldown: 450 # In seconds \ No newline at end of file + cooldown: 450 # In seconds + not-while-sneaking: false \ No newline at end of file