feat: release 0.18.0 version
1. optimize load logic 2. add root change detach 3. add common softdepends Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
ce92ae9ec6
commit
91a87ab20e
18
pom.xml
18
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>pw.yumc</groupId>
|
<groupId>pw.yumc</groupId>
|
||||||
<artifactId>MiaoScript</artifactId>
|
<artifactId>MiaoScript</artifactId>
|
||||||
<version>0.17.0</version>
|
<version>0.18.0</version>
|
||||||
<developers>
|
<developers>
|
||||||
<developer>
|
<developer>
|
||||||
<id>502647092</id>
|
<id>502647092</id>
|
||||||
@ -53,6 +53,10 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<env.GIT_COMMIT>DEV</env.GIT_COMMIT>
|
<env.GIT_COMMIT>DEV</env.GIT_COMMIT>
|
||||||
<update.changes>
|
<update.changes>
|
||||||
|
§622-02-16 §afeat: 优化 初始化逻辑 加快引擎加载速度;
|
||||||
|
§afeat: 新增 root 目录变更检测 变更后重新生成缓存;
|
||||||
|
§afeat: 添加常用库的软依赖;
|
||||||
|
§622-01-01 §afeat: 兼容JDK17 更新Nashorn;
|
||||||
§621-11-04 §afeat: 优化系统模块升级逻辑;
|
§621-11-04 §afeat: 优化系统模块升级逻辑;
|
||||||
§621-07-10 §afeat: 优化网络相关功能;
|
§621-07-10 §afeat: 优化网络相关功能;
|
||||||
§621-06-25 §afeat: 调整启动逻辑 兼容 Arclight;
|
§621-06-25 §afeat: 调整启动逻辑 兼容 Arclight;
|
||||||
@ -168,10 +172,6 @@
|
|||||||
<id>yumc-repo</id>
|
<id>yumc-repo</id>
|
||||||
<url>${repo.url}/repository/maven-public/</url>
|
<url>${repo.url}/repository/maven-public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>sponge</id>
|
|
||||||
<url>https://repo.spongepowered.org/maven/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
</repositories>
|
||||||
<pluginRepositories>
|
<pluginRepositories>
|
||||||
<pluginRepository>
|
<pluginRepository>
|
||||||
@ -190,7 +190,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.18</version>
|
<version>1.18.22</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.kamranzafar</groupId>
|
<groupId>org.kamranzafar</groupId>
|
||||||
@ -212,18 +212,18 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-api</artifactId>
|
<artifactId>bungeecord-api</artifactId>
|
||||||
<version>1.16-R0.4-SNAPSHOT</version>
|
<version>1.16-R0.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.nukkit</groupId>
|
<groupId>cn.nukkit</groupId>
|
||||||
<artifactId>nukkit</artifactId>
|
<artifactId>nukkit</artifactId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-websocket</artifactId>
|
<artifactId>spring-websocket</artifactId>
|
||||||
<version>5.2.6.RELEASE</version>
|
<version>5.3.13</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -13,12 +13,17 @@ import java.nio.file.Path;
|
|||||||
* Created on 2017/10/9 12:40.
|
* Created on 2017/10/9 12:40.
|
||||||
*/
|
*/
|
||||||
public class Base {
|
public class Base {
|
||||||
|
public static final String VERSION = "0.18.0";
|
||||||
private Object instance;
|
private Object instance;
|
||||||
|
|
||||||
public Base(Object instance) {
|
public Base(Object instance) {
|
||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return Base.VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
public Class<?> getClass(String name) throws ClassNotFoundException {
|
public Class<?> getClass(String name) throws ClassNotFoundException {
|
||||||
return Class.forName(name);
|
return Class.forName(name);
|
||||||
}
|
}
|
||||||
@ -39,10 +44,10 @@ public class Base {
|
|||||||
return new String(Files.readAllBytes(new File(path).toPath()), StandardCharsets.UTF_8);
|
return new String(Files.readAllBytes(new File(path).toPath()), StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(String path, String content) throws IOException {
|
public Path save(String path, String content) throws IOException {
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
file.getParentFile().mkdirs();
|
file.getParentFile().mkdirs();
|
||||||
Files.write(file.toPath(), content.getBytes(StandardCharsets.UTF_8));
|
return Files.write(file.toPath(), content.getBytes(StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean move(String source, String target) {
|
public boolean move(String source, String target) {
|
||||||
@ -54,8 +59,8 @@ public class Base {
|
|||||||
return delete(new File(path));
|
return delete(new File(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(Path path) throws IOException {
|
public boolean delete(Path path) throws IOException {
|
||||||
delete(path.toFile());
|
return delete(path.toFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean delete(File file) throws IOException {
|
public boolean delete(File file) throws IOException {
|
||||||
|
@ -9,12 +9,11 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
* @author 喵♂呜
|
* @author 喵♂呜
|
||||||
* @since 2016年8月29日 上午7:50:39
|
* @since 2016年8月29日 上午7:50:39
|
||||||
*/
|
*/
|
||||||
public class MiaoScript extends JavaPlugin {
|
public class MiaoScriptBukkit extends JavaPlugin {
|
||||||
private ScriptEngine engine;
|
private ScriptEngine engine;
|
||||||
|
|
||||||
@Override
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public void onLoad() {
|
public MiaoScriptBukkit() {
|
||||||
ClassLoader origin = Thread.currentThread().getContextClassLoader();
|
ClassLoader origin = Thread.currentThread().getContextClassLoader();
|
||||||
Thread.currentThread().setContextClassLoader(getClassLoader());
|
Thread.currentThread().setContextClassLoader(getClassLoader());
|
||||||
engine = new ScriptEngine(getDataFolder().getCanonicalPath(), getLogger(), this);
|
engine = new ScriptEngine(getDataFolder().getCanonicalPath(), getLogger(), this);
|
||||||
@ -22,6 +21,10 @@ public class MiaoScript extends JavaPlugin {
|
|||||||
engine.loadEngine();
|
engine.loadEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
engine.enableEngine();
|
engine.enableEngine();
|
||||||
@ -30,5 +33,6 @@ public class MiaoScript extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
engine.disableEngine();
|
engine.disableEngine();
|
||||||
|
engine = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,14 +12,17 @@ import net.md_5.bungee.api.plugin.Plugin;
|
|||||||
public class MiaoScriptBungee extends Plugin {
|
public class MiaoScriptBungee extends Plugin {
|
||||||
private ScriptEngine engine;
|
private ScriptEngine engine;
|
||||||
|
|
||||||
@Override
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public void onLoad() {
|
public MiaoScriptBungee() {
|
||||||
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
|
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
|
||||||
engine = new ScriptEngine(getDataFolder().getCanonicalPath(), getLogger(), this);
|
engine = new ScriptEngine(getDataFolder().getCanonicalPath(), getLogger(), this);
|
||||||
engine.loadEngine();
|
engine.loadEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
engine.enableEngine();
|
engine.enableEngine();
|
||||||
|
@ -112,11 +112,11 @@ public class MiaoScriptEngine implements ScriptEngine, Invocable {
|
|||||||
File libRootFile = new File(engineRoot, "lib");
|
File libRootFile = new File(engineRoot, "lib");
|
||||||
libRootFile.mkdirs();
|
libRootFile.mkdirs();
|
||||||
String libRoot = libRootFile.getCanonicalPath();
|
String libRoot = libRootFile.getCanonicalPath();
|
||||||
downloadJar(libRoot, "org.openjdk.nashorn", "nashorn-core", "15.2");
|
downloadJar(libRoot, "org.openjdk.nashorn", "nashorn-core", "15.3");
|
||||||
downloadJar(libRoot, "org.ow2.asm", "asm", "9.1");
|
downloadJar(libRoot, "org.ow2.asm", "asm", "9.2");
|
||||||
downloadJar(libRoot, "org.ow2.asm", "asm-commons", "9.1");
|
downloadJar(libRoot, "org.ow2.asm", "asm-commons", "9.2");
|
||||||
downloadJar(libRoot, "org.ow2.asm", "asm-tree", "9.1");
|
downloadJar(libRoot, "org.ow2.asm", "asm-tree", "9.2");
|
||||||
downloadJar(libRoot, "org.ow2.asm", "asm-util", "9.1");
|
downloadJar(libRoot, "org.ow2.asm", "asm-util", "9.2");
|
||||||
this.createEngineByName("nashorn");
|
this.createEngineByName("nashorn");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ public class MiaoScriptEngine implements ScriptEngine, Invocable {
|
|||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
private void downloadJar(String engineRoot, String groupId, String artifactId, String version) {
|
private void downloadJar(String engineRoot, String groupId, String artifactId, String version) {
|
||||||
File lib = new File(engineRoot, artifactId + ".jar");
|
File lib = new File(engineRoot, String.format("%s-%s.jar", artifactId, version));
|
||||||
if (!lib.exists()) {
|
if (!lib.exists()) {
|
||||||
Files.copy(new URL(MavenRepo +
|
Files.copy(new URL(MavenRepo +
|
||||||
String.format("/%1$s/%2$s/%3$s/%2$s-%3$s.jar",
|
String.format("/%1$s/%2$s/%3$s/%2$s-%3$s.jar",
|
||||||
|
@ -9,12 +9,15 @@ import lombok.SneakyThrows;
|
|||||||
public class MiaoScriptNukkit extends PluginBase {
|
public class MiaoScriptNukkit extends PluginBase {
|
||||||
private ScriptEngine engine;
|
private ScriptEngine engine;
|
||||||
|
|
||||||
@Override
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public void onLoad() {
|
public MiaoScriptNukkit() {
|
||||||
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
|
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
|
||||||
engine = new ScriptEngine(getDataFolder().getCanonicalPath(), getLogger(), this);
|
engine = new ScriptEngine(getDataFolder().getCanonicalPath(), super.getLogger(), this);
|
||||||
engine.enableEngine();
|
engine.loadEngine();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package pw.yumc.MiaoScript;
|
package pw.yumc.MiaoScript;
|
||||||
|
|
||||||
import java.io.File;
|
import com.google.inject.Inject;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.spongepowered.api.config.ConfigDir;
|
import org.spongepowered.api.config.ConfigDir;
|
||||||
import org.spongepowered.api.event.Listener;
|
import org.spongepowered.api.event.Listener;
|
||||||
@ -11,8 +11,7 @@ import org.spongepowered.api.event.game.state.GameStartingServerEvent;
|
|||||||
import org.spongepowered.api.event.game.state.GameStoppingServerEvent;
|
import org.spongepowered.api.event.game.state.GameStoppingServerEvent;
|
||||||
import org.spongepowered.api.plugin.Plugin;
|
import org.spongepowered.api.plugin.Plugin;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import java.io.File;
|
||||||
import lombok.SneakyThrows;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created with IntelliJ IDEA
|
* Created with IntelliJ IDEA
|
||||||
@ -20,7 +19,7 @@ import lombok.SneakyThrows;
|
|||||||
* @author 喵♂呜
|
* @author 喵♂呜
|
||||||
* Created on 2017/10/25 20:35.
|
* Created on 2017/10/25 20:35.
|
||||||
*/
|
*/
|
||||||
@Plugin(id = "miaoscript", name = "MiaoScript", version = "1.0", authors = "MiaoWoo")
|
@Plugin(id = "miaoscript", name = "MiaoScript", version = Base.VERSION, authors = "MiaoWoo")
|
||||||
public class MiaoScriptSponge {
|
public class MiaoScriptSponge {
|
||||||
private ScriptEngine engine;
|
private ScriptEngine engine;
|
||||||
@Inject
|
@Inject
|
||||||
@ -55,6 +54,7 @@ public class MiaoScriptSponge {
|
|||||||
public void reload(GameReloadEvent event) {
|
public void reload(GameReloadEvent event) {
|
||||||
engine.disableEngine();
|
engine.disableEngine();
|
||||||
engine = new ScriptEngine(pluginConfigDir.getCanonicalPath(), logger, this);
|
engine = new ScriptEngine(pluginConfigDir.getCanonicalPath(), logger, this);
|
||||||
|
engine.loadEngine();
|
||||||
engine.enableEngine();
|
engine.enableEngine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ var global = this;
|
|||||||
/**
|
/**
|
||||||
* Init MiaoScriptEngine Runtime
|
* Init MiaoScriptEngine Runtime
|
||||||
*/
|
*/
|
||||||
/*global base */
|
/*global base ScriptEngineContextHolder*/
|
||||||
(function () {
|
(function () {
|
||||||
var Files = Java.type('java.nio.file.Files')
|
var Files = Java.type('java.nio.file.Files')
|
||||||
var Paths = Java.type('java.nio.file.Paths')
|
var Paths = Java.type('java.nio.file.Paths')
|
||||||
|
@ -526,7 +526,12 @@
|
|||||||
require.clear = __DynamicClear__
|
require.clear = __DynamicClear__
|
||||||
require.disable = __DynamicDisable__
|
require.disable = __DynamicDisable__
|
||||||
require.setUpgradeMode = __setUpgradeMode__
|
require.setUpgradeMode = __setUpgradeMode__
|
||||||
require.core_modules = CoreModules
|
require.internal = {
|
||||||
|
coreModules: CoreModules,
|
||||||
|
cacheModules: cacheModules,
|
||||||
|
cacheModuleIds: cacheModuleIds,
|
||||||
|
notFoundModules: notFoundModules,
|
||||||
|
}
|
||||||
return require
|
return require
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,7 +545,7 @@
|
|||||||
var cacheModuleIdsFile = _canonical(new File(NODE_PATH, 'cacheModuleIds.json'))
|
var cacheModuleIdsFile = _canonical(new File(NODE_PATH, 'cacheModuleIds.json'))
|
||||||
var localVersionLockFile = _canonical(new File(NODE_PATH, 'moduleVersionLock.json'))
|
var localVersionLockFile = _canonical(new File(NODE_PATH, 'moduleVersionLock.json'))
|
||||||
/**
|
/**
|
||||||
* @type {{[key:string]:{[key:string]:string}}} cacheModuleIds
|
* @type {{[key:string]:{[key:string]:string}|string}} cacheModuleIds
|
||||||
*/
|
*/
|
||||||
var cacheModuleIds = {}
|
var cacheModuleIds = {}
|
||||||
/**
|
/**
|
||||||
@ -559,10 +564,14 @@
|
|||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
cacheModuleIds = JSON.parse(base.read(cacheModuleIdsFile))
|
cacheModuleIds = JSON.parse(base.read(cacheModuleIdsFile))
|
||||||
|
if (cacheModuleIds['@ccms-cache-module-root'] != NODE_PATH) {
|
||||||
|
throw new Error('canonicalRoot Change ' + cacheModuleIds['@ccms-cache-module-root'] + ' to ' + NODE_PATH + ' Clear Cache!')
|
||||||
|
}
|
||||||
console.log('Read cacheModuleIds from file ' + cacheModuleIdsFile)
|
console.log('Read cacheModuleIds from file ' + cacheModuleIdsFile)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
cacheModuleIds = {}
|
cacheModuleIds = {}
|
||||||
console.log('Initialization new cacheModuleIds')
|
cacheModuleIds['@ccms-cache-module-root'] = NODE_PATH
|
||||||
|
console.log('Initialization new cacheModuleIds: ' + error)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ModulesVersionLock = JSON.parse(fetchContent('http://ms.yumc.pw/api/plugin/download/name/version_lock'))
|
ModulesVersionLock = JSON.parse(fetchContent('http://ms.yumc.pw/api/plugin/download/name/version_lock'))
|
||||||
|
@ -1,12 +1,22 @@
|
|||||||
name: ${project.artifactId}
|
name: ${project.artifactId}
|
||||||
description: ${project.description}
|
description: ${project.description}
|
||||||
main: ${project.groupId}.${project.artifactId}.${project.artifactId}
|
main: ${project.groupId}.${project.artifactId}.${project.artifactId}Bukkit
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
author: MiaoWoo
|
author: MiaoWoo
|
||||||
website: ${ciManagement.url}
|
website: ${ciManagement.url}
|
||||||
load: STARTUP
|
|
||||||
softdepend:
|
softdepend:
|
||||||
- PlaceholderAPI
|
- PlaceholderAPI
|
||||||
|
- AttributePlus
|
||||||
|
- PlayerPoints
|
||||||
|
- CrazyCrates
|
||||||
- ProtocolLib
|
- ProtocolLib
|
||||||
|
- DragonCore
|
||||||
|
- MythicMobs
|
||||||
|
- WorldGuard
|
||||||
|
- Adyeshach
|
||||||
|
- WorldEdit
|
||||||
|
- SkillAPI
|
||||||
|
- TradeMe
|
||||||
|
- Chemdah
|
||||||
- Vault
|
- Vault
|
||||||
|
Loading…
Reference in New Issue
Block a user