From 776820e4b71cc0bc73f782db5bb0e4b3f058fc24 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Wed, 30 Mar 2016 11:27:19 +0800 Subject: [PATCH] =?UTF-8?q?refactor(NetworkManager.java):=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=BC=82=E5=B8=B8=E6=8A=9B=E5=87=BA=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/pw/yumc/Yum/commands/YumCommand.java | 4 ++-- src/main/java/pw/yumc/Yum/manager/NetworkManager.java | 11 ++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/main/java/pw/yumc/Yum/commands/YumCommand.java b/src/main/java/pw/yumc/Yum/commands/YumCommand.java index ceb04bc..39c0ab8 100644 --- a/src/main/java/pw/yumc/Yum/commands/YumCommand.java +++ b/src/main/java/pw/yumc/Yum/commands/YumCommand.java @@ -25,8 +25,8 @@ import cn.citycraft.PluginHelper.utils.StringUtil; import pw.yumc.Yum.Yum; import pw.yumc.Yum.api.YumAPI; import pw.yumc.Yum.manager.PluginsManager; -import pw.yumc.Yum.manager.RepositoryManager; import pw.yumc.Yum.manager.RepoSerialization.Repositories; +import pw.yumc.Yum.manager.RepositoryManager; /** * Yum命令基类 @@ -180,7 +180,7 @@ public class YumCommand implements HandlerCommands, Listener { if (plugin == null) { plugman.load(sender, pluginname); } else { - sender.sendMessage("§c错误: §b插件 " + pluginname + " §c已加载到服务器!"); + sender.sendMessage("§c错误: §a插件 §b" + pluginname + " §c已加载到服务器!"); } } diff --git a/src/main/java/pw/yumc/Yum/manager/NetworkManager.java b/src/main/java/pw/yumc/Yum/manager/NetworkManager.java index 2c7ea01..ab8e451 100644 --- a/src/main/java/pw/yumc/Yum/manager/NetworkManager.java +++ b/src/main/java/pw/yumc/Yum/manager/NetworkManager.java @@ -12,6 +12,7 @@ import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; import cn.citycraft.PluginHelper.config.FileConfig; +import cn.citycraft.PluginHelper.kit.ExceptionKit; import pw.yumc.Yum.Yum; /** @@ -21,14 +22,6 @@ import pw.yumc.Yum.Yum; * @author 喵♂呜 */ public class NetworkManager { - public static void throwException(final Throwable exception) { - NetworkManager. throwException0(exception); - } - - @SuppressWarnings("unchecked") - private static void throwException0(final Throwable exception) throws T { - throw (T) exception; - } public NetworkManager register(final Yum plugin) { Bukkit.getConsoleSender().sendMessage("§6[§bYum-网络管理§6] §a注入网络管理系统 将托管服务器网络!"); @@ -80,7 +73,7 @@ public class NetworkManager { Bukkit.getConsoleSender().sendMessage(String.format(str, plugin.getName(), urlinfo)); if (!allowPrimaryThread) { Bukkit.getConsoleSender().sendMessage("§6[§bYum-网络管理§6] §4已阻止插件 §b" + plugin.getName() + " §4在主线程访问网络!"); - throwException(new IOException("[Yum-网络管理] 已开启网络防护 不允许在主线程访问网络!")); + ExceptionKit.throwException(new IOException("[Yum-网络管理] 已开启网络防护 不允许在主线程访问网络!")); } } }