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

View File

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