mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 06:18:46 +00:00
refactor(NetworkManager.java): 调整异常抛出方式
This commit is contained in:
parent
bff61aea3f
commit
776820e4b7
@ -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已加载到服务器!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.<RuntimeException> throwException0(exception);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T extends Throwable> 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-网络管理] 已开启网络防护 不允许在主线程访问网络!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user