本文整理了Java中org.bukkit.Server.getServicesManager()
方法的一些代码示例,展示了Server.getServicesManager()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getServicesManager()
方法的具体详情如下:
包路径:org.bukkit.Server
类名称:Server
方法名:getServicesManager
[英]Gets a services manager.
[中]找一个服务经理。
代码示例来源:origin: Bukkit/Bukkit
/**
* @see Server#getServicesManager()
*/
public static ServicesManager getServicesManager() {
return server.getServicesManager();
}
代码示例来源:origin: EngineHub/WorldEdit
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
try {
PermissionManager manager = server.getServicesManager().load(PermissionManager.class);
if (manager == null) {
return null;
}
return new PermissionsExResolver(server, manager);
} catch (Throwable t) {
return null;
}
}
代码示例来源:origin: EngineHub/WorldEdit
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
try {
WorldsHolder worldsHolder = server.getServicesManager().load(WorldsHolder.class);
if (worldsHolder == null) {
return null;
}
return new GroupManagerResolver(server, worldsHolder);
} catch (Throwable t) {
return null;
}
}
代码示例来源:origin: EngineHub/WorldEdit
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
if (server.getPluginManager().getPlugin("Vault") == null) {
return null;
}
RegisteredServiceProvider<Permission> rsp = server.getServicesManager().getRegistration(Permission.class);
perms = rsp.getProvider();
if (perms == null) {
return null;
}
return new VaultResolver(server);
}
代码示例来源:origin: EngineHub/WorldEdit
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
// Looking for service
RegisteredServiceProvider<PermissionsProvider> serviceProvider = server.getServicesManager().getRegistration(PermissionsProvider.class);
if (serviceProvider != null) {
return new PluginPermissionsResolver(serviceProvider.getProvider(), serviceProvider.getPlugin());
}
// Looking for plugin
for (Plugin plugin : server.getPluginManager().getPlugins()) {
if (plugin instanceof PermissionsProvider) {
return new PluginPermissionsResolver((PermissionsProvider) plugin, plugin);
}
}
return null;
}
代码示例来源:origin: Bukkit/Bukkit
public void disablePlugin(final Plugin plugin) {
if (plugin.isEnabled()) {
try {
plugin.getPluginLoader().disablePlugin(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
try {
server.getScheduler().cancelTasks(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while cancelling tasks for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
try {
server.getServicesManager().unregisterAll(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering services for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
try {
HandlerList.unregisterAll(plugin);
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering events for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
try {
server.getMessenger().unregisterIncomingPluginChannel(plugin);
server.getMessenger().unregisterOutgoingPluginChannel(plugin);
} catch(Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering plugin channels for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
}
}
代码示例来源:origin: webbukkit/dynmap
public static LuckPermsPermissions create(Server server, String name) {
if (!server.getPluginManager().isPluginEnabled("LuckPerms"))
return null;
LuckPermsApi luckPerms = server.getServicesManager().load(LuckPermsApi.class);
if(luckPerms == null)
return null;
Log.info("Using LuckPerms " + luckPerms.getPlatformInfo().getVersion() + " for access control");
return new LuckPermsPermissions(name, luckPerms);
}
代码示例来源:origin: SpigotMC/Spigot-API
/**
* @see Server#getServicesManager()
*/
public static ServicesManager getServicesManager() {
return server.getServicesManager();
}
代码示例来源:origin: EngineHub/WorldGuard
public ServicesReport() {
super("Services");
ServicesManager manager = Bukkit.getServer().getServicesManager();
Collection<Class<?>> services = manager.getKnownServices();
for (Class<?> service : services) {
Object provider = manager.load(service);
if (provider != null) {
append(service.getName(), provider);
}
}
}
代码示例来源:origin: com.github.drepic26/couponcodes
private boolean checkVault(){
if (permission != null) {
return true;
}
RegisteredServiceProvider<net.milkbowl.vault.permission.Permission> rsp = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
if (rsp == null) {
return false;
}
permission = rsp.getProvider();
return permission != null;
}
}
代码示例来源:origin: EpicEricEE/ShopChest
/**
* 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;
}
代码示例来源:origin: MilkBowl/Vault
public void setPlugin(Plugin plugin) {
this.vault = (Vault) plugin;
RegisteredServiceProvider<Economy> economyProvider = this.vault.getServer().getServicesManager().getRegistration(Economy.class);
if (economyProvider != null) {
this.economy = economyProvider.getProvider();
}
}
代码示例来源:origin: ProSavage/SavageFactions
private boolean setupPermissions() {
try {
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
if (rsp != null) {
perms = rsp.getProvider();
}
} catch (NoClassDefFoundError ex) {
return false;
}
return perms != null;
}
代码示例来源:origin: BentoBoxWorld/BentoBox
@Override
public boolean hook() {
RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
economy = rsp.getProvider();
return economy != null;
}
代码示例来源:origin: marcelo-mason/SimpleClans
private Boolean setupChat() {
RegisteredServiceProvider<Chat> chatProvider = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.chat.Chat.class);
if (chatProvider != null) {
chat = chatProvider.getProvider();
}
return chat != null;
}
代码示例来源:origin: ProSavage/SavageFactions
public Economy getEcon() {
RegisteredServiceProvider<Economy> rsp = SavageFactions.plugin.getServer().getServicesManager().getRegistration(Economy.class);
Economy econ = rsp.getProvider();
return econ;
}
代码示例来源:origin: marcelo-mason/PreciousStones
private Boolean setupPermissions() {
RegisteredServiceProvider<Permission> permissionProvider = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
if (permissionProvider != null) {
permission = permissionProvider.getProvider();
}
return (permission != null);
}
代码示例来源:origin: MilkBowl/Vault
@Override
public void onDisable() {
// Remove all Service Registrations
getServer().getServicesManager().unregisterAll(this);
Bukkit.getScheduler().cancelTasks(this);
}
代码示例来源:origin: FunnyGuilds/FunnyGuilds
public static void initEconomyHook() {
RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
FunnyGuildsLogger.warning("No economy provider found, some features may not be available");
return;
}
economyHook = rsp.getProvider();
}
代码示例来源:origin: Dytanic/CloudNet
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);
}
内容来源于网络,如有侵权,请联系作者删除!