From 1f28c206ca7facdc6422634b664ba2f16d6ffbb3 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 31 Oct 2022 21:41:36 +0300 Subject: [PATCH 01/12] Fixed level rewards --- .../ecoskills/commands/CommandRecount.kt | 2 +- .../com/willfp/ecoskills/data/DataListener.kt | 2 +- .../com/willfp/ecoskills/skills/Skill.kt | 12 ++++++------ .../ecoskills/skills/SkillLevellingListener.kt | 2 +- .../ecoskills/skills/SkillObjectReward.kt | 18 +++++++++++++++++- 5 files changed, 26 insertions(+), 10 deletions(-) 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/skills/Skill.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt index 07bc96d..44788da 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 @@ -209,9 +209,9 @@ abstract class Skill( 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 } @@ -226,10 +226,10 @@ abstract class Skill( 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 @@ -259,7 +259,7 @@ abstract class Skill( 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) @@ -298,7 +298,7 @@ abstract class Skill( 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 From 7b12b8ca6edf63bf5c9a9e8ade1013b42a3e7da3 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 7 Nov 2022 01:27:48 +0300 Subject: [PATCH 02/12] Switched skill exploration listener to monitor priority for cancelled events compatibility --- .../com/willfp/ecoskills/skills/skills/SkillExploration.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 4346865795f49c6c8fa2d68d85e6be67cd4c69c2 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Tue, 1 Nov 2022 16:23:13 +0000 Subject: [PATCH 03/12] libreforge-updater --- build.gradle | 2 +- gradle.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 19af416..7e7c71c 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.116.0' + implementation 'com.willfp:libreforge:3.117.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/gradle.properties b/gradle.properties index e1236d2..3b1fe1f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ #libreforge-updater -#Fri Oct 28 11:35:08 BST 2022 -version=1.101.0 +#Tue Nov 01 16:23:13 GMT 2022 +version=1.102.0 plugin-name=EcoSkills From fc584f03a77f932ffc8501bab4550de4082dc9b2 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 6 Nov 2022 19:52:08 +0000 Subject: [PATCH 04/12] libreforge-updater --- build.gradle | 2 +- gradle.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 7e7c71c..11bf39d 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.117.0' + implementation 'com.willfp:libreforge:3.118.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/gradle.properties b/gradle.properties index 3b1fe1f..c7f624f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ #libreforge-updater -#Tue Nov 01 16:23:13 GMT 2022 -version=1.102.0 +#Sun Nov 06 19:52:08 GMT 2022 +version=1.103.0 plugin-name=EcoSkills From 15dd6c659796bb819f3b1e212ed179fcc03e6f00 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Tue, 8 Nov 2022 14:22:15 +0000 Subject: [PATCH 05/12] Fixed custom skills --- .../com/willfp/ecoskills/skills/CustomSkill.kt | 7 +++++-- .../kotlin/com/willfp/ecoskills/skills/Skill.kt | 15 ++++++++++----- gradle.properties | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/CustomSkill.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/CustomSkill.kt index ecf9dab..4ddb730 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/CustomSkill.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/CustomSkill.kt @@ -7,8 +7,11 @@ import org.bukkit.entity.Player class CustomSkill( id: String, - override val config: Config -) : Skill(id) { + config: Config +) : Skill( + id, + forceConfig = config +) { private val jobXpGains = config.getSubsections("xp-gain-methods").mapNotNull { Counters.compile(it, "Skill $id") } 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 44788da..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 @@ -27,8 +27,9 @@ import org.bukkit.NamespacedKey import org.bukkit.entity.Player import org.bukkit.event.Listener -abstract class Skill( - val id: String +abstract class Skill @JvmOverloads constructor( + val id: String, + forceConfig: Config? = null ) : Listener { protected val plugin: EcoPlugin = EcoSkillsPlugin.getInstance() @@ -46,9 +47,9 @@ abstract class Skill( 0.0 ) - open val config: Config = SkillConfig(this.id, this.javaClass, plugin) + val config: Config - val xpRequirements = config.getInts("level-xp-requirements").toMutableList() + val xpRequirements: MutableList lateinit var name: String lateinit var levelName: String @@ -63,7 +64,7 @@ abstract class Skill( private val levelCommands = mutableMapOf>() - var enabled = config.getBoolOrNull("enabled") ?: true + var enabled: Boolean // Cached values private val guiLoreCache = Caffeine.newBuilder() @@ -72,6 +73,10 @@ abstract class Skill( .build>() init { + config = forceConfig ?: SkillConfig(this.id, this.javaClass, plugin) + enabled = config.getBoolOrNull("enabled") ?: true + xpRequirements = config.getInts("level-xp-requirements").toMutableList() + finishLoading() } diff --git a/gradle.properties b/gradle.properties index c7f624f..90be197 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ #libreforge-updater #Sun Nov 06 19:52:08 GMT 2022 -version=1.103.0 +version=1.103.1 plugin-name=EcoSkills From 3df428d9ccdce3398e3b73e14bf2099c08082b9e Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 12 Nov 2022 17:34:31 +0000 Subject: [PATCH 06/12] libreforge-updater --- build.gradle | 2 +- gradle.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 11bf39d..9565cc7 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.118.0' + implementation 'com.willfp:libreforge:3.119.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/gradle.properties b/gradle.properties index 90be197..95f42f5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ #libreforge-updater -#Sun Nov 06 19:52:08 GMT 2022 -version=1.103.1 +#Sat Nov 12 17:34:31 GMT 2022 +version=1.104.0 plugin-name=EcoSkills From 2122e6fa79bba443655b051a1df99a54dc3e232a Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 17 Nov 2022 08:38:30 +0000 Subject: [PATCH 07/12] libreforge-updater --- build.gradle | 2 +- gradle.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 9565cc7..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.119.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/gradle.properties b/gradle.properties index 95f42f5..b7ee18c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ #libreforge-updater -#Sat Nov 12 17:34:31 GMT 2022 -version=1.104.0 +#Thu Nov 17 08:38:30 GMT 2022 +version=1.105.0 plugin-name=EcoSkills From ce901fdaa44a78bed21ed6473c6bbf66e9976644 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 19 Nov 2022 19:53:50 +0000 Subject: [PATCH 08/12] Added option to do /skills to open the skill menu directly --- .../ecoskills/commands/CommandSkills.kt | 17 +++++++++-- .../com/willfp/ecoskills/gui/SkillGUI.kt | 28 +++++++++++-------- .../com/willfp/ecoskills/gui/StatsGUI.kt | 8 ++++-- .../willfp/ecoskills/skills/SkillLevelGUI.kt | 8 +++--- 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt index 84de387..ee97b19 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt @@ -3,6 +3,7 @@ package com.willfp.ecoskills.commands import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.command.impl.PluginCommand import com.willfp.ecoskills.gui.SkillGUI +import com.willfp.ecoskills.skills.Skills import org.bukkit.command.CommandSender import org.bukkit.entity.Player @@ -27,6 +28,18 @@ class CommandSkills(plugin: EcoPlugin) : return } - SkillGUI.homeMenu.open(sender) + if (args.isEmpty()) { + SkillGUI.open(sender) + } + + val id = args[0].lowercase() + val skill = Skills.getByID(id) + + if (skill == null) { + sender.sendMessage(this.plugin.langYml.getMessage("invalid-skill")) + return + } + + skill.gui.menu.open(sender) } -} \ No newline at end of file +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/SkillGUI.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/SkillGUI.kt index 9db0642..fa217b9 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/SkillGUI.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/SkillGUI.kt @@ -18,12 +18,12 @@ import org.bukkit.inventory.meta.SkullMeta object SkillGUI { @JvmStatic - lateinit var homeMenu: Menu + private lateinit var menu: Menu @JvmStatic @ConfigUpdater fun update(plugin: EcoSkillsPlugin) { - homeMenu = buildHomeMenu(plugin) + menu = buildHomeMenu(plugin) } @JvmStatic @@ -66,22 +66,22 @@ object SkillGUI { if (plugin.configYml.getBool("gui.player-info.click-to-open-stats")) { onLeftClick { event, _ -> val player = event.whoClicked as Player - StatsGUI.menu.open(player) + StatsGUI.open(player) } } } ) - modfiy { menuBuilder -> - for (skill in Skills.values()) { - if (skill.enabled) { - menuBuilder.setSlot( - skill.config.getInt("gui.position.row"), - skill.config.getInt("gui.position.column"), - skill.gui.slot - ) - } + + for (skill in Skills.values()) { + if (skill.enabled) { + setSlot( + skill.config.getInt("gui.position.row"), + skill.config.getInt("gui.position.column"), + skill.gui.slot + ) } } + setSlot(plugin.configYml.getInt("gui.close.location.row"), plugin.configYml.getInt("gui.close.location.column"), slot( @@ -102,4 +102,8 @@ object SkillGUI { } } } + + fun open(player: Player) { + menu.open(player) + } } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/StatsGUI.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/StatsGUI.kt index 012bf66..fcbff5f 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/StatsGUI.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/StatsGUI.kt @@ -21,7 +21,7 @@ import org.bukkit.inventory.meta.SkullMeta object StatsGUI { @JvmStatic - lateinit var menu: Menu + private lateinit var menu: Menu @JvmStatic @ConfigUpdater @@ -111,7 +111,7 @@ object StatsGUI { .setDisplayName(plugin.configYml.getString("stats-gui.back.name")) .build() ) { - onLeftClick { event, _ -> SkillGUI.homeMenu.open(event.whoClicked as Player) } + onLeftClick { event, _ -> SkillGUI.open(event.whoClicked as Player) } } ) @@ -124,4 +124,8 @@ object StatsGUI { } } } + + fun open(player: Player) { + menu.open(player) + } } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillLevelGUI.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillLevelGUI.kt index 4f18efc..5ccc0d9 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillLevelGUI.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillLevelGUI.kt @@ -94,11 +94,11 @@ class SkillLevelGUI( }.build() }) { onLeftClick { event, _, _ -> - levels.open(event.whoClicked as Player) + menu.open(event.whoClicked as Player) } } - val levels: Menu + val menu: Menu init { val maskPattern = plugin.configYml.getStrings("level-gui.mask.pattern").toTypedArray() @@ -141,7 +141,7 @@ class SkillLevelGUI( val pageKey = "page" - levels = menu(plugin.configYml.getInt("level-gui.rows")) { + menu = menu(plugin.configYml.getInt("level-gui.rows")) { title = skill.levelName setMask( FillerMask( @@ -275,7 +275,7 @@ class SkillLevelGUI( page-- menu.setState(player, pageKey, page) if (page == 0) { - SkillGUI.homeMenu.open(event.whoClicked as Player) + SkillGUI.open(event.whoClicked as Player) } } } From eb2b7844f1714ea298ae531a2804a0cbf487d958 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 19 Nov 2022 19:53:58 +0000 Subject: [PATCH 09/12] Updated to 1.105.1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index b7ee18c..afe49b0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ #libreforge-updater #Thu Nov 17 08:38:30 GMT 2022 -version=1.105.0 +version=1.105.1 plugin-name=EcoSkills From d1ac5eca1f33b717531bf8d93559c579a8856c94 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 19 Nov 2022 19:55:10 +0000 Subject: [PATCH 10/12] Fixed tabcompletion --- .../willfp/ecoskills/commands/CommandSkills.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt index ee97b19..5d61be8 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt @@ -6,6 +6,7 @@ import com.willfp.ecoskills.gui.SkillGUI import com.willfp.ecoskills.skills.Skills import org.bukkit.command.CommandSender import org.bukkit.entity.Player +import org.bukkit.util.StringUtil class CommandSkills(plugin: EcoPlugin) : PluginCommand( @@ -42,4 +43,19 @@ class CommandSkills(plugin: EcoPlugin) : skill.gui.menu.open(sender) } + + override fun tabComplete(sender: CommandSender, args: List): List { + val completions = mutableListOf() + + if (args.size == 1) { + StringUtil.copyPartialMatches( + args[0], + Skills.values().map { it.id }, + completions + ) + return completions + } + + return emptyList() + } } From 47605e48854a38b1a91e1ce90925d6cea81d35e6 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 19 Nov 2022 19:56:07 +0000 Subject: [PATCH 11/12] Oops --- .../main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt index 5d61be8..2d1822b 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandSkills.kt @@ -31,6 +31,7 @@ class CommandSkills(plugin: EcoPlugin) : if (args.isEmpty()) { SkillGUI.open(sender) + return } val id = args[0].lowercase() From 685e3dbb2ba5c4bba3b81b70183c7a9f13a62a34 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 21 Nov 2022 15:58:06 +0300 Subject: [PATCH 12/12] Added prevent-multiple-bleeding: true/false to serrated strikes config --- .../ecoskills/effects/effects/EffectSerratedStrikes.kt | 8 ++++++++ eco-core/core-plugin/src/main/resources/effects.yml | 2 ++ 2 files changed, 10 insertions(+) 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/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