当前位置: 首页>>代码示例>>Java>>正文


Java PluginDisableEvent类代码示例

本文整理汇总了Java中org.bukkit.event.server.PluginDisableEvent的典型用法代码示例。如果您正苦于以下问题:Java PluginDisableEvent类的具体用法?Java PluginDisableEvent怎么用?Java PluginDisableEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PluginDisableEvent类属于org.bukkit.event.server包,在下文中一共展示了PluginDisableEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loaderDisablePlugin

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
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));
       }
}
 
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:22,代码来源:TestPluginManager.java

示例2: registerBukkitEvents

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
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);
}
 
开发者ID:ElDzi,项目名称:MoreMobs,代码行数:27,代码来源:TinyProtocol.java

示例3: registerBukkitEvents

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
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);
}
 
开发者ID:Zahusek,项目名称:-XclsX-TPAv3-XclsX-,代码行数:26,代码来源:TinyProtocolAPI.java

示例4: disablePlugin

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
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);
    }
}
 
开发者ID:cyberlis,项目名称:pploader,代码行数:25,代码来源:PythonPluginLoader.java

示例5: registerBukkitEvents

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:31,代码来源:TinyProtocol.java

示例6: onPluginDisable

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
@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());
    });
}
 
开发者ID:MinusKube,项目名称:SmartInvs,代码行数:13,代码来源:InventoryManager.java

示例7: onPluginDisable

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
@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.
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:8,代码来源:MechanicManager.java

示例8: on

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:RezzedUp,项目名称:OpGuard,代码行数:10,代码来源:PluginDisableHijack.java

示例9: registerShutdownHandler

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:aikar,项目名称:TaskChain,代码行数:12,代码来源:BukkitTaskChainFactory.java

示例10: pluginDisable

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
@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();
        }
    }
}
 
开发者ID:GameBoxx,项目名称:GameBoxx,代码行数:13,代码来源:Menu.java

示例11: disable

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
@EventHandler
void disable(PluginDisableEvent e)
{
	if(!e.getPlugin().getClass().equals(TinyProtocolAPI.class)) return;
	for(Player player : Bukkit.getServer().getOnlinePlayers())
		TabAPI.remove(TinyProtocolAPI.class, player);
}
 
开发者ID:Zahusek,项目名称:TinyProtocolAPI,代码行数:8,代码来源:TabListener.java

示例12: vb

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
@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());
	}
}
 
开发者ID:Zahusek,项目名称:TinyProtocolAPI,代码行数:11,代码来源:TabMap.java

示例13: disablePlugin

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
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);
            }
        }
    }
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:31,代码来源:JavaPluginLoader.java

示例14: onPluginDisable

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPluginDisable(PluginDisableEvent event)
{
	if (event.getPlugin().equals(plugin))
	{
		closeOpenMenus();
		plugin = null;
	}
}
 
开发者ID:MrLittleKitty,项目名称:AnnihilationPro,代码行数:10,代码来源:ItemMenuListener.java

示例15: disablePlugin

import org.bukkit.event.server.PluginDisableEvent; //导入依赖的package包/类
@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));
    }
}
 
开发者ID:caoli5288,项目名称:economy,代码行数:16,代码来源:SubPluginLoader.java


注:本文中的org.bukkit.event.server.PluginDisableEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。