fix: 1.13.2 complate

Signed-off-by: MiaoWoo <admin@yumc.pw>
master
MiaoWoo 2019-03-11 16:41:22 +08:00
parent 42ed92ac0f
commit 9946f5caed
3 changed files with 30 additions and 9 deletions

3
.gitignore vendored
View File

@ -1,4 +1,7 @@
# Eclipse stuff
/.project
/.classpath
/.factorypath
/.settings
# netbeans

13
pom.xml
View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>Yum</artifactId>
<version>2.7.10</version>
<version>2.8.0</version>
<packaging>jar</packaging>
<description>Minecraft 服务器插件管理系统</description>
@ -16,13 +16,14 @@
</parent>
<properties>
<update.description>§a补丁包 2.7.10 版本</update.description>
<update.description>§a补丁包 2.8 版本</update.description>
<update.changes>
§619-02-23 §cfix: 修复不兼容 1.13 的问题;
</update.changes>
<update.changelog>
§617-07-29 §cfix: 修复不兼容 1.12 的问题;
§6- §cfix: §7修复仓库数据读取错误的问题;
§6- §cfix: §7修复一个tab补全产生的错误
</update.changes>
<update.changelog>
§6- §btip: §a本插件最后一次更新 2.7.8 版本;
§6- §afeat: §7线程中断只显示一次调试信息;
§6- §afeat: §7更新线程检查 添加调试;
@ -40,8 +41,8 @@
</update.changelog>
<env.GIT_COMMIT>DEV</env.GIT_COMMIT>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>

View File

@ -10,6 +10,7 @@ import org.bukkit.scheduler.BukkitTask;
import pw.yumc.Yum.commands.MonitorCommand;
import pw.yumc.Yum.managers.MonitorManager;
import pw.yumc.YumCore.bukkit.P;
import pw.yumc.YumCore.kit.StrKit;
import pw.yumc.YumCore.reflect.Reflect;
@ -19,6 +20,20 @@ public class TaskInjector implements Runnable {
private static String err = prefix + "§6插件 §b%s §6处理 §d%s §6任务时发生异常!";
private static String inject_error = prefix + "§6插件 §b%s §c注入能耗监控失败!";
private static String plugin_is_null = "插件不得为NULL!";
private static String taskFieldName = "task";
static {
BukkitTask task = Bukkit.getServer().getScheduler().runTask(P.instance, new Runnable(){
@Override
public void run() {}
});
try {
Reflect.on(task).get("rTask");
taskFieldName = "rTask";
}catch (Throwable ex) {
}
}
private Runnable originalTask;
private Plugin plugin;
@ -44,10 +59,12 @@ public class TaskInjector implements Runnable {
for (BukkitTask pendingTask : pendingTasks) {
// 忽略异步任务
if (pendingTask.isSync() && pendingTask.getOwner().equals(plugin)) {
Runnable originalTask = Reflect.on(pendingTask).get("task");
if (originalTask instanceof TaskInjector) { return; }
Runnable originalTask = Reflect.on(pendingTask).get(taskFieldName);
if (originalTask instanceof TaskInjector) {
return;
}
TaskInjector taskInjector = new TaskInjector(originalTask, plugin);
Reflect.on(pendingTask).set("task", taskInjector);
Reflect.on(pendingTask).set(taskFieldName, taskInjector);
}
}
} catch (Throwable e) {