From 0fa2b146ee915ee4cf5d92287e3a9e0310cb4cf7 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 10 Jan 2022 17:21:00 +0300 Subject: [PATCH 1/3] Fixed toggle sound command --- .../kotlin/com/willfp/ecoskills/commands/CommandToggleSound.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandToggleSound.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandToggleSound.kt index 7bcb3b9..c689f35 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandToggleSound.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandToggleSound.kt @@ -23,7 +23,7 @@ class CommandToggleSound(plugin: EcoPlugin) : ) { override fun onExecute(sender: CommandSender, args: List) { - if (this.plugin.configYml.getBool("skills.progress.sound.enabled")) { + if (!this.plugin.configYml.getBool("skills.progress.sound.enabled")) { sender.sendMessage(this.plugin.langYml.getMessage("xp-gain-sound-disabled")) return } From f91d46a645e598c60bf01233d2ddea9cda5620e3 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 10 Jan 2022 19:03:39 +0300 Subject: [PATCH 2/3] Added commands support to Eye Of The Depth effect (command::ban %player%) --- .../effects/effects/EffectEyeOfTheDepths.kt | 46 +++++++++++++++---- .../src/main/resources/effects.yml | 2 +- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEyeOfTheDepths.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEyeOfTheDepths.kt index 776e8cb..2dca598 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEyeOfTheDepths.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEyeOfTheDepths.kt @@ -5,9 +5,13 @@ import com.willfp.eco.core.items.Items import com.willfp.eco.util.NumberUtils import com.willfp.ecoskills.effects.Effect import com.willfp.ecoskills.getEffectLevel +import org.bukkit.Bukkit +import org.bukkit.Location +import org.bukkit.entity.Player import org.bukkit.event.EventHandler import org.bukkit.event.EventPriority import org.bukkit.event.player.PlayerFishEvent +import org.bukkit.inventory.ItemStack class EffectEyeOfTheDepths: Effect( "eye_of_the_depths" @@ -38,13 +42,39 @@ class EffectEyeOfTheDepths: Effect( val items = config.getStrings("rare-loot-items") - val itemName = items[NumberUtils.randInt(0, items.size - 1)] + val reward = items[NumberUtils.randInt(0, items.size - 1)] - val item = Items.lookup(itemName).item - - DropQueue(player) - .setLocation(event.caught!!.location) - .addItem(item) - .push() + LootReward.fromString(reward).reward(player, event.caught!!.location) } -} \ No newline at end of file + + class LootReward( + private val item: ItemStack? = null, + private val command: String? = null + ) + { + companion object { + @JvmStatic + fun fromString(from: String): LootReward { + return if (from.startsWith("command::", true)) { + LootReward(command = from.replace("command::", "").replace("command:: ", "")) + } else { + LootReward(item = Items.lookup(from).item) + } + } + } + + fun reward(player: Player, location: Location = player.location) { + if (item != null) { + DropQueue(player) + .setLocation(location) + .addItem(item) + .push() + } + else { + command?.let { Bukkit.dispatchCommand(Bukkit.getConsoleSender(), it.replace("%player%", player.name)) } + } + + } + } +} + diff --git a/eco-core/core-plugin/src/main/resources/effects.yml b/eco-core/core-plugin/src/main/resources/effects.yml index 798f48f..87f3441 100644 --- a/eco-core/core-plugin/src/main/resources/effects.yml +++ b/eco-core/core-plugin/src/main/resources/effects.yml @@ -30,7 +30,7 @@ eye_of_the_depths: # Disabled worlds disabled-in-worlds: [] - rare-loot-items: + rare-loot-items: # Either an item from items lookup system, or a command (- command: say %player% is cool) - enchanted_book confusion:1 - enchanted_book confusion:2 - netherite_ingot From d7bc01c5eb1803b93272560d444dc40308c41add Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 10 Jan 2022 19:10:17 +0300 Subject: [PATCH 3/3] Added more farming materials to Farming skill rewards --- eco-core/core-plugin/src/main/resources/skills/farming.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/resources/skills/farming.yml b/eco-core/core-plugin/src/main/resources/skills/farming.yml index 721712e..54fd0ac 100644 --- a/eco-core/core-plugin/src/main/resources/skills/farming.yml +++ b/eco-core/core-plugin/src/main/resources/skills/farming.yml @@ -83,4 +83,8 @@ xp-rewards: - "sugar_cane:2" - "brown_mushroom:6" - "red_mushroom:6" - - "cocoa:3" \ No newline at end of file + - "cocoa:3" + - "nether_wart:4" + - "bamboo:1" + - "sweet_berries:3" + - "glow_berries:3" \ No newline at end of file