使用新语法

This commit is contained in:
哆啦好梦
2023-03-07 19:12:11 +08:00
parent 948084cbc1
commit 20ae074a3b
12 changed files with 66 additions and 51 deletions

View File

@@ -1,7 +1,8 @@
const getPort = require('get-port');
const server = require("./server");
const electronApp = require('electron').app;
const { app: electronApp } = require('electron');
const Log = require('ee-core/log');
const Conf = require('ee-core/config');
/**
* java server插件
@@ -11,8 +12,8 @@ class JavaServerAddon {
constructor(app) {
this.app = app;
this.cfg = app.config.addons.javaServer;
this.javaServer = null;
this.cfg;
this.javaServer;
}
/**
@@ -22,10 +23,12 @@ class JavaServerAddon {
* @since 1.0.0
*/
async createServer () {
this.cfg = Conf.getValue('addons.javaServer');
await this.createJavaPorts();
this.javaServer = new server(this.app);
await this.javaServer.create();
this.javaServer = new server();
await this.javaServer.create(this.cfg);
// kill
electronApp.on("before-quit", async () => {
@@ -61,7 +64,7 @@ class JavaServerAddon {
this.cfg.port = javaPort;
// 更新config配置
this.app.getCoreDB().setItem("config", this.app.config);
Conf.setValue('addons.javaServer', this.cfg);
}
/**