/** * Registers the LuckPerms implementation of {@link Permission} and {@link Chat} with * the service manager. * * @param plugin the plugin */ public void hook(LPBukkitPlugin plugin) { try { if (this.permissionHook == null) { this.permissionHook = new VaultPermissionHook(plugin); } if (this.chatHook == null) { this.chatHook = new VaultChatHook(plugin, this.permissionHook); } final ServicesManager sm = plugin.getServer().getServicesManager(); sm.register(Permission.class, this.permissionHook, plugin, ServicePriority.High); sm.register(Chat.class, this.chatHook, plugin, ServicePriority.High); } catch (Exception e) { e.printStackTrace(); } }
@Override public void onEnable() { ServicesManager sm = handler.getServer().getServicesManager(); RegisteredServiceProvider<Permission> permProvider = sm.getRegistration(Permission.class); if (permProvider != null) perm = permProvider.getProvider(); RegisteredServiceProvider<Economy> econProvider = sm.getRegistration(Economy.class); if (econProvider != null) econ = econProvider.getProvider(); RegisteredServiceProvider<Chat> chatProvider = sm.getRegistration(Chat.class); if (chatProvider != null) chat = chatProvider.getProvider(); }
/** * Если Vault установлен на сервере и включён, а также имеется какой-нибудь плагин, * предоставляющий нужный интерфейс, он будет возвращён, иначе будет возвращено null. * @return net.milkbowl.vault.chat.Chat */ public Chat getVaultChat() { if(chat == null) { if(plugin.getServer().getPluginManager().isPluginEnabled("Vault")) { plugin.logger.info("Found Vault! Searching for chat plugin..."); final ServicesManager servicesManager = plugin.getServer().getServicesManager(); RegisteredServiceProvider<Chat> provider = servicesManager.getRegistration(Chat.class); if(provider != null) chat = provider.getProvider(); if(chat != null && chat.isEnabled()) plugin.logger.log(Level.INFO, "Using {0} as chat provider.", chat.getName()); } } return chat; }
/** * Если Vault установлен на сервере и включён, а также имеется какой-нибудь плагин, * предоставляющий нужный интерфейс, он будет возвращён, иначе будет возвращено null. * @return net.milkbowl.vault.economy.Economy */ public Economy getVaultEconomy() { if(economy == null) { if(plugin.getServer().getPluginManager().isPluginEnabled("Vault")) { plugin.logger.info("Found Vault! Searching for economy plugin..."); final ServicesManager servicesManager = plugin.getServer().getServicesManager(); RegisteredServiceProvider<Economy> provider = servicesManager.getRegistration(Economy.class); if(provider != null) economy = provider.getProvider(); if(economy != null && economy.isEnabled()) plugin.logger.log(Level.INFO, "Using {0} as chat provider.", economy.getName()); } } return economy; }
/** * Если Vault установлен на сервере и включён, а также имеется какой-нибудь плагин, * предоставляющий нужный интерфейс, он будет возвращён, иначе будет возвращено null. * @return net.milkbowl.vault.permission.Permission */ public Permission getVaultPermission() { if(permission == null) { if(plugin.getServer().getPluginManager().isPluginEnabled("Vault")) { plugin.logger.info("Found Vault! Searching for permission plugin..."); final ServicesManager servicesManager = plugin.getServer().getServicesManager(); RegisteredServiceProvider<Permission> provider = servicesManager.getRegistration(Permission.class); if(provider != null) permission = provider.getProvider(); if(permission != null && permission.isEnabled()) plugin.logger.log(Level.INFO, "Using {0} as chat provider.", permission.getName()); } } return permission; }
public static void invoke() { ServicesManager servicesManager = BukkitBootstrap.getPlugin(BukkitBootstrap.class).getServer().getServicesManager(); Permission permission = new VaultPermissionImpl(); servicesManager.register(Permission.class, permission, BukkitBootstrap.getPlugin(BukkitBootstrap.class), ServicePriority.Highest); servicesManager.register(Chat.class, new VaultChatImpl(permission), BukkitBootstrap.getPlugin(BukkitBootstrap.class), ServicePriority.Highest); }
/** * Unregisters the LuckPerms Vault hooks, if present. * * @param plugin the plugin */ public void unhook(LPBukkitPlugin plugin) { final ServicesManager sm = plugin.getServer().getServicesManager(); if (this.permissionHook != null) { sm.unregister(Permission.class, this.permissionHook); this.permissionHook.getExecutor().shutdown(); this.permissionHook = null; } if (this.chatHook != null) { sm.unregister(Chat.class, this.chatHook); this.chatHook = null; } }
private void setupEconomy() { if (getServer().getPluginManager().getPlugin("Vault") != null) { final ServicesManager sm = getServer().getServicesManager(); sm.register(Economy.class, new UCEconomy(), this, ServicePriority.Highest); System.out.println("Universal Coins: Registered Vault interface."); } else { System.out.println("Universal Coins: Vault not detected. Initialization failed."); } }
/** * Register Gringotts as economy provider for vault. */ private void registerEconomy() { if (DEP.vault.exists()) { final ServicesManager sm = getServer().getServicesManager(); sm.register(Economy.class, new VaultConnector(), this, ServicePriority.Highest); log.info("Registered Vault interface."); } else { log.info("Vault not found. Other plugins may not be able to access Gringotts accounts."); } }
private void setupPermissions() { if (getServer().getPluginManager().isPluginEnabled("Vault")) { ServicesManager serviceManager = getServer().getServicesManager(); RegisteredServiceProvider<Permission> permissionProvider = serviceManager.getRegistration(Permission.class); if (permissionProvider != null) { permission = permissionProvider.getProvider(); } } }
@Override public ServicesManager getServicesManager() { return servicesManager; }
public static ServicesManager services() { return server().getServicesManager(); }
@Override public ServicesManager getServicesManager() { // TODO Auto-generated method stub throw new UnimplementedOperationException(); }
@Override public ServicesManager getServicesManager() { throw new UnsupportedOperationException( "Not implemented yet" ); }
@Override public ServicesManager getServicesManager() { // TODO Auto-generated method stub return null; }
/** * @see Server#getServicesManager() */ public static ServicesManager getServicesManager() { return server.getServicesManager(); }
@Override public ServicesManager getServicesManager() { return null; }
public ServicesManager getServicesManager() { return servicesManager; }
public VaultMagic(@NotNull final ServicesManager manager) { Preconditions.checkNotNull(manager, "manager was null"); this.servicesManager = manager; this.setUpPermission(); this.setUpChat(); }
@Override public ServicesManager getServicesManager() { return currentServer.getServicesManager(); }