From b95a818996daa629f445e7456df92deb5428b870 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 3 Oct 2022 19:08:15 +0300 Subject: [PATCH 1/3] Cursed refactor ? --- .../willfp/ecoenchants/commands/CommandGiveRandomBook.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandGiveRandomBook.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandGiveRandomBook.kt index d2edcc21..5f09be9f 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandGiveRandomBook.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandGiveRandomBook.kt @@ -84,7 +84,11 @@ class CommandGiveRandomBook(plugin: EcoPlugin) : PluginCommand( 1 -> Bukkit.getOnlinePlayers().map { it.name } 2 -> (EnchantmentRarities.values().map { it.id } + EnchantmentTypes.values().map { it.id }) 3 -> (1..10).map { it.toString() } - 4 -> ((args[3].toIntOrNull() ?: 1)..(args[3].toIntOrNull() ?: 1) + 10).map { it.toString() } + 4 -> { + val startLevel = args[3].toIntOrNull() ?: 1 + val endLevel = startLevel + 10 + (startLevel..endLevel).map { it.toString() } + } else -> emptyList() } } From 4839bbe72f389c96e7741cb81e9d4fc17bd2da99 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 3 Oct 2022 19:08:15 +0300 Subject: [PATCH 2/3] Cursed refactor ? --- .../willfp/ecoenchants/commands/CommandGiveRandomBook.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandGiveRandomBook.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandGiveRandomBook.kt index d2edcc21..5f09be9f 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandGiveRandomBook.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandGiveRandomBook.kt @@ -84,7 +84,11 @@ class CommandGiveRandomBook(plugin: EcoPlugin) : PluginCommand( 1 -> Bukkit.getOnlinePlayers().map { it.name } 2 -> (EnchantmentRarities.values().map { it.id } + EnchantmentTypes.values().map { it.id }) 3 -> (1..10).map { it.toString() } - 4 -> ((args[3].toIntOrNull() ?: 1)..(args[3].toIntOrNull() ?: 1) + 10).map { it.toString() } + 4 -> { + val startLevel = args[3].toIntOrNull() ?: 1 + val endLevel = startLevel + 10 + (startLevel..endLevel).map { it.toString() } + } else -> emptyList() } } From 471de1a308f5fd8f6ed0bf2a62f2342bb4e374b5 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Sun, 23 Oct 2022 15:49:58 +0300 Subject: [PATCH 3/3] vanillaenchants config reverting fix --- .../main/kotlin/com/willfp/ecoenchants/config/Configs.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/config/Configs.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/config/Configs.kt index c12dd272..afbbf118 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/config/Configs.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/config/Configs.kt @@ -3,8 +3,13 @@ package com.willfp.ecoenchants.config import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.config.BaseConfig import com.willfp.eco.core.config.ConfigType +import com.willfp.eco.core.config.ExtendableConfig +import com.willfp.ecoenchants.enchants.EcoEnchant +import org.bukkit.enchantments.Enchantment class TypesYml(plugin: EcoPlugin) : BaseConfig("types", plugin, true, ConfigType.YAML) class TargetsYml(plugin: EcoPlugin) : BaseConfig("targets", plugin, true, ConfigType.YAML) class RarityYml(plugin: EcoPlugin) : BaseConfig("rarity", plugin, true, ConfigType.YAML) -class VanillaEnchantsYml(plugin: EcoPlugin) : BaseConfig("vanillaenchants", plugin, true, ConfigType.YAML) +class VanillaEnchantsYml(plugin: EcoPlugin) : ExtendableConfig("vanillaenchants", true, plugin, + plugin.javaClass, "", ConfigType.YAML, *Enchantment.values().filter { it !is EcoEnchant } + .map { it.key.key.lowercase() }.toTypedArray())