1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-24 02:08:48 +00:00

fix: 插件重载时未载入异常

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-08-16 13:47:10 +08:00
parent 19528cdf65
commit c327a8d302

View File

@ -29,8 +29,6 @@ import org.bukkit.scheduler.BukkitTask;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.json.simple.JSONValue; import org.json.simple.JSONValue;
import pw.yumc.YumCore.bukkit.P;
/** /**
* Yum数据中心 数据统计类 * Yum数据中心 数据统计类
* *
@ -73,7 +71,7 @@ public class Statistics {
} }
} }
} }
final Object pluginClassLoader = P.class.getClassLoader(); final Object pluginClassLoader = Statistics.class.getClassLoader();
final Field field = pluginClassLoader.getClass().getDeclaredField("plugin"); final Field field = pluginClassLoader.getClass().getDeclaredField("plugin");
field.setAccessible(true); field.setAccessible(true);
plugin = (JavaPlugin) field.get(pluginClassLoader); plugin = (JavaPlugin) field.get(pluginClassLoader);
@ -216,7 +214,7 @@ public class Statistics {
* @return 是否运行成功. * @return 是否运行成功.
*/ */
public boolean start() { public boolean start() {
if (task != null) { if (task != null || !plugin.isEnabled()) {
return true; return true;
} }
timer = new StatisticsTimer(); timer = new StatisticsTimer();