本文整理匯總了Java中org.bukkit.plugin.ServicesManager類的典型用法代碼示例。如果您正苦於以下問題:Java ServicesManager類的具體用法?Java ServicesManager怎麽用?Java ServicesManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ServicesManager類屬於org.bukkit.plugin包,在下文中一共展示了ServicesManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: hook
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
/**
* 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();
}
}
示例2: onEnable
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
@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();
}
示例3: getVaultChat
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
/**
* Если 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;
}
示例4: getVaultEconomy
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
/**
* Если 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;
}
示例5: getVaultPermission
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
/**
* Если 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;
}
示例6: invoke
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
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);
}
示例7: unhook
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
/**
* 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;
}
}
示例8: setupEconomy
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
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.");
}
}
示例9: registerEconomy
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
/**
* 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.");
}
}
示例10: setupPermissions
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
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();
}
}
}
示例11: getServicesManager
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
@Override
public ServicesManager getServicesManager() {
return servicesManager;
}
示例12: services
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
public static ServicesManager services() {
return server().getServicesManager();
}
示例13: getServicesManager
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
@Override
public ServicesManager getServicesManager()
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
示例14: getServicesManager
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
@Override
public ServicesManager getServicesManager() {
throw new UnsupportedOperationException( "Not implemented yet" );
}
示例15: getServicesManager
import org.bukkit.plugin.ServicesManager; //導入依賴的package包/類
@Override
public ServicesManager getServicesManager() {
// TODO Auto-generated method stub
return null;
}