feat: 重载不重新注入 修改能耗显示

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-07-19 19:55:32 +08:00
parent 935a2eb4f9
commit 8c43dba5f4
2 changed files with 5 additions and 10 deletions

View File

@ -33,7 +33,6 @@ import pw.yumc.Yum.runnables.MainThreadCheckTask;
* @since 2015年8月21日下午5:14:39 * @since 2015年8月21日下午5:14:39
*/ */
public class Yum extends JavaPlugin { public class Yum extends JavaPlugin {
public static boolean disable = false;;
public static Thread mainThread = null; public static Thread mainThread = null;
public static Timer task = new Timer(); public static Timer task = new Timer();
public static TimerTask tt; public static TimerTask tt;
@ -46,7 +45,6 @@ public class Yum extends JavaPlugin {
@Override @Override
public void onDisable() { public void onDisable() {
NetworkManager.unregister(); NetworkManager.unregister();
disable = true;
} }
@Override @Override
@ -61,10 +59,6 @@ public class Yum extends JavaPlugin {
new VersionChecker(this); new VersionChecker(this);
YumAPI.updateRepo(Bukkit.getConsoleSender()); YumAPI.updateRepo(Bukkit.getConsoleSender());
YumAPI.updateCheck(Bukkit.getConsoleSender()); YumAPI.updateCheck(Bukkit.getConsoleSender());
if (disable) {
YumAPI.updateInject();
disable = false;
}
} }
@Override @Override

View File

@ -57,7 +57,7 @@ public class MonitorCommand implements HandlerCommands {
private final String notEnable = prefix + "§c插件 §b%s §c未成功加载 无法执行注入!"; private final String notEnable = prefix + "§c插件 §b%s §c未成功加载 无法执行注入!";
private final String lagprefix = " §6插件名称 §c主线程耗时 §a命令耗时 §b事件耗时 §d任务耗时"; private final String lagprefix = " §6插件名称 §c主线程耗时 §a命令耗时 §b事件耗时 §d任务耗时";
private final String laglist = "§b%-15s §c%-11.2f §a%-9.2f §b%-9.2f §d%-9.2f"; private final String laglist = "§6%-2s §b%-15s §c%-11.2f §a%-9.2f §b%-9.2f §d%-9.2f";
private final String no_error = prefix + "§a自服务器启动以来尚未发现报错!"; private final String no_error = prefix + "§a自服务器启动以来尚未发现报错!";
private final String last_error = prefix + "§c最后一次错误异常由 §b%s §c造成 详细如下:"; private final String last_error = prefix + "§c最后一次错误异常由 §b%s §c造成 详细如下:";
@ -179,13 +179,14 @@ public class MonitorCommand implements HandlerCommands {
final CommandSender sender = e.getSender(); final CommandSender sender = e.getSender();
final Map<String, Long> mm = MonitorManager.getMonitor(); final Map<String, Long> mm = MonitorManager.getMonitor();
int i = 0; int i = 0;
final int max = e.getArgs().length > 0 ? Integer.parseInt(e.getArgs()[0]) : 8;
sender.sendMessage(lagprefix); sender.sendMessage(lagprefix);
for (final Entry<String, Long> entry : mm.entrySet()) { for (final Entry<String, Long> entry : mm.entrySet()) {
if (i++ > 5) { if (++i > max) {
break; break;
} }
final MonitorInfo mi = MonitorManager.getMonitorInfo(entry.getKey()); final MonitorInfo mi = MonitorManager.getMonitorInfo(entry.getKey());
sender.sendMessage(String.format(laglist, entry.getKey(), mi.monitor, mi.cmd, mi.event, mi.task)); sender.sendMessage(String.format(laglist, i, entry.getKey(), mi.monitor, mi.cmd, mi.event, mi.task));
} }
} }