Java Code Examples for org.bukkit.plugin.Plugin#isEnabled()
The following examples show how to use
org.bukkit.plugin.Plugin#isEnabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlaceholderApiBridge.java From BungeePerms with GNU General Public License v3.0 | 6 votes |
@Override public void enable() { Bukkit.getPluginManager().registerEvents(this, BukkitPlugin.getInstance()); final Plugin plugin = Bukkit.getPluginManager().getPlugin("PlaceholderAPI"); if (plugin != null && plugin.isEnabled()) { Runnable r = new Runnable() { @Override public void run() { provider = new PlaceholderProvider(); provider.register(); } }; Bukkit.getScheduler().runTask(BukkitPlugin.getInstance(), r); } }
Example 2
Source File: Blackness.java From black with GNU General Public License v3.0 | 6 votes |
/** * this method handles every plugin disable event. * * @param event event to handle */ public void processPluginDisable(final PluginDisableEvent event) { if (!PLUGINQUEUE.peek().equals(event.getPlugin())) { synchronized (this) { PLUGINQUEUE.remove(event.getPlugin()); return; } } synchronized (this) { PLUGINQUEUE.poll(); } final Plugin nextPlugin = PLUGINQUEUE.peek(); if (nextPlugin != null && nextPlugin.isEnabled()) { registerListeners(nextPlugin); } }
Example 3
Source File: EssentialsBridge.java From BungeePerms with GNU General Public License v3.0 | 6 votes |
private void handleEssReload(String cmd) { if (cmd.startsWith("/")) cmd = cmd.substring(1); if (!cmd.startsWith("ess")) return; String[] split = cmd.split(" "); if (split.length <= 1 || !split[1].equalsIgnoreCase("reload")) return; // /ess reload executed final Plugin plugin = Bukkit.getPluginManager().getPlugin("Essentials"); if (!plugin.isEnabled()) return; Bukkit.getScheduler().runTaskLater(BukkitPlugin.getInstance(), new Runnable() { @Override public void run() { inject(plugin); } }, 1); }
Example 4
Source File: PermissionManager.java From PerWorldInventory with GNU General Public License v3.0 | 6 votes |
private void checkForPlugins() { this.usingPermissionsPlugin = false; for (PermissionSystem type : PermissionSystem.values()) { try { Plugin plugin = pluginManager.getPlugin(type.getPluginName()); if (plugin == null) continue; if (!plugin.isEnabled()) continue; this.usingPermissionsPlugin = true; } catch (Exception ex) { ConsoleLogger.warning("Error encountered while checking for permission plugin:", ex); } } }
Example 5
Source File: AddonsChart.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
AddonsChart() { super("installed_addons", () -> { Map<String, Integer> addons = new HashMap<>(); for (Plugin plugin : SlimefunPlugin.getInstalledAddons()) { if (plugin.isEnabled()) { addons.put(plugin.getName(), 1); } } return addons; }); }
Example 6
Source File: IridiumSkyblock.java From IridiumSkyblock with GNU General Public License v2.0 | 5 votes |
private void setupPlaceholderAPI() { Plugin mvdw = getServer().getPluginManager().getPlugin("MVdWPlaceholderAPI"); if (mvdw != null && mvdw.isEnabled()) { new MVDWPlaceholderAPIManager().register(); getLogger().info("Successfully registered placeholders with MVDWPlaceholderAPI."); } setupClipsPlaceholderAPI(); }
Example 7
Source File: CraftScheduler.java From Thermos with GNU General Public License v3.0 | 5 votes |
private static void validate(final Plugin plugin, final Object task) { Validate.notNull(plugin, "Plugin cannot be null"); Validate.notNull(task, "Task cannot be null"); if (!plugin.isEnabled()) { throw new IllegalPluginAccessException("Plugin attempted to register task while disabled"); } }
Example 8
Source File: VersionCommand.java From MarriageMaster with GNU General Public License v3.0 | 5 votes |
@Override public void execute(@NotNull final CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args) { sender.sendMessage("##### Start Marriage Master version info #####"); sender.sendMessage("Marriage Master: " + plugin.getDescription().getVersion()); /*if_not[STANDALONE]*/ sender.sendMessage("PCGF PluginLib: " + at.pcgamingfreaks.PluginLib.Bukkit.PluginLib.getInstance().getVersion()); /*end[STANDALONE]*/ sender.sendMessage("Server: " + plugin.getServer().getVersion()); sender.sendMessage("Java: " + System.getProperty("java.version")); if(plugin.getBackpacksIntegration() != null) { sender.sendMessage(plugin.getBackpacksIntegration().getName() + ": " + plugin.getBackpacksIntegration().getVersion()); } Plugin pl; if(plugin.getConfiguration().isEconomyEnabled() && (pl = Bukkit.getPluginManager().getPlugin("Vault")) != null && pl.isEnabled()) { sender.sendMessage("Vault: " + pl.getDescription().getVersion()); } if((pl = Bukkit.getPluginManager().getPlugin("MVdWPlaceholderAPI")) != null && pl.isEnabled()) { sender.sendMessage("MVdWPlaceholderAPI: " + pl.getDescription().getVersion()); } if((pl = Bukkit.getPluginManager().getPlugin("PlaceholderAPI")) != null && pl.isEnabled()) { sender.sendMessage("PlaceholderAPI: " + pl.getDescription().getVersion()); } if(plugin.getConfiguration().isSkillApiBonusXPEnabled() && (pl = Bukkit.getPluginManager().getPlugin("SkillAPI")) != null && pl.isEnabled()) { sender.sendMessage("SkillAPI: " + pl.getDescription().getVersion()); } if(plugin.getConfiguration().isMcMMOBonusXPEnabled() && (pl = Bukkit.getPluginManager().getPlugin("mcMMO")) != null && pl.isEnabled()) { sender.sendMessage("mcMMO: " + pl.getDescription().getVersion()); } sender.sendMessage("##### End Marriage Master version info #####"); }
Example 9
Source File: HooksManager.java From RedProtect with GNU General Public License v3.0 | 5 votes |
private boolean checkWe() { Plugin pWe = Bukkit.getPluginManager().getPlugin("WorldEdit"); if (pWe != null) { try { int v = Integer.parseInt(pWe.getDescription().getVersion().split("\\.")[0]); return (v >= 7) && pWe.isEnabled(); } catch (Exception ignored) { } } return false; }
Example 10
Source File: CraftServer.java From Thermos with GNU General Public License v3.0 | 5 votes |
public ChunkGenerator getGenerator(String world) { ConfigurationSection section = configuration.getConfigurationSection("worlds"); ChunkGenerator result = null; if (section != null) { section = section.getConfigurationSection(world); if (section != null) { String name = section.getString("generator"); if ((name != null) && (!name.equals(""))) { String[] split = name.split(":", 2); String id = (split.length > 1) ? split[1] : null; Plugin plugin = pluginManager.getPlugin(split[0]); if (plugin == null) { getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + split[0] + "' does not exist"); } else if (!plugin.isEnabled()) { getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + plugin.getDescription().getFullName() + "' is not enabled yet (is it load:STARTUP?)"); } else { try { result = plugin.getDefaultWorldGenerator(world, id); if (result == null) { getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + plugin.getDescription().getFullName() + "' lacks a default world generator"); } } catch (Throwable t) { plugin.getLogger().log(Level.SEVERE, "Could not set generator for default world '" + world + "': Plugin '" + plugin.getDescription().getFullName(), t); } } } } } return result; }
Example 11
Source File: BukkitQueue_0.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public boolean supports(Capability capability) { switch (capability) { case CHUNK_PACKETS: Plugin plib = Bukkit.getPluginManager().getPlugin("ProtocolLib"); return plib != null && plib.isEnabled(); } return super.supports(capability); }
Example 12
Source File: IridiumSkyblock.java From IridiumSkyblock with GNU General Public License v2.0 | 5 votes |
public void setupClipsPlaceholderAPI() { Plugin clip = getServer().getPluginManager().getPlugin("PlaceholderAPI"); if (clip != null && clip.isEnabled()) { if (new ClipPlaceholderAPIManager().register()) { getLogger().info("Successfully registered placeholders with PlaceholderAPI."); } } }
Example 13
Source File: HooksManager.java From RedProtect with GNU General Public License v3.0 | 4 votes |
private boolean checkPvPm() { Plugin pPvp = Bukkit.getPluginManager().getPlugin("PvPManager"); return pPvp != null && pPvp.isEnabled(); }
Example 14
Source File: HooksManager.java From RedProtect with GNU General Public License v3.0 | 4 votes |
private boolean checkMyChunk() { Plugin pMC = Bukkit.getPluginManager().getPlugin("MyChunk"); return pMC != null && pMC.isEnabled(); }
Example 15
Source File: Main.java From ce with GNU Lesser General Public License v3.0 | 4 votes |
public static WorldGuardPlugin getWorldGuard() { Plugin worldguard = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard"); if (worldguard != null && worldguard instanceof WorldGuardPlugin && worldguard.isEnabled()) return (WorldGuardPlugin) worldguard; return null; }
Example 16
Source File: HooksManager.java From RedProtect with GNU General Public License v3.0 | 4 votes |
private boolean checkBM() { Plugin pBM = Bukkit.getPluginManager().getPlugin("BossBarAPI"); return pBM != null && pBM.isEnabled(); }
Example 17
Source File: HooksManager.java From RedProtect with GNU General Public License v3.0 | 4 votes |
private boolean checkPHAPI() { Plugin p = Bukkit.getPluginManager().getPlugin("PlaceholderAPI"); return p != null && p.isEnabled(); }
Example 18
Source File: UChat.java From UltimateChat with GNU General Public License v3.0 | 4 votes |
private boolean checkPHAPI() { Plugin p = Bukkit.getPluginManager().getPlugin("PlaceholderAPI"); return p != null && p.isEnabled(); }
Example 19
Source File: HooksManager.java From RedProtect with GNU General Public License v3.0 | 4 votes |
private boolean checkMyPet() { Plugin pMP = Bukkit.getPluginManager().getPlugin("MyPet"); return pMP != null && pMP.isEnabled(); }
Example 20
Source File: HooksManager.java From RedProtect with GNU General Public License v3.0 | 4 votes |
private boolean checkMagicCarpet() { Plugin pMC = Bukkit.getPluginManager().getPlugin("MagicCarpet"); return pMC != null && pMC.isEnabled(); }