private void loaderDisablePlugin(Plugin plugin) { if (plugin.isEnabled()) { plugin.getLogger().info("Disabling " + 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, false); jPlugin.onDisable(); } } catch (Throwable ex) { server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); } server.getPluginManager().callEvent(new PluginDisableEvent(plugin)); } }
private void registerBukkitEvents() { listener = new Listener() { @EventHandler(priority = EventPriority.LOWEST) public final void onPlayerLogin(PlayerLoginEvent e) { if (closed) return; Channel channel = getChannel(e.getPlayer()); if (!uninjectedChannels.contains(channel)) { injectPlayer(e.getPlayer()); } } @EventHandler public final void onPluginDisable(PluginDisableEvent e) { if (e.getPlugin().equals(plugin)) { close(); } } }; plugin.getServer().getPluginManager().registerEvents(listener, plugin); }
private void registerBukkitEvents() { listener = new Listener() { @EventHandler(priority = EventPriority.LOWEST) public final void onPlayerLogin(PlayerLoginEvent e) { if (closed) return; Channel channel = getChannel(e.getPlayer()); if (!uninjectedChannels.contains(channel)) injectPlayer(e.getPlayer()); } @EventHandler public final void onPluginDisable(PluginDisableEvent e) { if (e.getPlugin().equals(plugin)) { close(); } } }; plugin.getServer().getPluginManager().registerEvents(listener, plugin); }
public void disablePlugin(Plugin plugin) { if (!(plugin instanceof PythonPlugin)) { throw new IllegalArgumentException("Plugin is not associated with this PluginLoader"); } if (plugin.isEnabled()) { PythonPlugin pyPlugin = (PythonPlugin) plugin; try { pyPlugin.setEnabled(false); } catch (Throwable ex) { server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?): " + ex.getMessage(), ex); } server.getPluginManager().callEvent(new PluginDisableEvent(plugin)); String pluginName = pyPlugin.getDescription().getName(); if (loadedplugins.contains(pluginName)) loadedplugins.remove(pluginName); } }
/** * Register bukkit events. */ private void registerBukkitEvents() { listener = new Listener() { // @EventHandler(priority = EventPriority.LOWEST) // public final void onPlayerLogin(PlayerLoginEvent e) { // if (closed) // return; // // Channel channel = getChannel(e.getPlayer()); // // // Don't inject players that have been explicitly uninjected // if (!uninjectedChannels.contains(channel)) { // injectPlayer(e.getPlayer()); // } // } @EventHandler public final void onPluginDisable(PluginDisableEvent e) { if (e.getPlugin().equals(plugin)) { close(); } } }; plugin.getServer().getPluginManager().registerEvents(listener, plugin); }
@EventHandler(priority = EventPriority.LOW) public void onPluginDisable(PluginDisableEvent e) { new HashSet<>(inventories.entrySet()).forEach(entry -> { SmartInventory inv = entry.getValue(); inv.getListeners().stream() .filter(listener -> listener.getType() == PluginDisableEvent.class) .forEach(listener -> ((InventoryListener<PluginDisableEvent>) listener).accept(e)); inv.close(entry.getKey()); }); }
@EventHandler public void onPluginDisable(PluginDisableEvent event) { if (event.getPlugin() != Core.getInstance()) // KCv4 isn't unloading. return; Core.logInfo("Shutting down..."); getMechanics().forEach(Mechanic::onDisable); // Unload all mechanics. }
@EventHandler public void on(PluginDisableEvent event) { if (event.getPlugin() == api.getPlugin() && api.getConfig().canShutDownOnDisable()) { Messenger.send("&c[&fOpGuard was disabled&c] Shutting server down."); Bukkit.shutdown(); } }
@Override public void registerShutdownHandler(TaskChainFactory factory) { Bukkit.getPluginManager().registerEvents(new Listener() { @EventHandler public void onPluginDisable(PluginDisableEvent event) { if (event.getPlugin().equals(plugin)) { factory.shutdown(60, TimeUnit.SECONDS); } } }, plugin); }
@EventHandler private void pluginDisable(PluginDisableEvent event) { if (menus == null || menus.isEmpty()) { return; } List<Menu> menusClone = new ArrayList<Menu>(menus); for (Menu menu : menusClone) { if (menu.plugin == event.getPlugin()) { menu.destroyMenu(); } } }
@EventHandler void disable(PluginDisableEvent e) { if(!e.getPlugin().getClass().equals(TinyProtocolAPI.class)) return; for(Player player : Bukkit.getServer().getOnlinePlayers()) TabAPI.remove(TinyProtocolAPI.class, player); }
@EventHandler void vb(PluginDisableEvent e) { if(!e.getPlugin().getName().equals("TinyProtocolAPI")) return; for(Player a : e.getPlugin().getServer().getOnlinePlayers()) { UUID b = a.getUniqueId(); fa.sendAbstractPacket(a, get(b).mb()); } }
public void disablePlugin(Plugin plugin) { Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader"); if (plugin.isEnabled()) { String message = String.format("Disabling %s", plugin.getDescription().getFullName()); plugin.getLogger().info(message); server.getPluginManager().callEvent(new PluginDisableEvent(plugin)); JavaPlugin jPlugin = (JavaPlugin) plugin; ClassLoader cloader = jPlugin.getClassLoader(); try { jPlugin.setEnabled(false); } catch (Throwable ex) { server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); } loaders.remove(jPlugin.getDescription().getName()); if (cloader instanceof PluginClassLoader) { PluginClassLoader loader = (PluginClassLoader) cloader; Set<String> names = loader.getClasses(); for (String name : names) { removeClass(name); } } } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPluginDisable(PluginDisableEvent event) { if (event.getPlugin().equals(plugin)) { closeOpenMenus(); plugin = null; } }
@Override public void disablePlugin(Plugin plugin) { valid(plugin); if (plugin.isEnabled()) { plugin.getLogger().info("Disabling " + plugin.getDescription().getFullName()); SubPlugin sub = (SubPlugin) plugin; try { sub.setEnabled(false); } catch (Exception e) { Bukkit.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", e); } Fun.unload(sub); Bukkit.getPluginManager().callEvent(new PluginDisableEvent(plugin)); } }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginDisable(PluginDisableEvent event) { Minigame mg = SteelCore.getMinigames().get(event.getPlugin().getName()); if (mg != null) { ImmutableList<Round> rounds = ImmutableList.copyOf(mg.getRounds()); for (Round round : rounds) { round.end(); } } }
@EventHandler public void onPluginDisable(PluginDisableEvent e) { Plugin plugin = e.getPlugin(); PluginHook hook = getActiveHook(plugin); if (hook == null) return; try { hook.onPluginDisable(plugin); } catch (Exception e1) { this.plugin.logException(new InvalidPluginHookException(e1)); } hook.setPlugin(null); activeHooks.remove(hook); }
@EventHandler void onPluginDisable(PluginDisableEvent event){ RedProtect.get().logger.debug("Is PluginDisableEvent event."); for (Player play:event.getPlugin().getServer().getOnlinePlayers()){ play.closeInventory(); } }
@EventHandler public void onDisable(PluginDisableEvent event) { if(event.getPlugin().getName().equals(CoreFunctions.getInstance().getName())) { for(DisableableThread t : threads) t.disable(); } }
/** * Register bukkit events. */ private void registerBukkitEvents() { listener = new Listener() { @EventHandler(priority = EventPriority.LOWEST) public final void onPlayerLogin(PlayerLoginEvent e) { if (closed) return; Channel channel = getChannel(e.getPlayer()); // Don't inject players that have been explicitly uninjected if (!uninjectedChannels.contains(channel)) { injectPlayer(e.getPlayer()); } } @EventHandler public final void onPluginDisable(PluginDisableEvent e) { if (e.getPlugin().equals(plugin)) { close(); } } }; plugin.getServer().getPluginManager().registerEvents(listener, plugin); }
@EventHandler public void pluginDisable(PluginDisableEvent event) { if (event.getPlugin().getName().equalsIgnoreCase("Magix")) { for (String name : this.playerToItemStack.keySet()) { Player player = Bukkit.getPlayerExact(name); if (player == null) continue; check(player, player.getItemInHand()); } } }
@EventHandler(priority = EventPriority.MONITOR) void onPluginDisable(PluginDisableEvent event) { if (!ENABLED || event.getPlugin().getName().equals("WorldGuard")) return; try { ENABLED = false; } catch (Exception ignored) { } }
@EventHandler public void onPluginDisable(PluginDisableEvent event) { if (event.getPlugin().getDescription().getName().equals("ProtocolLib") && Main.getInstance().isPluginEnabled()) { Main.getInstance().disablePlugin(); Main.getInstance().setPluginEnabled(false); } }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginDisable(final PluginDisableEvent event) { if (this.economy.economy != null) { if (event.getPlugin().getDescription().getName().equals("RoyalEconomy")) { this.economy.economy = null; VaultConnector.this.plugin.getLogger().info("Removed Vault hook."); } } }
public void disablePlugin(Plugin plugin) { if (!(plugin instanceof JavaPlugin)) { throw new IllegalArgumentException("Plugin is not associated with this PluginLoader"); } if (plugin.isEnabled()) { String message = String.format("Disabling %s", plugin.getDescription().getFullName()); plugin.getLogger().info(message); server.getPluginManager().callEvent(new PluginDisableEvent(plugin)); JavaPlugin jPlugin = (JavaPlugin) plugin; ClassLoader cloader = jPlugin.getClassLoader(); try { jPlugin.setEnabled(false); } catch (Throwable ex) { server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); } loaders.remove(jPlugin.getDescription().getName()); if (cloader instanceof PluginClassLoader) { PluginClassLoader loader = (PluginClassLoader) cloader; Set<String> names = loader.getClasses(); for (String name : names) { removeClass(name); } } } }
@AutoEventHandler private void onPluginDisable(PluginDisableEvent event, @Bind("plugin") Plugin plugin) { ComponentManager componentManager = componentsCache.get(plugin); if(componentManager == null) return; for (ComponentHandle<?, ?> handle : componentManager.handles.values()) { if(handle.getSaveMoments().contains(SaveMoment.PluginUnload)) handle.saveAll(); } componentsCache.remove(plugin); }
@EventHandler public void onPluginDisable(PluginDisableEvent event) { EntityManager manager = RemoteEntities.getManagerOfPlugin(event.getPlugin().getName()); if(manager != null) { manager.despawnAll(DespawnReason.PLUGIN_DISABLE); if(manager instanceof BaseEntityManager) ((BaseEntityManager)manager).teardown(); } }
@EventHandler public void onPluginDisable(PluginDisableEvent event) { EntityManager manager = RemoteEntities.getManagerOfPlugin(event.getPlugin().getName()); if(manager != null) { manager.despawnAll(DespawnReason.PLUGIN_DISABLE); manager.unregisterEntityLoader(); } }
@EventHandler private void onPluginDisable(PluginDisableEvent event) { // unregister all event handlers associated with the plugin EventManager.unregisterPlugin(event.getPlugin()); if (Nucleus.getPlugin().isEnabled()) { Nucleus.getScriptApiRepo().unregisterPlugin(event.getPlugin()); } }
@EventHandler public void onPluginDisable(PluginDisableEvent event) { for (Minigame mg : Minigame.getMinigameInstances()) { if (mg.getPlugin().getName().equals(event.getPlugin().getName())) { Minigame.unregisterPlugin(event.getPlugin().getName()); } } }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPluginDisableEvent(PluginDisableEvent pluginDisableEvent) { if (!this.executorService.isShutdown()) { this.executorService.shutdown(); } }