mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-08-28 08:25:56 +02:00
language backend logic
This commit is contained in:
parent
4b8e71c5e9
commit
1f00a32750
5 changed files with 179 additions and 9 deletions
|
|
@ -17,6 +17,7 @@ import xyz.alexcrea.cuanvil.dependency.util.PlatformUtil
|
|||
import xyz.alexcrea.cuanvil.enchant.CAEnchantmentRegistry
|
||||
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui
|
||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant
|
||||
import xyz.alexcrea.cuanvil.lang.Lang
|
||||
import xyz.alexcrea.cuanvil.listener.AnvilCloseListener
|
||||
import xyz.alexcrea.cuanvil.listener.AnvilResultListener
|
||||
import xyz.alexcrea.cuanvil.listener.ChatEventListener
|
||||
|
|
@ -135,6 +136,25 @@ open class CustomAnvil : JavaPlugin() {
|
|||
*/
|
||||
override fun onEnable() {
|
||||
instance = this
|
||||
// Load default configuration
|
||||
try {
|
||||
if(!ConfigHolder.loadDefaultConfig())
|
||||
throw RuntimeException("Error loading configuration file")
|
||||
} catch (e: Exception) {
|
||||
logger.log(Level.SEVERE, "error occurred loading default configuration", e)
|
||||
MetricsUtil.trackError(e)
|
||||
if(tryDirtyStart()) return
|
||||
}
|
||||
|
||||
// Load language
|
||||
try {
|
||||
Lang.reload()
|
||||
} catch (e: Exception) {
|
||||
logger.log(Level.SEVERE, "error occurred loading language file", e)
|
||||
MetricsUtil.trackError(e)
|
||||
if(tryDirtyStart()) return
|
||||
}
|
||||
|
||||
try {
|
||||
legacyCheck()
|
||||
} catch (e: Exception) {
|
||||
|
|
@ -143,6 +163,7 @@ open class CustomAnvil : JavaPlugin() {
|
|||
if(trySafeStart()) return
|
||||
}
|
||||
|
||||
|
||||
// Add commands
|
||||
try {
|
||||
CustomAnvilCommand(this)
|
||||
|
|
@ -152,15 +173,6 @@ open class CustomAnvil : JavaPlugin() {
|
|||
if(trySafeStart()) return
|
||||
}
|
||||
|
||||
// Load default configuration
|
||||
try {
|
||||
if(!ConfigHolder.loadDefaultConfig())
|
||||
throw RuntimeException("Error loading configuration file")
|
||||
} catch (e: Exception) {
|
||||
logger.log(Level.SEVERE, "error occurred loading default configuration", e)
|
||||
MetricsUtil.trackError(e)
|
||||
if(tryDirtyStart()) return
|
||||
}
|
||||
|
||||
// Load dependency
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue