Skip to content

Commit 074e6e8

Browse files
committed
feat: remove spring support & optimize require
1 parent 14cc05e commit 074e6e8

18 files changed

Lines changed: 222 additions & 319 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ vendor/
5353
# Minecraft Data
5454
/world
5555
**/node_modules/
56+
57+
# Gradle
58+
.gradle

CHANGELOG.md

Whitespace-only changes.

pom.xml

Lines changed: 14 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>pw.yumc</groupId>
44
<artifactId>MiaoScript</artifactId>
5-
<version>0.23.1</version>
5+
<version>0.28.0</version>
66
<developers>
77
<developer>
88
<id>502647092</id>
99
<name>MiaoWoo</name>
1010
<email>admin@yumc.pw</email>
11-
<url>http://www.yumc.pw</url>
11+
<url>https://www.yumc.pw</url>
1212
</developer>
1313
</developers>
1414
<build>
@@ -19,29 +19,6 @@
1919
<filtering>true</filtering>
2020
</resource>
2121
</resources>
22-
<plugins>
23-
<plugin>
24-
<groupId>org.apache.maven.plugins</groupId>
25-
<artifactId>maven-shade-plugin</artifactId>
26-
<version>3.2.1</version>
27-
<configuration>
28-
<createDependencyReducedPom>false</createDependencyReducedPom>
29-
<artifactSet>
30-
<includes>
31-
<include>org.kamranzafar:jtar</include>
32-
</includes>
33-
</artifactSet>
34-
</configuration>
35-
<executions>
36-
<execution>
37-
<phase>package</phase>
38-
<goals>
39-
<goal>shade</goal>
40-
</goals>
41-
</execution>
42-
</executions>
43-
</plugin>
44-
</plugins>
4522
</build>
4623
<ciManagement>
4724
<system>Jenkins</system>
@@ -50,6 +27,16 @@
5027
<properties>
5128
<env.GIT_COMMIT>DEV</env.GIT_COMMIT>
5229
<update.changes>
30+
§623-07-30 §afeat: 优化 require 性能;
31+
      §cfix: 修复 require 加载特殊文件异常;
32+
§623-07-22 §afeat: 网络加载 jtar 优化包大小;
33+
      §afeat: 移除 Spring 相关支持;
34+
      §aremove: 移除 Spring 相关支持;
35+
      §adeps: 更新 Nashorn 和 GraalvmJS 引擎版本
36+
</update.changes>
37+
<update.changelog>
38+
§622-11-22 §afeat: 兼容 1.7.10-1.19.2 版本;
39+
      §afeat: 新增 MiaoScriptAPI 相关方法;
5340
§622-06-21 §afeat: 兼容 1.7.10-1.19 版本;
5441
      §afeat: 兼容 JDK17 BungeeCord;
5542
§622-05-25 §afeat: 兼容 1.7.10-1.18.2 版本;
@@ -61,7 +48,7 @@
6148
      §afeat: 新增 自定义类型加载逻辑;
6249
§622-02-16 §afeat: 新增 MiaoScriptAPI;
6350
      §afeat: 新增 ScriptEvent;
64-
      §afeat: 新增 .mjs.json 类型加载;
51+
      §afeat: 新增 .mjs .json 类型加载;
6552
§622-02-16 §afeat: 优化 初始化逻辑 加快引擎加载速度;
6653
      §afeat: 新增 root 目录变更检测 变更后重新生成缓存;
6754
      §afeat: 添加常用库的软依赖;
@@ -71,9 +58,7 @@
7158
§621-06-25 §afeat: 调整启动逻辑 兼容 Arclight;
7259
§621-06-22 §afeat: 新增本地版本锁定功能;
7360
§621-06-19 §afeat: 兼容JDK16 反射异常;
74-
§621-05-15 §afeat: 兼容JDK15+ 自动下载Nashorn类库
75-
</update.changes>
76-
<update.changelog>
61+
§621-05-15 §afeat: 兼容JDK15+ 自动下载Nashorn类库;
7762
§621-03-25 §afeat: 异步加载 polyfill 并且同步加载 @ccms/core;
7863
§621-03-25 §cfix: 修改 ployfill 为 polyfill;
7964
§620-12-22 §cfix: 增加 require 效验;
@@ -202,11 +187,6 @@
202187
<version>1.18.24</version>
203188
<scope>compile</scope>
204189
</dependency>
205-
<dependency>
206-
<groupId>org.kamranzafar</groupId>
207-
<artifactId>jtar</artifactId>
208-
<version>2.3</version>
209-
</dependency>
210190
<dependency>
211191
<groupId>org.spigotmc</groupId>
212192
<artifactId>spigot-api</artifactId>
@@ -231,17 +211,5 @@
231211
<version>1.0-SNAPSHOT</version>
232212
<scope>compile</scope>
233213
</dependency>
234-
<dependency>
235-
<groupId>org.springframework</groupId>
236-
<artifactId>spring-websocket</artifactId>
237-
<version>5.3.19</version>
238-
<scope>compile</scope>
239-
</dependency>
240-
<dependency>
241-
<groupId>org.apache.tomcat</groupId>
242-
<artifactId>tomcat-websocket</artifactId>
243-
<version>9.0.35</version>
244-
<scope>compile</scope>
245-
</dependency>
246214
</dependencies>
247215
</project>

src/main/java/pw/yumc/MiaoScript/MiaoScriptSponge.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* @author 喵♂呜
2222
* Created on 2017/10/25 20:35.
2323
*/
24-
@Plugin(id = "miaoscript", name = "MiaoScript", version = MiaoScriptAPI.VERSION, authors = "MiaoWoo")
24+
@Plugin(id = "miaoscript", name = "MiaoScript", description = "MiaoScript runtime in Sponge", version = MiaoScriptAPI.VERSION, authors = "MiaoWoo")
2525
public class MiaoScriptSponge {
2626
private ScriptEngine engine;
2727
@Inject

src/main/java/pw/yumc/MiaoScript/MiaoScriptSpring.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/main/java/pw/yumc/MiaoScript/api/Base.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package pw.yumc.MiaoScript.api;
22

3+
import lombok.Getter;
4+
35
import java.io.File;
46
import java.io.IOException;
57
import java.nio.charset.StandardCharsets;
@@ -13,6 +15,7 @@
1315
* @author 喵♂呜
1416
* Created on 2017/10/9 12:40.
1517
*/
18+
@Getter
1619
public class Base {
1720
private final Object instance;
1821

@@ -36,10 +39,6 @@ public Class<?> getClass(String name) throws ClassNotFoundException {
3639
}
3740
}
3841

39-
public Object getInstance() {
40-
return this.instance;
41-
}
42-
4342
public Class<?> getProxyClass() {
4443
return ProxyClass.class;
4544
}

src/main/java/pw/yumc/MiaoScript/api/JavaScriptTask.java

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package pw.yumc.MiaoScript.api;
22

3+
import lombok.Getter;
4+
35
import java.util.concurrent.Delayed;
46
import java.util.concurrent.TimeUnit;
57

8+
@Getter
69
public class JavaScriptTask implements Delayed {
710
private final long id;
811
private final Object task;
@@ -35,20 +38,4 @@ public int compareTo(Delayed delayed) {
3538
return (int) (this.id - task.getId());
3639
}
3740
}
38-
39-
public long getId() {
40-
return this.id;
41-
}
42-
43-
public Object getTask() {
44-
return this.task;
45-
}
46-
47-
public long getStartTime() {
48-
return this.startTime;
49-
}
50-
51-
public long getExecuteTime() {
52-
return this.executeTime;
53-
}
5441
}

src/main/java/pw/yumc/MiaoScript/api/MiaoScriptAPI.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package pw.yumc.MiaoScript.api;
22

3+
import lombok.Getter;
34
import pw.yumc.MiaoScript.api.loader.MavenDependLoader;
45
import pw.yumc.MiaoScript.api.plugin.PluginManager;
56
import pw.yumc.MiaoScript.engine.MiaoScriptEngine;
@@ -8,22 +9,20 @@
89
import java.nio.file.Paths;
910

1011
public class MiaoScriptAPI {
11-
public static final String VERSION = "0.23.1";
12+
public static final String VERSION = "0.28.0";
13+
@Getter
1214
private static String root;
1315
private static String libPath;
1416
private static ScriptEngine scriptEngine;
17+
@Getter
1518
private static PluginManager pluginManager;
1619

1720
public static ScriptEngine createEngine(String root, Object logger, Object instance) {
1821
MiaoScriptAPI.scriptEngine = new ScriptEngine(root, logger, instance);
1922
return MiaoScriptAPI.scriptEngine;
2023
}
2124

22-
public static String getRoot() {
23-
return root;
24-
}
25-
26-
public static void setRoot(String root) {
25+
static void setRoot(String root) {
2726
MiaoScriptAPI.root = root;
2827
MiaoScriptAPI.libPath = Paths.get(root, "libs").toString();
2928
}
@@ -32,14 +31,10 @@ public static MiaoScriptEngine getEngine() {
3231
return MiaoScriptAPI.scriptEngine.getEngine();
3332
}
3433

35-
public static void setEngine(ScriptEngine scriptEngine) {
34+
static void setEngine(ScriptEngine scriptEngine) {
3635
MiaoScriptAPI.scriptEngine = scriptEngine;
3736
}
3837

39-
public static PluginManager getPluginManager() {
40-
return pluginManager;
41-
}
42-
4338
public static void setPluginManager(Object pluginManager) {
4439
MiaoScriptAPI.pluginManager = getEngine().getInterface(pluginManager, PluginManager.class);
4540
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package pw.yumc.MiaoScript.api.bukkit;
2+
3+
import lombok.Getter;
4+
import org.bukkit.event.Cancellable;
5+
import org.bukkit.event.Event;
6+
import org.bukkit.event.HandlerList;
7+
8+
import javax.script.Bindings;
9+
10+
@Getter
11+
public class EngineEvent extends Event implements Cancellable {
12+
private final String event;
13+
private final Bindings data;
14+
15+
private boolean cancelled = false;
16+
17+
public EngineEvent(String event, Bindings data) {
18+
this.event = event;
19+
this.data = data;
20+
}
21+
22+
@Override
23+
public boolean isCancelled() {
24+
return this.cancelled;
25+
}
26+
27+
@Override
28+
public void setCancelled(boolean b) {
29+
this.cancelled = b;
30+
}
31+
32+
@Getter
33+
private static final HandlerList handlerList = new HandlerList();
34+
35+
@Override
36+
public HandlerList getHandlers() {
37+
return handlerList;
38+
}
39+
}

src/main/java/pw/yumc/MiaoScript/api/bukkit/ScriptEvent.java

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
package pw.yumc.MiaoScript.api.bukkit;
22

3+
import lombok.Getter;
34
import org.bukkit.event.Cancellable;
45
import org.bukkit.event.Event;
56
import org.bukkit.event.HandlerList;
67

78
import javax.script.Bindings;
89

10+
@Getter
911
public class ScriptEvent extends Event implements Cancellable {
1012
private final Bindings plugin;
1113
private final String event;
1214
private final Bindings data;
15+
1316
private boolean cancelled = false;
1417

1518
public ScriptEvent(Bindings plugin, String event, Bindings data) {
@@ -18,33 +21,6 @@ public ScriptEvent(Bindings plugin, String event, Bindings data) {
1821
this.data = data;
1922
}
2023

21-
/**
22-
* Which Plugin Call Event
23-
*
24-
* @return PluginName
25-
*/
26-
public Bindings getPlugin() {
27-
return plugin;
28-
}
29-
30-
/**
31-
* Plugin Event Name
32-
*
33-
* @return EventName
34-
*/
35-
public String getEvent() {
36-
return event;
37-
}
38-
39-
/**
40-
* Plugin Event Data
41-
*
42-
* @return EventData
43-
*/
44-
public Bindings getData() {
45-
return data;
46-
}
47-
4824
@Override
4925
public boolean isCancelled() {
5026
return this.cancelled;
@@ -55,12 +31,9 @@ public void setCancelled(boolean b) {
5531
this.cancelled = b;
5632
}
5733

34+
@Getter
5835
private static final HandlerList handlerList = new HandlerList();
5936

60-
public static HandlerList getHandlerList() {
61-
return handlerList;
62-
}
63-
6437
@Override
6538
public HandlerList getHandlers() {
6639
return handlerList;

0 commit comments

Comments
 (0)