org.bukkit.plugin.PluginManager Java Examples
The following examples show how to use
org.bukkit.plugin.PluginManager.
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: PluginHookServiceTest.java From AuthMeReloaded with GNU General Public License v3.0 | 6 votes |
@Test public void shouldReturnNullForNonMvWorld() { // given World world = mock(World.class); MVWorldManager mvWorldManager = mock(MVWorldManager.class); given(mvWorldManager.isMVWorld(world)).willReturn(false); PluginManager pluginManager = mock(PluginManager.class); MultiverseCore multiverse = mock(MultiverseCore.class); setPluginAvailable(pluginManager, MULTIVERSE, multiverse); given(multiverse.getMVWorldManager()).willReturn(mvWorldManager); PluginHookService pluginHookService = new PluginHookService(pluginManager); // when Location spawn = pluginHookService.getMultiverseSpawn(world); // then assertThat(spawn, nullValue()); verify(mvWorldManager).isMVWorld(world); verify(mvWorldManager, never()).getMVWorld(world); }
Example #2
Source File: PluginHookServiceTest.java From AuthMeReloaded with GNU General Public License v3.0 | 6 votes |
@Test public void shouldSetSocialSpyStatus() { // given Player player = mock(Player.class); Essentials ess = mock(Essentials.class); User user = mock(User.class); given(ess.getUser(player)).willReturn(user); PluginManager pluginManager = mock(PluginManager.class); setPluginAvailable(pluginManager, ESSENTIALS, ess); PluginHookService pluginHookService = new PluginHookService(pluginManager); // when pluginHookService.setEssentialsSocialSpyStatus(player, true); // then verify(ess).getUser(player); verify(user).setSocialSpyEnabled(true); }
Example #3
Source File: InjectorDefaultsMap.java From LuckPerms with MIT License | 6 votes |
public void uninject() { try { Objects.requireNonNull(DEFAULT_PERMISSIONS_FIELD, "DEFAULT_PERMISSIONS_FIELD"); PluginManager pluginManager = this.plugin.getBootstrap().getServer().getPluginManager(); if (!(pluginManager instanceof SimplePluginManager)) { return; } Object map = DEFAULT_PERMISSIONS_FIELD.get(pluginManager); if (map instanceof LuckPermsDefaultsMap) { LuckPermsDefaultsMap lpMap = (LuckPermsDefaultsMap) map; DEFAULT_PERMISSIONS_FIELD.set(pluginManager, new HashMap<>(lpMap)); } } catch (Exception e) { e.printStackTrace(); } }
Example #4
Source File: CompatibilityFactions.java From CombatLogX with GNU General Public License v3.0 | 6 votes |
@Override public void onActualEnable() { ICombatLogX plugin = getPlugin(); ExpansionManager expansionManager = plugin.getExpansionManager(); PluginManager manager = Bukkit.getPluginManager(); Logger logger = getLogger(); this.noEntryHandler = new FactionsNoEntryHandler(this); saveDefaultConfig("factions-compatibility.yml"); NoEntryListener listener = new NoEntryListener(this); expansionManager.registerListener(this, listener); Plugin pluginProtocolLib = manager.getPlugin("ProtocolLib"); if(pluginProtocolLib != null) { NoEntryForceFieldListener forceFieldListener = new NoEntryForceFieldListener(this); expansionManager.registerListener(this, forceFieldListener); String version = pluginProtocolLib.getDescription().getVersion(); logger.info("Successfully hooked into ProtocolLib v" + version); } }
Example #5
Source File: InjectorPermissionMap.java From LuckPerms with MIT License | 6 votes |
private LuckPermsPermissionMap tryInject() throws Exception { Objects.requireNonNull(PERMISSIONS_FIELD, "PERMISSIONS_FIELD"); PluginManager pluginManager = this.plugin.getBootstrap().getServer().getPluginManager(); if (!(pluginManager instanceof SimplePluginManager)) { this.plugin.getLogger().severe("PluginManager instance is not a 'SimplePluginManager', instead: " + pluginManager.getClass()); this.plugin.getLogger().severe("Unable to inject LuckPerms Permission map."); return null; } Object map = PERMISSIONS_FIELD.get(pluginManager); if (map instanceof LuckPermsPermissionMap && ((LuckPermsPermissionMap) map).plugin == this.plugin) { return null; } //noinspection unchecked Map<String, Permission> castedMap = (Map<String, Permission>) map; // make a new map & inject it LuckPermsPermissionMap newMap = new LuckPermsPermissionMap(this.plugin, castedMap); PERMISSIONS_FIELD.set(pluginManager, newMap); return newMap; }
Example #6
Source File: PlotMe_CorePlugin.java From PlotMe-Core with GNU General Public License v3.0 | 6 votes |
@Override public void onEnable() { INSTANCE = this; getLogger().info("Enabling PlotMe...Waiting for generator data."); serverObjectBuilder = new BukkitServerBridge(this, getLogger()); plotme.registerServerBridge(serverObjectBuilder); getAPI().enable(); doMetric(); //Register Bukkit Events PluginManager pm = getServer().getPluginManager(); BukkitPlotListener listener = new BukkitPlotListener(this); pm.registerEvents(listener, this); pm.registerEvents(new BukkitPlotDenyListener(this), this); plotme.getEventBus().register(listener); //Register Command this.getCommand("plotme").setExecutor(new BukkitCommand(this)); }
Example #7
Source File: NicknameCommands.java From ProjectAres with GNU Affero General Public License v3.0 | 6 votes |
@Inject NicknameCommands(NicknameConfiguration config, SyncExecutor syncExecutor, UserService userService, Audiences audiences, IdentityProvider identities, OnlinePlayers onlinePlayers, UserFinder userFinder, PluginManager pluginManager, Plugin plugin) { this.config = config; this.syncExecutor = syncExecutor; this.userService = userService; this.audiences = audiences; this.identities = identities; this.onlinePlayers = onlinePlayers; this.userFinder = userFinder; this.pluginManager = pluginManager; this.plugin = plugin; }
Example #8
Source File: InjectorSubscriptionMap.java From LuckPerms with MIT License | 6 votes |
public void uninject() { try { Objects.requireNonNull(PERM_SUBS_FIELD, "PERM_SUBS_FIELD"); PluginManager pluginManager = this.plugin.getBootstrap().getServer().getPluginManager(); if (!(pluginManager instanceof SimplePluginManager)) { return; } Object map = PERM_SUBS_FIELD.get(pluginManager); if (map instanceof LuckPermsSubscriptionMap) { LuckPermsSubscriptionMap lpMap = (LuckPermsSubscriptionMap) map; PERM_SUBS_FIELD.set(pluginManager, lpMap.detach()); } } catch (Exception e) { e.printStackTrace(); } }
Example #9
Source File: PluginHookServiceTest.java From AuthMeReloaded with GNU General Public License v3.0 | 6 votes |
@Test public void shouldUnhookEssentialsAndMultiverse() { // given PluginManager pluginManager = mock(PluginManager.class); setPluginAvailable(pluginManager, ESSENTIALS, Essentials.class); setPluginAvailable(pluginManager, MULTIVERSE, MultiverseCore.class); PluginHookService pluginHookService = new PluginHookService(pluginManager); // when pluginHookService.unhookEssentials(); pluginHookService.unhookMultiverse(); // then assertThat(pluginHookService.isEssentialsAvailable(), equalTo(false)); assertThat(pluginHookService.isMultiverseAvailable(), equalTo(false)); }
Example #10
Source File: CompatibilitySkyBlock.java From CombatLogX with GNU General Public License v3.0 | 6 votes |
@Override public void onEnable() { ICombatLogX plugin = getPlugin(); ExpansionManager expansionManager = plugin.getExpansionManager(); PluginManager manager = Bukkit.getPluginManager(); Logger logger = getLogger(); SkyBlockHook hook = SkyBlockHook.getSkyBlockHook(this); if(hook == null) { logger.info("A SkyBlock plugin could not be detected. If you believe this is an error please contact SirBlobman."); logger.info("Automatically disabling..."); expansionManager.disableExpansion(this); return; } Listener listener = new ListenerSkyBlock(hook); expansionManager.registerListener(this, listener); }
Example #11
Source File: CustomScoreBoard.java From CombatLogX with GNU General Public License v3.0 | 6 votes |
private String replacePlaceholders(String string) { ICombatLogX plugin = this.expansion.getPlugin(); Player player = getPlayer(); if(player == null) return string; PluginManager manager = Bukkit.getPluginManager(); if(manager.isPluginEnabled("PlaceholderAPI")) string = HookPlaceholderAPI.replacePlaceholders(player, string); if(manager.isPluginEnabled("MVdWPlaceholderAPI")) string = HookMVdWPlaceholderAPI.replacePlaceholders(player, string); String timeLeft = PlaceholderReplacer.getTimeLeftSeconds(plugin, player); String inCombat = PlaceholderReplacer.getInCombat(plugin, player); String combatStatus = PlaceholderReplacer.getCombatStatus(plugin, player); String enemyName = PlaceholderReplacer.getEnemyName(plugin, player); String enemyHealth = PlaceholderReplacer.getEnemyHealth(plugin, player); String enemyHealthRounded = PlaceholderReplacer.getEnemyHealthRounded(plugin, player); String enemyHearts = PlaceholderReplacer.getEnemyHearts(plugin, player); return string.replace("{time_left}", timeLeft) .replace("{in_combat}", inCombat) .replace("{status}", combatStatus) .replace("{enemy_name}", enemyName) .replace("{enemy_health}", enemyHealth) .replace("{enemy_health_rounded}", enemyHealthRounded) .replace("{enemy_hearts}", enemyHearts); }
Example #12
Source File: AntiVPN.java From AntiVPN with MIT License | 6 votes |
private void loadHooks() { PluginManager manager = plugin.getServer().getPluginManager(); Plugin plan; if ((plan = manager.getPlugin("Plan")) != null) { consoleCommandIssuer.sendInfo(Message.GENERAL__HOOK_ENABLE, "{plugin}", "Plan"); PlayerAnalyticsHook.create(plugin, plan); } else { consoleCommandIssuer.sendInfo(Message.GENERAL__HOOK_DISABLE, "{plugin}", "Plan"); } if (manager.getPlugin("PlaceholderAPI") != null) { consoleCommandIssuer.sendInfo(Message.GENERAL__HOOK_ENABLE, "{plugin}", "PlaceholderAPI"); ServiceLocator.register(new PlaceholderAPIHook()); } else { consoleCommandIssuer.sendInfo(Message.GENERAL__HOOK_DISABLE, "{plugin}", "PlaceholderAPI"); } }
Example #13
Source File: Permission.java From Kettle with GNU General Public License v3.0 | 6 votes |
/** * Adds this permission to the specified parent permission. * <p> * If the parent permission does not exist, it will be created and * registered. * * @param name Name of the parent permission * @param value The value to set this permission to * @return Parent permission it created or loaded */ public Permission addParent(String name, boolean value) { PluginManager pm = Bukkit.getServer().getPluginManager(); String lname = name.toLowerCase(java.util.Locale.ENGLISH); Permission perm = pm.getPermission(lname); if (perm == null) { perm = new Permission(lname); pm.addPermission(perm); } addParent(perm, value); return perm; }
Example #14
Source File: CombatLogX.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
private void registerListeners() { PluginManager manager = Bukkit.getPluginManager(); manager.registerEvents(new ListenerAttack(this), this); manager.registerEvents(new ListenerCombatChecks(this), this); manager.registerEvents(new ListenerPunishChecks(this), this); manager.registerEvents(new ListenerUntagger(this), this); manager.registerEvents(customDeathListener, this); }
Example #15
Source File: CompatibilityMVdWPlaceholderAPI.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
@Override public void onEnable() { ICombatLogX plugin = getPlugin(); ExpansionManager expansionManager = plugin.getExpansionManager(); PluginManager manager = Bukkit.getPluginManager(); Logger logger = getLogger(); if(!manager.isPluginEnabled("MVdWPlaceholderAPI")) { logger.info("The MVdWPlaceholderAPI plugin could not be found. This expansion will be automatically disabled."); expansionManager.disableExpansion(this); return; } Plugin pluginPlaceholderAPI = manager.getPlugin("MVdWPlaceholderAPI"); if(pluginPlaceholderAPI == null) { logger.info("The MVdWPlaceholderAPI plugin could not be found. This expansion will be automatically disabled."); expansionManager.disableExpansion(this); return; } String versionPlaceholderAPI = pluginPlaceholderAPI.getDescription().getVersion(); logger.info("Successfully hooked into MVdWPlaceholderAPI v" + versionPlaceholderAPI); HookMVdW hookMVdW = new HookMVdW(this); hookMVdW.register(); }
Example #16
Source File: CompatibilityPreciousStones.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
@Override public void onActualEnable() { ICombatLogX plugin = getPlugin(); ExpansionManager expansionManager = plugin.getExpansionManager(); PluginManager manager = Bukkit.getPluginManager(); Logger logger = getLogger(); Plugin pluginPreciousStones = manager.getPlugin("PreciousStones"); if(pluginPreciousStones == null) { logger.info("Could not find the PreciousStones plugin. This expansion will be automatically disabled."); expansionManager.disableExpansion(this); return; } String versionPreciousStones = pluginPreciousStones.getDescription().getVersion(); logger.info("Successfully hooked into Residence v" + versionPreciousStones); saveDefaultConfig("preciousstones-compatibility.yml"); this.noEntryHandler = new PreciousStonesNoEntryHandler(this); NoEntryListener listener = new NoEntryListener(this); expansionManager.registerListener(this, listener); ListenerFieldCreation listenerFieldCreation = new ListenerFieldCreation(this); expansionManager.registerListener(this, listenerFieldCreation); Plugin pluginProtocolLib = manager.getPlugin("ProtocolLib"); if(pluginProtocolLib != null) { NoEntryForceFieldListener forceFieldListener = new NoEntryForceFieldListener(this); expansionManager.registerListener(this, forceFieldListener); String versionProtocolLib = pluginProtocolLib.getDescription().getVersion(); logger.info("Successfully hooked into ProtocolLib v" + versionProtocolLib); } }
Example #17
Source File: ObsidianDestroyer.java From ObsidianDestroyer with GNU General Public License v3.0 | 5 votes |
@Override public void onEnable() { instance = this; LOG = getLogger(); // Initialize managers new ConfigManager(false); new HookManager(); new MaterialManager(); new ChunkManager(); // Set command executor getCommand("od").setExecutor(new ODCommand()); // Register Event listeners PluginManager pm = getServer().getPluginManager(); pm.registerEvents(new EntityExplodeListener(), this); if (HookManager.getInstance().isHookedCannons()) { pm.registerEvents(new EntityImpactListener(), this); } pm.registerEvents(new PlayerListener(), this); pm.registerEvents(new BlockListener(), this); pm.registerEvents(new ObsidianDestroyerListener(), this); try { Class.forName("org.bukkit.event.block.BlockExplodeEvent"); pm.registerEvents(new SpigotListener(), this); } catch (ClassNotFoundException e) { // YAY } }
Example #18
Source File: HookMVdWPlaceholderAPI.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
public static void disableTrigger(String pluginName, String trigger, Player player) { try { PluginManager manager = Bukkit.getPluginManager(); if(!manager.isPluginEnabled(pluginName)) return; Plugin plugin = manager.getPlugin(pluginName); if(plugin == null) return; if(!manager.isPluginEnabled("MVdWPlaceholderAPI")) return; EventAPI.triggerEvent(plugin, player, trigger, false); } catch(Exception ignored) {} }
Example #19
Source File: uSkyBlock.java From uSkyBlock with GNU General Public License v3.0 | 5 votes |
public synchronized boolean isRequirementsMet(CommandSender sender, Command command, String... args) { if (maintenanceMode && !( (command instanceof AdminCommand && args != null && args.length > 0 && args[0].equals("maintenance")) || command instanceof SetMaintenanceCommand)) { sender.sendMessage(tr("\u00a7cMAINTENANCE:\u00a7e uSkyBlock is currently in maintenance mode")); return false; } if (missingRequirements == null) { PluginManager pluginManager = getServer().getPluginManager(); missingRequirements = ""; for (String[] pluginReq : depends) { if (pluginReq.length > 2 && pluginReq[2].equals("optional")) { // Do check the version if an optional requirement is present. if (!pluginManager.isPluginEnabled(pluginReq[0])) { continue; } } if (pluginReq.length > 2 && pluginReq[2].equals("optionalIf")) { if (pluginManager.isPluginEnabled(pluginReq[3])) { continue; } } if (pluginManager.isPluginEnabled(pluginReq[0])) { PluginDescriptionFile desc = pluginManager.getPlugin(pluginReq[0]).getDescription(); if (VersionUtil.getVersion(desc.getVersion()).isLT(pluginReq[1])) { missingRequirements += tr("\u00a7buSkyBlock\u00a7e depends on \u00a79{0}\u00a7e >= \u00a7av{1}\u00a7e but only \u00a7cv{2}\u00a7e was found!\n", pluginReq[0], pluginReq[1], desc.getVersion()); } } else { missingRequirements += tr("\u00a7buSkyBlock\u00a7e depends on \u00a79{0}\u00a7e >= \u00a7av{1}", pluginReq[0], pluginReq[1]); } } } if (missingRequirements.isEmpty()) { return true; } else { sender.sendMessage(missingRequirements.split("\n")); return false; } }
Example #20
Source File: Notifier.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
private void hookIfEnabled(String pluginName) { PluginManager manager = Bukkit.getPluginManager(); if(!manager.isPluginEnabled(pluginName)) return; Plugin plugin = manager.getPlugin(pluginName); if(plugin == null) return; PluginDescriptionFile description = plugin.getDescription(); String nameAndVersion = description.getFullName(); Logger logger = getLogger(); logger.info("Successfully hooked into " + nameAndVersion); }
Example #21
Source File: CheatPrevention.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
@Override public void onEnable() { PluginManager manager = Bukkit.getPluginManager(); JavaPlugin plugin = getPlugin().getPlugin(); // All Versions manager.registerEvents(new ListenerBlocks(this), plugin); manager.registerEvents(new ListenerChat(this), plugin); manager.registerEvents(new ListenerCommandBlocker(this), plugin); manager.registerEvents(new ListenerEntities(this), plugin); manager.registerEvents(new ListenerFlight(this), plugin); manager.registerEvents(new ListenerGameMode(this), plugin); manager.registerEvents(new ListenerInventories(this), plugin); manager.registerEvents(new ListenerPotions(this), plugin); manager.registerEvents(new ListenerTeleport(this), plugin); int minorVersion = VersionUtil.getMinorVersion(); // 1.9+ Elytra if(minorVersion >= 9) manager.registerEvents(new ListenerElytra(this), plugin); // 1.11+ Totem of Undying if(minorVersion >= 11) manager.registerEvents(new ListenerTotemOfUndying(this), plugin); // 1.12+ PlayerPickupItemEvent --> EntityPickupItemEvent Listener itemPickupListener = minorVersion >= 12 ? new ListenerNewItemPickup(this) : new ListenerLegacyItemPickup(this); manager.registerEvents(itemPickupListener, plugin); // 1.13+ Riptide Enchantment if(minorVersion >= 13) manager.registerEvents(new ListenerRiptide(this), plugin); // Essentials Hook if(manager.isPluginEnabled("Essentials")) { ListenerEssentials listenerEssentials = new ListenerEssentials(this); manager.registerEvents(listenerEssentials, plugin); } }
Example #22
Source File: ExpansionManager.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
public void registerListener(Expansion expansion, Listener listener) { PluginManager manager = Bukkit.getPluginManager(); JavaPlugin plugin = this.plugin.getPlugin(); manager.registerEvents(listener, plugin); this.expansionListenerMap.computeIfAbsent(expansion, e -> new ArrayList<>()).add(listener); }
Example #23
Source File: PerWorldInventoryInitializationTest.java From PerWorldInventory with GNU General Public License v3.0 | 5 votes |
@Test public void shouldInitializeAllServices() { // given Injector injector = new InjectorBuilder().addDefaultHandlers("me.gnat008.perworldinventory").create(); injector.register(PerWorldInventory.class, plugin); injector.register(Server.class, server); injector.register(PluginManager.class, pluginManager); injector.provide(DataFolder.class, dataFolder); injector.register(Settings.class, settings); injector.registerProvider(DataSource.class, DataSourceProvider.class); // when plugin.injectServices(injector); plugin.registerEventListeners(injector); plugin.registerCommands(injector); // then - check various samples assertThat(injector.getIfAvailable(GroupManager.class), not(nullValue())); assertThat(injector.getIfAvailable(DataSource.class), instanceOf(FlatFile.class)); assertThat(injector.getIfAvailable(PWIPlayerManager.class), not(nullValue())); verifyRegisteredListener(PluginListener.class); verifyRegisteredListener(PlayerGameModeChangeListener.class); CommandVerifier commandVerifier = new CommandVerifier(plugin, injector); commandVerifier.assertHasCommand("pwi", PerWorldInventoryCommand.class); commandVerifier.assertHasCommand("reload", ReloadCommand.class); commandVerifier.assertHasCommand("setworlddefault", SetWorldDefaultCommand.class); }
Example #24
Source File: CompatibilityLands.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
@Override public void onActualEnable() { ICombatLogX plugin = getPlugin(); ExpansionManager expansionManager = plugin.getExpansionManager(); PluginManager manager = Bukkit.getPluginManager(); Logger logger = getLogger(); Plugin pluginLands = manager.getPlugin("Lands"); if(pluginLands == null) { logger.info("Could not find the Lands plugin. This expansion will be automatically disabled."); expansionManager.disableExpansion(this); return; } String versionLands = pluginLands.getDescription().getVersion(); logger.info("Successfully hooked into Lands v" + versionLands); saveDefaultConfig("lands-compatibility.yml"); HookLands hook = new HookLands(this); this.noEntryHandler = new LandsNoEntryHandler(this, hook); NoEntryListener listener = new NoEntryListener(this); expansionManager.registerListener(this, listener); Plugin pluginProtocolLib = manager.getPlugin("ProtocolLib"); if(pluginProtocolLib != null) { NoEntryForceFieldListener forceFieldListener = new NoEntryForceFieldListener(this); expansionManager.registerListener(this, forceFieldListener); String versionProtocolLib = pluginProtocolLib.getDescription().getVersion(); logger.info("Successfully hooked into ProtocolLib v" + versionProtocolLib); } }
Example #25
Source File: CompatibilityTowny.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
@Override public void onActualEnable() { ICombatLogX plugin = getPlugin(); ExpansionManager expansionManager = plugin.getExpansionManager(); PluginManager manager = Bukkit.getPluginManager(); Logger logger = getLogger(); Plugin pluginTowny = manager.getPlugin("Towny"); if(pluginTowny == null) { logger.info("Could not find the Towny plugin. This expansion will be automatically disabled."); expansionManager.disableExpansion(this); return; } String versionTowny = pluginTowny.getDescription().getVersion(); logger.info("Successfully hooked into Towny v" + versionTowny); saveDefaultConfig("towny-compatibility.yml"); this.noEntryHandler = new TownyNoEntryHandler(this); NoEntryListener listener = new NoEntryListener(this); expansionManager.registerListener(this, listener); Plugin pluginProtocolLib = manager.getPlugin("ProtocolLib"); if(pluginProtocolLib != null) { NoEntryForceFieldListener forceFieldListener = new NoEntryForceFieldListener(this); expansionManager.registerListener(this, forceFieldListener); String versionProtocolLib = pluginProtocolLib.getDescription().getVersion(); logger.info("Successfully hooked into ProtocolLib v" + versionProtocolLib); } }
Example #26
Source File: CivCraft.java From civcraft with GNU General Public License v2.0 | 5 votes |
private void registerEvents() { final PluginManager pluginManager = getServer().getPluginManager(); pluginManager.registerEvents(new BlockListener(), this); pluginManager.registerEvents(new ChatListener(), this); pluginManager.registerEvents(new BonusGoodieManager(), this); pluginManager.registerEvents(new MarkerPlacementManager(), this); pluginManager.registerEvents(new CustomItemManager(), this); pluginManager.registerEvents(new PlayerListener(), this); pluginManager.registerEvents(new DebugListener(), this); pluginManager.registerEvents(new LoreCraftableMaterialListener(), this); pluginManager.registerEvents(new LoreGuiItemListener(), this); pluginManager.registerEvents(new DisableXPListener(), this); pluginManager.registerEvents(new PvPLogger(), this); pluginManager.registerEvents(new TradeInventoryListener(), this); pluginManager.registerEvents(new MobListener(), this); pluginManager.registerEvents(new ArenaListener(), this); pluginManager.registerEvents(new CannonListener(), this); pluginManager.registerEvents(new WarListener(), this); pluginManager.registerEvents(new FishingListener(), this); pluginManager.registerEvents(new PvPListener(), this); pluginManager.registerEvents(new LoreEnhancementArenaItem(), this); if (hasPlugin("TagAPI")) { pluginManager.registerEvents(new TagAPIListener(), this); } if (hasPlugin("HeroChat")) { pluginManager.registerEvents(new HeroChatListener(), this); } }
Example #27
Source File: CompatibilityPlaceholderAPI.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
@Override public void onEnable() { ICombatLogX plugin = getPlugin(); ExpansionManager expansionManager = plugin.getExpansionManager(); PluginManager manager = Bukkit.getPluginManager(); Logger logger = getLogger(); if(!manager.isPluginEnabled("PlaceholderAPI")) { logger.info("The PlaceholderAPI plugin could not be found. This expansion will be automatically disabled."); expansionManager.disableExpansion(this); return; } Plugin pluginPlaceholderAPI = manager.getPlugin("PlaceholderAPI"); if(pluginPlaceholderAPI == null) { logger.info("The PlaceholderAPI plugin could not be found. This expansion will be automatically disabled."); expansionManager.disableExpansion(this); return; } String versionPlaceholderAPI = pluginPlaceholderAPI.getDescription().getVersion(); logger.info("Successfully hooked into PlaceholderAPI v" + versionPlaceholderAPI); HookPlaceholderAPI hookPlaceholderAPI = new HookPlaceholderAPI(this); hookPlaceholderAPI.register(); }
Example #28
Source File: PluginHookServiceTest.java From AuthMeReloaded with GNU General Public License v3.0 | 5 votes |
@Test public void shouldHookIntoEssentials() { // given PluginManager pluginManager = mock(PluginManager.class); PluginHookService pluginHookService = new PluginHookService(pluginManager); setPluginAvailable(pluginManager, ESSENTIALS, Essentials.class); assertThat(pluginHookService.isEssentialsAvailable(), equalTo(false)); // when pluginHookService.tryHookToEssentials(); // then assertThat(pluginHookService.isEssentialsAvailable(), equalTo(true)); }
Example #29
Source File: HookWorldGuard.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
public static WorldGuardVersion getWorldGuardVersion() { if(worldGuardVersion != null) return worldGuardVersion; PluginManager manager = Bukkit.getPluginManager(); Plugin plugin = manager.getPlugin("WorldGuard"); if(plugin == null) return (worldGuardVersion = WorldGuardVersion.ERROR); PluginDescriptionFile pdf = plugin.getDescription(); String version = pdf.getVersion(); if(version.startsWith("6.1")) return (worldGuardVersion = WorldGuardVersion.V6_1); if(version.startsWith("6.2")) return (worldGuardVersion = WorldGuardVersion.V6_2); if(version.startsWith("7.0")) return (worldGuardVersion = WorldGuardVersion.V7_0); return (worldGuardVersion = WorldGuardVersion.ERROR); }
Example #30
Source File: SpringSpigotTestInitializer.java From mcspring-boot with MIT License | 5 votes |
private static Server mockServer() { Server server = mock(Server.class); PluginManager pluginManager = mock(PluginManager.class); when(server.getPluginManager()).thenReturn(pluginManager); BukkitScheduler scheduler = mock(BukkitScheduler.class); when(server.getScheduler()).thenReturn(scheduler); setServer(server); return server; }