mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Fix reload command not executing the config event.
Also lazy loading of config guis.
This commit is contained in:
parent
e39bee5952
commit
03ae19e8a7
10 changed files with 109 additions and 32 deletions
|
|
@ -128,6 +128,10 @@ class CustomAnvil : JavaPlugin() {
|
|||
// temporary: handle 1.21 update
|
||||
Update_1_21.handleUpdate()
|
||||
|
||||
// Register enchantment of compatible plugin and load configuration change.
|
||||
DependencyManager.handleCompatibilityConfig()
|
||||
|
||||
// Call config event
|
||||
val configReadyEvent = CAConfigReadyEvent()
|
||||
server.pluginManager.callEvent(configReadyEvent)
|
||||
|
||||
|
|
@ -135,8 +139,6 @@ class CustomAnvil : JavaPlugin() {
|
|||
MainConfigGui.getInstance().init(DependencyManager.packetManager)
|
||||
GuiSharedConstant.loadConstants()
|
||||
|
||||
// Register enchantment of compatible plugin and load configuration change.
|
||||
DependencyManager.handleCompatibilityConfig()
|
||||
}
|
||||
|
||||
fun reloadResource(
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
package xyz.alexcrea.cuanvil.command
|
||||
|
||||
import io.delilaheve.CustomAnvil
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.command.Command
|
||||
import org.bukkit.command.CommandExecutor
|
||||
import org.bukkit.command.CommandSender
|
||||
import xyz.alexcrea.cuanvil.api.event.CAConfigReadyEvent
|
||||
import xyz.alexcrea.cuanvil.config.ConfigHolder
|
||||
import xyz.alexcrea.cuanvil.dependency.DependencyManager
|
||||
import xyz.alexcrea.cuanvil.gui.config.global.*
|
||||
import xyz.alexcrea.cuanvil.update.Update_1_21
|
||||
|
||||
class ReloadExecutor : CommandExecutor {
|
||||
override fun onCommand(sender: CommandSender, cmd: Command, cmdstr: String, args: Array<out String>): Boolean {
|
||||
|
|
@ -39,10 +43,20 @@ class ReloadExecutor : CommandExecutor {
|
|||
EnchantCostConfigGui.getInstance()?.updateGuiValues()
|
||||
EnchantLimitConfigGui.getInstance()?.updateGuiValues()
|
||||
|
||||
EnchantConflictGui.INSTANCE.reloadValues()
|
||||
GroupConfigGui.INSTANCE.reloadValues()
|
||||
UnitRepairConfigGui.INSTANCE.reloadValues()
|
||||
CustomRecipeConfigGui.INSTANCE.reloadValues()
|
||||
EnchantConflictGui.getCurrentInstance()?.reloadValues()
|
||||
GroupConfigGui.getCurrentInstance()?.reloadValues()
|
||||
UnitRepairConfigGui.getCurrentInstance()?.reloadValues()
|
||||
CustomRecipeConfigGui.getCurrentInstance()?.reloadValues()
|
||||
|
||||
// temporary: handle 1.21 update
|
||||
Update_1_21.handleUpdate()
|
||||
|
||||
// Register enchantment of compatible plugin and load configuration change.
|
||||
DependencyManager.handleCompatibilityConfig()
|
||||
|
||||
// Call event
|
||||
val configReadyEvent = CAConfigReadyEvent()
|
||||
Bukkit.getServer().pluginManager.callEvent(configReadyEvent)
|
||||
|
||||
return true
|
||||
} catch (e: Exception) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue