本文整理了Java中org.bukkit.plugin.Plugin.getPluginLoader()
方法的一些代码示例,展示了Plugin.getPluginLoader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.getPluginLoader()
方法的具体详情如下:
包路径:org.bukkit.plugin.Plugin
类名称:Plugin
方法名:getPluginLoader
[英]Gets the associated PluginLoader responsible for this plugin
[中]获取负责此插件的关联插件加载程序
代码示例来源:origin: Bukkit/Bukkit
public void registerEvents(Listener listener, Plugin plugin) {
if (!plugin.isEnabled()) {
throw new IllegalPluginAccessException("Plugin attempted to register " + listener + " while not enabled");
}
for (Map.Entry<Class<? extends Event>, Set<RegisteredListener>> entry : plugin.getPluginLoader().createRegisteredListeners(listener, plugin).entrySet()) {
getEventListeners(getRegistrationClass(entry.getKey())).registerAll(entry.getValue());
}
}
代码示例来源:origin: Bukkit/Bukkit
public void enablePlugin(final Plugin plugin) {
if (!plugin.isEnabled()) {
List<Command> pluginCommands = PluginCommandYamlParser.parse(plugin);
if (!pluginCommands.isEmpty()) {
commandMap.registerAll(plugin.getDescription().getName(), pluginCommands);
}
try {
plugin.getPluginLoader().enablePlugin(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
HandlerList.bakeAll();
}
}
代码示例来源:origin: Bukkit/Bukkit
public void disablePlugin(final Plugin plugin) {
if (plugin.isEnabled()) {
try {
plugin.getPluginLoader().disablePlugin(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
try {
server.getScheduler().cancelTasks(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while cancelling tasks for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
try {
server.getServicesManager().unregisterAll(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering services for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
try {
HandlerList.unregisterAll(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering events for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
try {
server.getMessenger().unregisterIncomingPluginChannel(plugin);
server.getMessenger().unregisterOutgoingPluginChannel(plugin);
} catch(Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering plugin channels for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
}
}
代码示例来源:origin: Bkm016/TabooLib
public static File getPluginFile(String name) {
for (File pluginFile : new File("plugins").listFiles()) {
if (pluginFile.getName().endsWith(".jar")) {
try {
PluginDescriptionFile desc = Main.getInst().getPluginLoader().getPluginDescription(pluginFile);
if (desc.getName().equalsIgnoreCase(name)) {
return pluginFile;
}
} catch (Exception ignored) {
}
}
}
return null;
}
代码示例来源:origin: SpigotMC/Spigot-API
public void registerEvents(Listener listener, Plugin plugin) {
if (!plugin.isEnabled()) {
throw new IllegalPluginAccessException("Plugin attempted to register " + listener + " while not enabled");
}
for (Map.Entry<Class<? extends Event>, Set<RegisteredListener>> entry : plugin.getPluginLoader().createRegisteredListeners(listener, plugin).entrySet()) {
getEventListeners(getRegistrationClass(entry.getKey())).registerAll(entry.getValue());
}
}
代码示例来源:origin: SpigotMC/Spigot-API
public void enablePlugin(final Plugin plugin) {
if (!plugin.isEnabled()) {
List<Command> pluginCommands = PluginCommandYamlParser.parse(plugin);
if (!pluginCommands.isEmpty()) {
commandMap.registerAll(plugin.getDescription().getName(), pluginCommands);
}
try {
plugin.getPluginLoader().enablePlugin(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
HandlerList.bakeAll();
}
}
代码示例来源:origin: artex-development/Lukkit
this.pluginLoader = (LukkitPluginLoader) plugin.getPluginLoader();
break;
代码示例来源:origin: Bkm016/TabooLib
if (plugin.getName().endsWith(".jar")) {
try {
PluginDescriptionFile desc = Main.getInst().getPluginLoader().getPluginDescription(plugin);
if (desc.getName().equalsIgnoreCase(name)) {
pluginFile = plugin;
代码示例来源:origin: SpigotMC/Spigot-API
public void disablePlugin(final Plugin plugin) {
if (plugin.isEnabled()) {
try {
plugin.getPluginLoader().disablePlugin(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
try {
server.getScheduler().cancelTasks(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while cancelling tasks for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
try {
server.getServicesManager().unregisterAll(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering services for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
try {
HandlerList.unregisterAll(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering events for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
try {
server.getMessenger().unregisterIncomingPluginChannel(plugin);
server.getMessenger().unregisterOutgoingPluginChannel(plugin);
} catch(Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering plugin channels for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!