From d01938487a01a79daae7cbc8766766da20f82163 Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Fri, 14 Aug 2020 16:05:44 +0800 Subject: [PATCH] fix: bukkit chat init error & config save error --- packages/bukkit/src/enhance/chat.ts | 5 +++-- packages/plugin/src/config.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/bukkit/src/enhance/chat.ts b/packages/bukkit/src/enhance/chat.ts index a058107f..e9fce741 100644 --- a/packages/bukkit/src/enhance/chat.ts +++ b/packages/bukkit/src/enhance/chat.ts @@ -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) { diff --git a/packages/plugin/src/config.ts b/packages/plugin/src/config.ts index 26b6aea9..230b7836 100644 --- a/packages/plugin/src/config.ts +++ b/packages/plugin/src/config.ts @@ -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)