mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-24 00:26:16 +02:00
Write default config on enchant registering.
Fix Enchantment Squared group not adding element.
This commit is contained in:
parent
a5c647776c
commit
fc7e85529c
6 changed files with 90 additions and 92 deletions
|
|
@ -1,13 +1,9 @@
|
|||
package xyz.alexcrea.cuanvil.dependency
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.configuration.file.FileConfiguration
|
||||
import org.bukkit.plugin.Plugin
|
||||
import xyz.alexcrea.cuanvil.dependency.protocolib.NoProtocoLib
|
||||
import xyz.alexcrea.cuanvil.dependency.protocolib.PacketManager
|
||||
import xyz.alexcrea.cuanvil.dependency.protocolib.ProtocoLibWrapper
|
||||
import xyz.alexcrea.cuanvil.enchant.CAEnchantment
|
||||
import java.io.File
|
||||
|
||||
object DependencyManager {
|
||||
|
||||
|
|
@ -21,7 +17,7 @@ object DependencyManager {
|
|||
// ProtocolLib dependency
|
||||
packetManager =
|
||||
if(pluginManager.isPluginEnabled("ProtocolLib")) ProtocoLibWrapper()
|
||||
else NoProtocoLib()
|
||||
else NoProtocoLib()
|
||||
|
||||
// Enchantment Squared dependency
|
||||
if(pluginManager.isPluginEnabled("EnchantsSquared")){
|
||||
|
|
@ -37,22 +33,11 @@ object DependencyManager {
|
|||
|
||||
}
|
||||
|
||||
fun handleCompatibilityConfig(plugin: Plugin) {
|
||||
val folder = File(plugin.dataFolder, "compatibility")
|
||||
|
||||
fun handleCompatibilityConfig() {
|
||||
enchantmentSquaredCompatibility?.registerPluginConfiguration()
|
||||
ecoEnchantCompatibility?.registerPluginConfiguration(folder)
|
||||
|
||||
}
|
||||
|
||||
fun writeDefaultConfig(defaultConfig: FileConfiguration, enchantment: CAEnchantment) {
|
||||
defaultConfig["enchant_limits.${enchantment.key.key}"] = enchantment.defaultMaxLevel()
|
||||
|
||||
val rarity = enchantment.defaultRarity()
|
||||
defaultConfig["enchant_values.${enchantment.key.key}.item"] = rarity.itemValue
|
||||
defaultConfig["enchant_values.${enchantment.key.key}.book"] = rarity.bookValue
|
||||
}
|
||||
|
||||
fun registerEnchantments() {
|
||||
enchantmentSquaredCompatibility?.registerEnchantments()
|
||||
ecoEnchantCompatibility?.registerEnchantments()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue