diff --git a/build.gradle b/build.gradle index 8d73df8..3f3cbad 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,7 @@ allprojects { dependencies { compileOnly 'com.willfp:eco:6.44.0' - implementation 'com.willfp:libreforge:3.121.0' + implementation 'com.willfp:libreforge:3.120.0' implementation 'org.joml:joml:1.10.4' compileOnly fileTree(dir: '../../lib', include: ['*.jar']) compileOnly 'com.github.LegameMc:EnchantGui-API:1.0' diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandRecount.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandRecount.kt index 00f1a56..0a9e307 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandRecount.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandRecount.kt @@ -101,7 +101,7 @@ class CommandRecount(plugin: EcoPlugin): Subcommand( if (reward.obj is Effect && reward.obj == effect) { for (i in range) { val obj = reward.obj - val toGive = skill.getLevelUpReward(obj, i) + val toGive = skill.getLevelUpReward(reward, i) ofSkill+=toGive } } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/DataListener.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/DataListener.kt index 66c9079..bc79444 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/DataListener.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/DataListener.kt @@ -22,7 +22,7 @@ class DataListener : Listener { } event.player.setEffectLevel( obj, - skill.getCumulativeLevelUpReward(obj, event.player.getSkillLevel(skill)) + skill.getCumulativeLevelUpReward(levelUpReward, event.player.getSkillLevel(skill)) ) } } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSerratedStrikes.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSerratedStrikes.kt index 9edc302..39f9b35 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSerratedStrikes.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSerratedStrikes.kt @@ -32,6 +32,11 @@ class EffectSerratedStrikes : Effect( return } + if (victim.hasMetadata("serratedStrikes") && + this.config.getBool("prevent-multiple-bleeding")) { + return + } + if (!this.checkConditions(player)) { return } @@ -52,10 +57,13 @@ class EffectSerratedStrikes : Effect( var currentBleedCount = 0 + victim.setMetadata("serratedStrikes", plugin.metadataValueFactory.create(1)) + plugin.runnableFactory.create { bukkitRunnable: RunnableTask -> currentBleedCount++ victim.damage(bleedDamage) if (currentBleedCount >= bleedCount) { + victim.removeMetadata("serratedStrikes", plugin) bukkitRunnable.cancel() return@create } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt index 9325259..b88d913 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt @@ -214,9 +214,9 @@ abstract class Skill @JvmOverloads constructor( return ArrayList(rewards) } - fun getLevelUpReward(skillObject: SkillObject, to: Int): Int { + fun getLevelUpReward(skillObjectReward: SkillObjectReward, to: Int): Int { for (reward in rewards) { - if (reward.obj != skillObject) { + if (reward != skillObjectReward) { continue } @@ -231,10 +231,10 @@ abstract class Skill @JvmOverloads constructor( return 0 } - fun getCumulativeLevelUpReward(skillObject: SkillObject, to: Int): Int { + fun getCumulativeLevelUpReward(skillObjectReward: SkillObjectReward, to: Int): Int { var levels = 0 for (i in 1..to) { - levels += getLevelUpReward(skillObject, i) + levels += getLevelUpReward(skillObjectReward, i) } return levels @@ -264,7 +264,7 @@ abstract class Skill @JvmOverloads constructor( val skillObject = levelUpReward.obj if (skillObject is Effect) { - val objLevel = this.getCumulativeLevelUpReward(skillObject, level) + val objLevel = this.getCumulativeLevelUpReward(levelUpReward, level) msg = msg.replace( "%ecoskills_${skillObject.id}_description%", skillObject.getDescription(objLevel) @@ -303,7 +303,7 @@ abstract class Skill @JvmOverloads constructor( for (levelUpReward in this.getLevelUpRewards()) { val skillObject = levelUpReward.obj - val objLevel = this.getCumulativeLevelUpReward(skillObject, level) + val objLevel = this.getCumulativeLevelUpReward(levelUpReward, level) s = s.replace("%ecoskills_${skillObject.id}%", objLevel.toString()) s = s.replace("%ecoskills_${skillObject.id}_numeral%", NumberUtils.toNumeral(objLevel)) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillLevellingListener.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillLevellingListener.kt index 8cbb77e..369963c 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillLevellingListener.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillLevellingListener.kt @@ -20,7 +20,7 @@ class SkillLevellingListener : Listener { for (reward in skill.getLevelUpRewards()) { val obj = reward.obj - val toGive = skill.getLevelUpReward(obj, to) + val toGive = skill.getLevelUpReward(reward, to) when (obj) { is Effect -> { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillObjectReward.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillObjectReward.kt index 8ce8d34..5c73355 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillObjectReward.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillObjectReward.kt @@ -5,4 +5,20 @@ import com.willfp.ecoskills.SkillObject data class SkillObjectReward ( val obj: SkillObject, val options: SkillObjectOptions -) \ No newline at end of file +) { + override fun equals(other: Any?): Boolean { + if (other !is SkillObjectReward) { + return false + } + + return this.obj == other.obj && this.options.endLevel == other.options.endLevel && + this.options.startLevel == other.options.startLevel + && this.options.amountPerLevel == other.options.amountPerLevel + } + + override fun hashCode(): Int { + var result = obj.hashCode() + result = 31 * result + options.hashCode() + return result + } +} \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillExploration.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillExploration.kt index df9a2e7..87fefb4 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillExploration.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillExploration.kt @@ -44,7 +44,7 @@ class SkillExploration : Skill( } } - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) fun handleLevelling(event: EntityDamageEvent) { val player = (event.entity as? Player)?.filterSkillEnabled() ?: return diff --git a/eco-core/core-plugin/src/main/resources/effects.yml b/eco-core/core-plugin/src/main/resources/effects.yml index 574feb7..4176eeb 100644 --- a/eco-core/core-plugin/src/main/resources/effects.yml +++ b/eco-core/core-plugin/src/main/resources/effects.yml @@ -69,6 +69,8 @@ serrated_strikes: bleed-tick-spacing: 15 # The amount of bleed ticks to give bleed-ticks: 4 + # Prevent multiple stacks of serrated strikes + prevent-multiple-bleeding: false # Disabled worlds disabled-in-worlds: [ ] # Conditions diff --git a/gradle.properties b/gradle.properties index a077589..afe49b0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ #libreforge-updater -#Wed Nov 23 17:25:08 GMT 2022 -version=1.106.0 +#Thu Nov 17 08:38:30 GMT 2022 +version=1.105.1 plugin-name=EcoSkills