public void enablePlugin(final Plugin plugin) { Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader"); if (!plugin.isEnabled()) { plugin.getLogger().info("Enabling " + plugin.getDescription().getFullName()); JavaPlugin jPlugin = (JavaPlugin) plugin; String pluginName = jPlugin.getDescription().getName(); if (!loaders.containsKey(pluginName)) { loaders.put(pluginName, (PluginClassLoader) jPlugin.getClassLoader()); } try { jPlugin.setEnabled(true); } catch (Throwable ex) { server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); } // Perhaps abort here, rather than continue going, but as it stands, // an abort is not possible the way it's currently written server.getPluginManager().callEvent(new PluginEnableEvent(plugin)); } }
private void loaderEnablePlugin(Plugin plugin) { if (!plugin.isEnabled()) { plugin.getLogger().info("Enabling " + plugin.getDescription().getFullName()); JavaPlugin jPlugin = (JavaPlugin) plugin; try { Field f = JavaPlugin.class.getDeclaredField("isEnabled"); f.setAccessible(true); boolean enabled = f.getBoolean(jPlugin); if (!enabled) { f.setBoolean(jPlugin, true); jPlugin.onEnable(); } } catch (Throwable ex) { server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); } server.getPluginManager().callEvent(new PluginEnableEvent(plugin)); } }
@EventHandler public void onPluginEnable(PluginEnableEvent e) { Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(xEssentials.getPlugin(), new Runnable() { long sec; int ticks; @Override public void run() { sec = System.currentTimeMillis() / 1000; if (second == sec) { ticks++; } else { second = sec; tps = tps == 0 ? ticks : (tps + ticks) / 2; ticks = 0; } } }, 21, 1); }
@EventHandler public void onPluginEnable(final PluginEnableEvent e) { if (!e.getPlugin().getName().equalsIgnoreCase("Essentials")) { return; } Runnable r = new Runnable() { @Override public void run() { inject(e.getPlugin()); } }; Bukkit.getScheduler().runTask(BukkitPlugin.getInstance(), r); }
@EventHandler public void onPluginEnable(PluginEnableEvent e) { for (Map.Entry<Class<? extends Bridge>, String> entry : brigdesmap.entrySet()) { try { Class.forName(entry.getValue()); for (Bridge b : bridges) { if (b.getClass().getName().equals(entry.getKey().getName())) { throw new Exception(); } } createBridge(entry.getKey(), entry.getValue()).enable(); } catch (Exception ex) { } } }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginEnable(PluginEnableEvent event) { if(permission == null){ Plugin perms = plugin.getServer().getPluginManager().getPlugin("Xperms"); if(perms != null){ try{ if(Double.valueOf(perms.getDescription().getVersion()) < 1.1){ log.info(String.format("[%s] [Permission] %s Current version is not compatible with vault! Please Update!", plugin.getDescription().getName(), name)); } } catch(NumberFormatException e){ // version is first release, numbered 1.0.0 log.info(String.format("[%s] [Permission] %s Current version is not compatibe with vault! Please Update!", plugin.getDescription().getName(), name)); } permission.perms = (Main) perms; log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name)); } } }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginEnable(PluginEnableEvent event) { if (permission.permission == null) { Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsEx"); if (perms != null) { try { if (Double.valueOf(perms.getDescription().getVersion()) < 1.16) { log.info(String.format("[%s][Permission] %s below 1.16 is not compatible with Vault! Falling back to SuperPerms only mode. PLEASE UPDATE!", plugin.getDescription().getName(), name)); return; } } catch (NumberFormatException e) { // Do nothing } permission.permission = (PermissionsEx) perms; log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name)); } } }
@EventHandler(priority = EventPriority.HIGHEST) public void onPluginEnable(PluginEnableEvent event) { // Make sure the plugin instance isn't null if (event.getPlugin() == null) { return; } final String pluginName = event.getPlugin().getName(); // Call the onPluginEnable method in the permissions manager permissionsManager.onPluginEnable(pluginName); if ("Essentials".equalsIgnoreCase(pluginName)) { pluginHookService.tryHookToEssentials(); } else if ("Multiverse-Core".equalsIgnoreCase(pluginName)) { pluginHookService.tryHookToMultiverse(); } else if ("EssentialsSpawn".equalsIgnoreCase(pluginName)) { spawnLoader.loadEssentialsSpawn(); } else if ("CMI".equalsIgnoreCase(pluginName)) { pluginHookService.tryHookToCmi(); spawnLoader.loadCmiSpawn(); } else if ("ProtocolLib".equalsIgnoreCase(pluginName)) { protocolLibService.setup(); } }
@Override public void enablePlugin(Plugin plugin) { valid(plugin); if (!plugin.isEnabled()) { plugin.getLogger().info("Enabling " + plugin.getDescription().getFullName()); SubPlugin sub = (SubPlugin) plugin; try { sub.setEnabled(true); } catch (Exception e) { Bukkit.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", e); } Bukkit.getPluginManager().callEvent(new PluginEnableEvent(plugin)); } }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginEnable(PluginEnableEvent event) { Plugin p = event.getPlugin(); String name = p.getDescription().getName(); if (name.equals("dynmap") || name.equals("WorldGuard")) { if (this.cubitDynmap.dynmap.isEnabled() && CubitBukkitPlugin.inst().getWorldGuardPlugin().isEnabled()) this.cubitDynmap.initialize(); } }
public PluginHookMgr(SuperVanish plugin) { this.plugin = plugin; plugin.getServer().getPluginManager().registerEvents(this, plugin); for (Plugin alreadyEnabledPlugin : Bukkit.getPluginManager().getPlugins()) if (alreadyEnabledPlugin.isEnabled()) onPluginEnable(new PluginEnableEvent(alreadyEnabledPlugin)); }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginEnable(PluginEnableEvent e) { if (e.getPlugin().getName().equals("PlaceholderAPI")) { Bukkit.getLogger().info(consolePrefix + "Found PlaceholderAPI. Using custom chat format."); placeholderAPIEnabled = true; } else if (e.getPlugin().getName().equals("Importer")) { Bukkit.getLogger().info(consolePrefix + "Found Importer. Enabling Importer integration."); ImporterHook importerHook = new ImporterHook(); importerHook.hook(this); } }
@EventHandler(priority=EventPriority.MONITOR) public void onPluginEnable(PluginEnableEvent event) { Plugin p = event.getPlugin(); String name = p.getDescription().getName(); if(name.equals("dynmap")) { if(dynmap.isEnabled()) activate(dynmap); } }
@EventHandler(ignoreCancelled = true) public void onPluginEnable(final PluginEnableEvent event) { final Plugin plugin = event.getPlugin(); if (!plugin.getName().equals("Vault")) return; this.factionsHook.deinit(); this.factionsHook.init(); }
@EventHandler(ignoreCancelled = true) public void onPluginEnable(final PluginEnableEvent event) { final Plugin plugin = event.getPlugin(); if (!plugin.getName().equals("Vault")) return; this.vaultHook.deinit(); this.vaultHook.init(); }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginEnable(final PluginEnableEvent event) { final Plugin p = event.getPlugin(); final String name = p.getDescription().getName(); if (name.equals("dynmap")) { if (this.dynmap.isEnabled() && this.plot2.isEnabled()) { initialize(); } } }
@EventHandler(priority = EventPriority.LOW) public void onPluginEnable(PluginEnableEvent event) { if (event.getPlugin() != plugin) { // Try to load again! Perms.onOtherPluginEnable(); plugin.getTreasury().onOtherPluginEnable(); } }
public void enablePlugin(Plugin plugin) { if (!(plugin instanceof PythonPlugin)) { throw new IllegalArgumentException("Plugin is not associated with this PluginLoader"); } if (!plugin.isEnabled()) { PythonPlugin pyPlugin = (PythonPlugin) plugin; String pluginName = pyPlugin.getDescription().getName(); if (!loadedplugins.contains(pluginName)) loadedplugins.add(pluginName); try { pyPlugin.setEnabled(true); } catch (Throwable ex) { server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?): " + ex.getMessage(), ex); } // Perhaps abort here, rather than continue going, but as it stands, // an abort is not possible the way it's currently written server.getPluginManager().callEvent(new PluginEnableEvent(plugin)); } }
@EventHandler public void onPluginEnable(PluginEnableEvent enableEvent){ if(check == 0){ BukkitTask task = new RecyclerTask(this.plugin).runTask(this.plugin); check = 1; } }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginEnable(PluginEnableEvent event) { if (plugin.isUpdated()) { long start = System.currentTimeMillis(); plugin.getLogHandler().log("Plugin {0} enabled. Performing permission update.", event.getPlugin()); plugin.getPermissionHandler().update(); plugin.getLogHandler().log("Permissions updated. Took {0} ms.", System.currentTimeMillis() - start); } }
@EventHandler(priority = EventPriority.MONITOR) void onPluginEnable(PluginEnableEvent event) { if (ENABLED || !event.getPlugin().getName().equals("WorldGuard")) return; try { ENABLED = event.getPlugin() instanceof WorldGuardPlugin; } catch (Exception ignored) { } }
@EventHandler public void onPluginEnable(PluginEnableEvent event) { if (!Main.getInstance().isPluginEnabled() && event.getPlugin().getDescription().getName().equals("ProtocolLib")) { Main.getInstance().setPluginEnabled(true); Main.getInstance().enablePlugin(); } }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginEnable(final PluginEnableEvent event) { if (this.economy.economy == null) { final Plugin ec = event.getPlugin(); if (ec.getClass().getName().equals("org.royaldev.royaleconomy.RoyalEconomy")) { final String version = ec.getDescription().getVersion(); VaultConnector.this.name += version; this.economy.economy = (RoyalEconomy) ec; VaultConnector.this.plugin.getLogger().info("Hooked into Vault!"); } } }
public void enablePlugin(final Plugin plugin) { if (!(plugin instanceof JavaPlugin)) { throw new IllegalArgumentException("Plugin is not associated with this PluginLoader"); } if (!plugin.isEnabled()) { String message = String.format("Enabling %s", plugin.getDescription().getFullName()); plugin.getLogger().info(message); JavaPlugin jPlugin = (JavaPlugin) plugin; String pluginName = jPlugin.getDescription().getName(); if (!loaders.containsKey(pluginName)) { loaders.put(pluginName, (PluginClassLoader) jPlugin.getClassLoader()); } try { jPlugin.setEnabled(true); } catch (Throwable ex) { server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); } // Perhaps abort here, rather than continue going, but as it stands, // an abort is not possible the way it's currently written server.getPluginManager().callEvent(new PluginEnableEvent(plugin)); } }
@EventHandler public void onPluginEnabled(PluginEnableEvent event) { if(event.getPlugin()==this) return; PluginDescriptionFile desc = event.getPlugin().getDescription(); String name = this.getName(); if( this.containsIgnoreCase(desc.getDepend(), name) || this.containsIgnoreCase(desc.getSoftDepend(), name)) { this.usedBy.add(desc.getFullName()); } }
@Override public void disable() { Plugin plugin = Bukkit.getPluginManager().getPlugin("Essentials"); if (plugin != null) { uninject(plugin); } PluginEnableEvent.getHandlerList().unregister(this); PluginDisableEvent.getHandlerList().unregister(this); }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginEnable(PluginEnableEvent event) { if (perms == null) { Plugin p = event.getPlugin(); if (p.getDescription().getName().equals("BungeePerms")) { perms = BungeePerms.getInstance(); log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name)); } } }
@Override public void disable() { Plugin plugin = Bukkit.getPluginManager().getPlugin("Vault"); if (plugin != null) { uninject(plugin); } PluginEnableEvent.getHandlerList().unregister(this); PluginDisableEvent.getHandlerList().unregister(this); }
@EventHandler public void onPluginEnable(PluginEnableEvent e) { if (!e.getPlugin().getName().equalsIgnoreCase("vault")) { return; } inject(e.getPlugin()); }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginEnable(PluginEnableEvent event) { if (perms == null) { Plugin p = event.getPlugin(); if (p.getDescription().getName().equals("BungeePerms")) { perms = BungeePerms.getInstance(); log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), name)); } } }
@Override public void disable() { Plugin plugin = Bukkit.getPluginManager().getPlugin("WorldEdit"); if (plugin != null) { uninject(plugin); } PluginEnableEvent.getHandlerList().unregister(this); PluginDisableEvent.getHandlerList().unregister(this); }
@EventHandler public void onPluginEnable(PluginEnableEvent e) { if (!e.getPlugin().getName().equalsIgnoreCase("worldedit")) { return; } inject(e.getPlugin()); }
public void disable() { PluginEnableEvent.getHandlerList().unregister((Listener) this); for (Bridge b : bridges) { b.disable(); } }