fix: bukkit chat init error & config save error

This commit is contained in:
MiaoWoo 2020-08-14 16:05:44 +08:00
parent 606f097989
commit d01938487a
2 changed files with 4 additions and 3 deletions

View File

@ -13,8 +13,7 @@ let downgrade = false
/**
* NMS版本
*/
//@ts-ignore
let nmsVersion = org.bukkit.Bukkit.server.class.name.split('.')[3]
let nmsVersion = undefined
/**
* NMS类
*/
@ -47,6 +46,8 @@ function remapFieldName(clazz: any, origin: string, test: string) {
}
function init() {
//@ts-ignore
nmsVersion = org.bukkit.Bukkit.server.class.name.split('.')[3]
try {
RemapUtils = Java.type('catserver.server.remapper.RemapUtils')
} catch (ex) {

View File

@ -43,7 +43,7 @@ function loadConfig(plugin: plugin.Plugin) {
base.save(configFile, configFactory.dump(plugin[config.variable]))
console.i18n("ms.plugin.manager.config.save.default", { plugin: plugin.description.name, name: config.name, format: config.format })
} else {
plugin[config.variable] = configFactory.load(base.read(configFile))
Object.defineProperty(plugin, config.variable, { value: configFactory.load(base.read(configFile)) })
plugin[config.variable].save = () => {
let result = configFactory.dump(plugin[config.variable])
base.save(configFile, result)