mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2026-01-03 06:12:21 +00:00
Added mystic resilience to alchemy
This commit is contained in:
@@ -6,6 +6,7 @@ import com.willfp.ecoskills.effects.effects.EffectBountifulHarvest;
|
||||
import com.willfp.ecoskills.effects.effects.EffectCraftsmanship;
|
||||
import com.willfp.ecoskills.effects.effects.EffectEfficientBrewing;
|
||||
import com.willfp.ecoskills.effects.effects.EffectEyeOfTheDepths;
|
||||
import com.willfp.ecoskills.effects.effects.EffectMysticResilience;
|
||||
import com.willfp.ecoskills.effects.effects.EffectPotionmaster;
|
||||
import com.willfp.ecoskills.effects.effects.EffectSeamlessMovement;
|
||||
import com.willfp.ecoskills.effects.effects.EffectSecondChance;
|
||||
@@ -37,6 +38,7 @@ public class Effects {
|
||||
public static final Effect SHAMANISM = new EffectShamanism();
|
||||
public static final Effect VERSATILE_TOOLS = new EffectVersatileTools();
|
||||
public static final Effect EFFICIENT_BREWING = new EffectEfficientBrewing();
|
||||
public static final Effect MYSTIC_RESILIENCE = new EffectMysticResilience();
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void registerNewEffect(@NotNull final Effect effect) {
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.willfp.ecoskills.effects.effects
|
||||
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.ecoskills.effects.Effect
|
||||
import com.willfp.ecoskills.getEffectLevel
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.block.BrewingStand
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.EventPriority
|
||||
import org.bukkit.event.entity.EntityPotionEffectEvent
|
||||
import org.bukkit.event.inventory.InventoryClickEvent
|
||||
import org.bukkit.event.player.PlayerRecipeDiscoverEvent
|
||||
import org.bukkit.potion.PotionType
|
||||
|
||||
|
||||
class EffectMysticResilience : Effect(
|
||||
"mystic_resilience"
|
||||
) {
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
fun handle(event: EntityPotionEffectEvent) {
|
||||
val player = event.entity
|
||||
|
||||
if (player !is Player) {
|
||||
return
|
||||
}
|
||||
|
||||
val level = player.getEffectLevel(this)
|
||||
|
||||
if (NumberUtils.randFloat(0.0, 100.0) >= this.config.getDouble("chance-per-level") * level) {
|
||||
return
|
||||
}
|
||||
|
||||
val effect = event.newEffect ?: return
|
||||
|
||||
when (effect.type.name) {
|
||||
"BLINDNESS",
|
||||
"CONFUSION",
|
||||
"HARM",
|
||||
"HUNGER",
|
||||
"POISON",
|
||||
"WITHER",
|
||||
"LEVITATION",
|
||||
"SLOW_DIGGING",
|
||||
"WEAKNESS" -> event.isCancelled = true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,3 +95,7 @@ effects:
|
||||
name: "Efficient Brewing"
|
||||
color: "&6"
|
||||
description: "Decrease the time taken to brew potions"
|
||||
mystic_resilience:
|
||||
name: "Mystic Resilience"
|
||||
color: "&6"
|
||||
description: "Increases the chance to ignore negative potion effects"
|
||||
|
||||
@@ -10,6 +10,7 @@ gui-lore:
|
||||
- "&fEffects:"
|
||||
- "&8» &r&6Potionmaster %ecoskills_potionmaster_numeral%"
|
||||
- "&8» &r&6Efficient Brewing %ecoskills_efficient_brewing_numeral%"
|
||||
- "&8» &r&6Mystic Resilience %ecoskills_mystic_resilience_numeral%"
|
||||
|
||||
# The maximum obtainable level
|
||||
max-level: 50
|
||||
@@ -26,12 +27,14 @@ rewards-messages:
|
||||
- " &8» &r&f+1 %ecoskills_wisdom_name%"
|
||||
- " &8» &r&6Potionmaster %ecoskills_potionmaster_numeral%"
|
||||
- " &8» &r&6Efficient Brewing %ecoskills_efficient_brewing_numeral%"
|
||||
- " &8» &r&6Mystic Resilience %ecoskills_mystic_resilience_numeral%"
|
||||
|
||||
rewards-gui-lore:
|
||||
- " &8» &r&f+2 %ecoskills_crit_chance_name%"
|
||||
- " &8» &r&f+1 %ecoskills_wisdom_name%"
|
||||
- " &8» &r&6Potionmaster %ecoskills_potionmaster_numeral%"
|
||||
- " &8» &r&6Efficient Brewing %ecoskills_efficient_brewing_numeral%"
|
||||
- " &8» &r&6Mystic Resilience %ecoskills_mystic_resilience_numeral%"
|
||||
|
||||
# The experience to give for each brewing ingredient
|
||||
xp-rewards:
|
||||
|
||||
Reference in New Issue
Block a user