org.bukkit.plugin.RegisteredServiceProvider Java Examples
The following examples show how to use
org.bukkit.plugin.RegisteredServiceProvider.
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: VaultHook.java From FunnyGuilds with Apache License 2.0 | 6 votes |
public static void initHooks() { RegisteredServiceProvider<Economy> economyProvider = Bukkit.getServer().getServicesManager().getRegistration(Economy.class); RegisteredServiceProvider<Permission> permissionProvider = Bukkit.getServer().getServicesManager().getRegistration(Permission.class); if (economyProvider != null) { economyHook = economyProvider.getProvider(); } else { FunnyGuilds.getInstance().getPluginLogger().warning("No economy provider found, some features may not be available"); } if (permissionProvider != null) { permissionHook = permissionProvider.getProvider(); } else { FunnyGuilds.getInstance().getPluginLogger().warning("No permission provider found, some features may not be available"); } }
Example #2
Source File: VaultIntegrator.java From BetonQuest with GNU General Public License v3.0 | 6 votes |
@Override public void hook() { RegisteredServiceProvider<Permission> permissionProvider = Bukkit.getServer().getServicesManager() .getRegistration(net.milkbowl.vault.permission.Permission.class); if (permissionProvider != null) { permission = permissionProvider.getProvider(); } RegisteredServiceProvider<Economy> economyProvider = Bukkit.getServer().getServicesManager() .getRegistration(net.milkbowl.vault.economy.Economy.class); if (economyProvider != null) { economy = economyProvider.getProvider(); } if (economy != null) { plugin.registerEvents("money", MoneyEvent.class); plugin.registerConditions("money", MoneyCondition.class); plugin.registerVariable("money", MoneyVariable.class); } else { LogUtils.getLogger().log(Level.WARNING, "There is no economy plugin on the server!"); } if (permission != null) { plugin.registerEvents("permission", PermissionEvent.class); } else { LogUtils.getLogger().log(Level.WARNING, "Could not get permission provider!"); } }
Example #3
Source File: GlobalWarming.java From GlobalWarming with GNU Lesser General Public License v3.0 | 6 votes |
/** * Economy (soft-dependency on Vault) * - If a Vault-based economy was not found, disable the bounty system */ private void setupEconomy() { if (Bukkit.getPluginManager().getPlugin("Vault") != null) { RegisteredServiceProvider<Economy> economyProvider = Bukkit.getServicesManager().getRegistration(Economy.class); if (economyProvider != null) { economy = economyProvider.getProvider(); } } if (economy == null) { instance.getLogger().warning("Bounty-system [disabled], Vault economy not found"); for (Permission permission : Bukkit.getPluginManager().getDefaultPermissions(false)) { if (permission.getName().startsWith("globalwarming.bounty")) { Bukkit.getPluginManager().getPermission(permission.getName()) .setDefault(PermissionDefault.FALSE); } } } else { instance.getLogger().info("Bounty-system [enabled], Vault economy found"); } }
Example #4
Source File: Econ.java From ClaimChunk with MIT License | 6 votes |
boolean setupEconomy(ClaimChunk instance) { this.instance = instance; // Check if Vault is present if (instance.getServer().getPluginManager().getPlugin("Vault") == null) return false; // Get the Vault service if it is present RegisteredServiceProvider<Economy> rsp = instance.getServer().getServicesManager().getRegistration(Economy.class); // Check if the service is valid if (rsp == null) return false; // Update current economy handler econ = rsp.getProvider(); // Success return true; }
Example #5
Source File: GroupSynchronizationManager.java From DiscordSRV with GNU General Public License v3.0 | 6 votes |
public Permission getPermissions() { if (permission != null) { return permission; } else { try { Class.forName("net.milkbowl.vault.permission.Permission"); RegisteredServiceProvider<Permission> provider = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class); if (provider == null) { DiscordSRV.debug("Can't access permissions: registration provider was null"); return null; } return permission = provider.getProvider(); } catch (ClassNotFoundException e) { if (!warnedAboutMissingVault) { DiscordSRV.error("Group synchronization failed: Vault classes couldn't be found (did it enable properly?). Vault is required for synchronization to work."); warnedAboutMissingVault = true; } return null; } } }
Example #6
Source File: VaultHandler.java From AuthMeReloaded with GNU General Public License v3.0 | 6 votes |
/** * Returns the Vault Permission interface. * * @param server the bukkit server instance * @return the vault permission instance * @throws PermissionHandlerException if the vault permission instance cannot be retrieved */ @VisibleForTesting Permission getVaultPermission(Server server) throws PermissionHandlerException { // Get the permissions provider service RegisteredServiceProvider<Permission> permissionProvider = server .getServicesManager().getRegistration(Permission.class); if (permissionProvider == null) { throw new PermissionHandlerException("Could not load permissions provider service"); } // Get the Vault provider and make sure it's valid Permission vaultPerms = permissionProvider.getProvider(); if (vaultPerms == null) { throw new PermissionHandlerException("Could not load Vault permissions provider"); } return vaultPerms; }
Example #7
Source File: VaultHelper.java From askyblock with GNU General Public License v2.0 | 5 votes |
/** * Sets up the permissions instance * * @return true if successful */ public static boolean setupPermissions() { RegisteredServiceProvider<Permission> permissionProvider = ASkyBlock.getPlugin().getServer().getServicesManager() .getRegistration(net.milkbowl.vault.permission.Permission.class); if (permissionProvider != null) { permission = permissionProvider.getProvider(); } return (permission != null); }
Example #8
Source File: VaultHelper.java From askyblock with GNU General Public License v2.0 | 5 votes |
/** * Sets up the economy instance * * @return true if successful */ public static boolean setupEconomy() { RegisteredServiceProvider<Economy> economyProvider = ASkyBlock.getPlugin().getServer().getServicesManager() .getRegistration(net.milkbowl.vault.economy.Economy.class); if (economyProvider != null) { econ = economyProvider.getProvider(); } return econ != null; }
Example #9
Source File: EconomyBridge.java From ChestCommands with GNU General Public License v3.0 | 5 votes |
public static boolean setupEconomy() { if (Bukkit.getPluginManager().getPlugin("Vault") == null) { return false; } RegisteredServiceProvider<Economy> rsp = Bukkit.getServicesManager().getRegistration(Economy.class); if (rsp == null) { return false; } economy = rsp.getProvider(); return economy != null; }
Example #10
Source File: DefaultHook.java From HeavySpleef with GNU General Public License v3.0 | 5 votes |
public <T> T getService(Class<T> service) { if (!isProvided()) { throw new IllegalStateException("Hook is not provided"); } RegisteredServiceProvider<T> provider = servicesManager.getRegistration(service); if (provider == null) { throw new IllegalStateException("RegisteredServiceProvider is null for service " + service.getName()); } return provider.getProvider(); }
Example #11
Source File: BukkitServerBridge.java From PlotMe-Core with GNU General Public License v3.0 | 5 votes |
/** * Get Economy from Vault * @return */ @Override public Optional<Economy> getEconomy() { RegisteredServiceProvider<Economy> economyProvider = Bukkit.getServer().getServicesManager().getRegistration(Economy.class); if (economyProvider != null) { return Optional.of(economyProvider.getProvider()); } return Optional.absent(); }
Example #12
Source File: PlayerVaults.java From PlayerVaults with GNU General Public License v3.0 | 5 votes |
private boolean setupEconomy() { if (getServer().getPluginManager().getPlugin("Vault") == null) { return false; } RegisteredServiceProvider<Economy> provider = getServer().getServicesManager().getRegistration(Economy.class); if (provider == null) { return false; } economy = provider.getProvider(); return economy != null; }
Example #13
Source File: McPrisonVariables.java From ScoreboardStats with MIT License | 5 votes |
public McPrisonVariables(ReplacerAPI replaceManager, Plugin plugin) throws UnsupportedPluginException { super(replaceManager, plugin); RegisteredServiceProvider<Economy> economyProvider = Bukkit.getServicesManager().getRegistration(Economy.class); if (economyProvider == null) { throw new UnsupportedPluginException("Couldn't find an economy plugin"); } else { eco = economyProvider.getProvider(); } }
Example #14
Source File: VaultVariables.java From ScoreboardStats with MIT License | 5 votes |
public VaultVariables(ReplacerAPI replaceManager, Plugin plugin) throws UnsupportedPluginException { super(replaceManager, plugin); RegisteredServiceProvider<Economy> economyProvider = Bukkit.getServicesManager().getRegistration(Economy.class); if (economyProvider == null) { //check if an economy plugin is installed otherwise it would throw a exception if the want to replace throw new UnsupportedPluginException("Cannot find an economy plugin"); } else { economy = economyProvider.getProvider(); } }
Example #15
Source File: TutorialEco.java From ServerTutorial with MIT License | 5 votes |
/** * @return Economy returns Economy instance otherwise null if none found */ public Economy getEcon() { if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) { return null; } RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl .vault.economy.Economy.class); if (rsp != null) { return rsp.getProvider(); } return null; }
Example #16
Source File: VaultChatBridge.java From LunaChat with GNU Lesser General Public License v3.0 | 5 votes |
/** * vault-chatをロードする * @param plugin vaultのプラグインインスタンス * @return ロードしたブリッジのインスタンス */ public static VaultChatBridge load(Plugin plugin) { RegisteredServiceProvider<Chat> chatProvider = Bukkit.getServicesManager().getRegistration(Chat.class); if ( chatProvider != null ) { VaultChatBridge bridge = new VaultChatBridge(); bridge.chatPlugin = chatProvider.getProvider(); return bridge; } return null; }
Example #17
Source File: Main.java From ce with GNU Lesser General Public License v3.0 | 5 votes |
private boolean setupEconomy() { if (getServer().getPluginManager().getPlugin("Vault") == null) return false; RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class); if (rsp == null) return false; econ = rsp.getProvider(); return econ != null; }
Example #18
Source File: AreaShop.java From AreaShop with GNU General Public License v3.0 | 5 votes |
/** * Get the Vault permissions provider. * @return Vault permissions provider */ public net.milkbowl.vault.permission.Permission getPermissionProvider() { RegisteredServiceProvider<net.milkbowl.vault.permission.Permission> permissionProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class); if (permissionProvider == null || permissionProvider.getProvider() == null) { return null; } return permissionProvider.getProvider(); }
Example #19
Source File: VaultEconomy.java From uSkyBlock with GNU General Public License v3.0 | 5 votes |
private Optional<Economy> setupEconomy() { RegisteredServiceProvider<Economy> rsp = plugin.getServer().getServicesManager().getRegistration(Economy.class); if (rsp != null) { economy = rsp.getProvider(); return Optional.of(economy); } return Optional.empty(); }
Example #20
Source File: VaultPermissions.java From uSkyBlock with GNU General Public License v3.0 | 5 votes |
private Optional<Permission> setupPermission() { RegisteredServiceProvider<Permission> rsp = plugin.getServer().getServicesManager().getRegistration(Permission.class); if (rsp != null) { permission = rsp.getProvider(); return Optional.of(permission); } return Optional.empty(); }
Example #21
Source File: DependencyManager.java From NovaGuilds with GNU General Public License v3.0 | 5 votes |
/** * Setups economy */ public void setupEconomy() { RegisteredServiceProvider<Economy> rsp = Bukkit.getServicesManager().getRegistration(Economy.class); Validate.notNull(rsp, "Could not find the Economy provider"); economy = rsp.getProvider(); Validate.notNull(economy); }
Example #22
Source File: PlayerInteractListener.java From PetMaster with GNU General Public License v3.0 | 5 votes |
public PlayerInteractListener(PetMaster petMaster) { this.plugin = petMaster; version = Integer.parseInt(PackageType.getServerVersion().split("_")[1]); // Try to retrieve an Economy instance from Vault. if (Bukkit.getServer().getPluginManager().getPlugin("Vault") != null) { RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager() .getRegistration(Economy.class); if (rsp != null) { economy = rsp.getProvider(); } } }
Example #23
Source File: ShopChest.java From ShopChest with MIT License | 5 votes |
/** * Sets up the economy of Vault * @return Whether an economy plugin has been registered */ private boolean setupEconomy() { RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class); if (rsp == null) { return false; } econ = rsp.getProvider(); return econ != null; }
Example #24
Source File: VaultUtils.java From SkyWarsReloaded with GNU General Public License v3.0 | 5 votes |
private boolean setupEconomy() { if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) { return false; } RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class); if (rsp == null) { return false; } econ = rsp.getProvider(); return econ != null; }
Example #25
Source File: VaultUtils.java From SkyWarsReloaded with GNU General Public License v3.0 | 5 votes |
private boolean setupEconomy() { if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) { return false; } RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class); if (rsp == null) { return false; } econ = rsp.getProvider(); return econ != null; }
Example #26
Source File: VaultUtil.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public VaultUtil() { final RegisteredServiceProvider<Permission> permissionProvider = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class); if (permissionProvider != null) { this.permission = permissionProvider.getProvider(); } else { this.permission = null; } }
Example #27
Source File: Main.java From TimeIsMoney with GNU General Public License v3.0 | 5 votes |
/** * Sets up the vault economy. * * @return True if the economy was set up, false otherwise. */ private boolean setupEconomy() { RegisteredServiceProvider<net.milkbowl.vault.economy.Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); if (economyProvider != null) { economy = economyProvider.getProvider(); } return economy != null; }
Example #28
Source File: VaultHook.java From SaneEconomy with GNU General Public License v3.0 | 5 votes |
public boolean hasPermission(OfflinePlayer offlinePlayer, String permNode) { RegisteredServiceProvider<Permission> rsp = this.plugin.getServer().getServicesManager().getRegistration(Permission.class); if ((offlinePlayer == null) || (offlinePlayer.getUniqueId() == null) || Strings.isNullOrEmpty(offlinePlayer.getName())) { return false; } return (rsp != null) && rsp.getProvider().playerHas(null, offlinePlayer, permNode); }
Example #29
Source File: VaultHook.java From DiscordSRV with GNU General Public License v3.0 | 5 votes |
public static String[] getGroups() { if (!PluginUtil.pluginHookIsEnabled("vault")) return new String[] {}; try { RegisteredServiceProvider<?> service = Bukkit.getServer().getServicesManager().getRegistration(Class.forName("net.milkbowl.vault.permission.Permission")); if (service == null) return new String[] {}; Method getGroupsMethod = service.getProvider().getClass().getMethod("getGroups"); return (String[]) getGroupsMethod.invoke(service.getProvider()); } catch (Exception ignored) { } return new String[] {}; }
Example #30
Source File: Main.java From BedWars with GNU Lesser General Public License v3.0 | 5 votes |
private boolean setupEconomy() { if (getServer().getPluginManager().getPlugin("Vault") == null) { return false; } RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class); if (rsp == null) { return false; } econ = rsp.getProvider(); return true; }