org.spongepowered.api.service.ProviderRegistration Java Examples
The following examples show how to use
org.spongepowered.api.service.ProviderRegistration.
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: VirtualChestPlaceholderManager.java From VirtualChest with GNU Lesser General Public License v3.0 | 5 votes |
public VirtualChestPlaceholderManager(VirtualChestPlugin plugin) { ProviderRegistration<PlaceholderService> registration; ServiceManager serviceManager = Sponge.getServiceManager(); plugin.getLogger().info("Try to load the PlaceholderAPI service ... "); registration = serviceManager.getRegistration(PlaceholderService.class).orElseThrow(RuntimeException::new); this.papiVersion = registration.getPlugin().getVersion().orElse("unknown"); this.papiService = registration.getProvider(); }
Example #2
Source File: PlayerOnlineListener.java From Plan with GNU Lesser General Public License v3.0 | 5 votes |
private boolean isBanned(GameProfile profile) { Optional<ProviderRegistration<BanService>> banService = Sponge.getServiceManager().getRegistration(BanService.class); boolean banned = false; if (banService.isPresent()) { banned = banService.get().getProvider().isBanned(profile); } return banned; }
Example #3
Source File: ChatUI.java From ChatUI with MIT License | 5 votes |
@Listener(order = Order.POST) public void onPostInit(GamePostInitializationEvent event) { Optional<ProviderRegistration<PaginationService>> optService = Sponge.getGame().getServiceManager().getRegistration(PaginationService.class); if (optService.isPresent()) { PaginationService service = optService.get().getProvider(); Sponge.getGame().getServiceManager().setProvider(this, PaginationService.class, new TabbedPaginationService(service)); } this.features.load(); }
Example #4
Source File: PermissionsTab.java From ChatUI with MIT License | 5 votes |
private static PermissionActions findActions(PermissionService service) { ProviderRegistration<PermissionService> reg = Sponge.getServiceManager().getRegistration(PermissionService.class).get(); if (reg.getPlugin().getId().equals("permissionsex")) { // Ensure loaded service.loadCollection(PermissionService.SUBJECTS_COMMAND_BLOCK); service.loadCollection(PermissionService.SUBJECTS_GROUP); service.loadCollection(PermissionService.SUBJECTS_ROLE_TEMPLATE); service.loadCollection(PermissionService.SUBJECTS_SYSTEM); service.loadCollection(PermissionService.SUBJECTS_USER); return new PEXActions(); } return new FallbackPermActions(); }
Example #5
Source File: LuckPermsProvider.java From GriefDefender with MIT License | 4 votes |
public LuckPermsProvider() { final ProviderRegistration<LuckPerms> service = Sponge.getServiceManager().getRegistration(LuckPerms.class).orElse(null); this.luckPermsApi = service.getProvider(); }
Example #6
Source File: Stats.java From UltimateCore with MIT License | 4 votes |
public static HashMap<String, Object> collect() { final HashMap<String, Object> data = new HashMap<>(); data.put("serverid", ServerID.getUUID()); data.put("statsversion", 1); data.put("apitype", Sponge.getPlatform().getContainer(Platform.Component.API).getName().toLowerCase()); data.put("apiversion", Sponge.getPlatform().getContainer(Platform.Component.API).getVersion().orElse("Not Available")); data.put("implname", Sponge.getPlatform().getContainer(Platform.Component.IMPLEMENTATION).getName().toLowerCase()); data.put("implversion", Sponge.getPlatform().getContainer(Platform.Component.IMPLEMENTATION).getVersion().orElse("Not Available")); data.put("servertype", Sponge.getPlatform().getType().isServer() ? "server" : "client"); data.put("mcversion", Sponge.getPlatform().getMinecraftVersion().getName()); data.put("ucversion", Sponge.getPluginManager().fromInstance(UltimateCore.get()).get().getVersion().orElse("Not Available")); data.put("playersonline", Sponge.getServer().getOnlinePlayers().size()); data.put("worldsloaded", Sponge.getServer().getWorlds().size()); data.put("osname", System.getProperty("os.name")); data.put("osarch", System.getProperty("os.arch").contains("64") ? 64 : 32); data.put("osversion", System.getProperty("os.version")); data.put("cores", Runtime.getRuntime().availableProcessors()); data.put("maxram", Runtime.getRuntime().maxMemory()); data.put("freeram", Runtime.getRuntime().freeMemory()); data.put("onlinemode", Sponge.getServer().getOnlineMode()); data.put("javaversion", System.getProperty("java.version")); data.put("modules", StringUtil.join(", ", UltimateCore.get().getModuleService().getModules().stream().map(Module::getIdentifier).collect(Collectors.toList()))); data.put("language", UltimateCore.get().getGeneralConfig().get().getNode("language", "language").getString("EN_US")); //Plugins StringBuilder pluginbuilder = new StringBuilder(); for (PluginContainer plugin : Sponge.getPluginManager().getPlugins()) { pluginbuilder.append("\n" + plugin.getId() + " / " + plugin.getName() + " / " + plugin.getVersion().orElse("Not Available")); } data.put("plugins", pluginbuilder.toString()); //Permissions plugin Optional<ProviderRegistration<PermissionService>> permplugin = Sponge.getServiceManager().getRegistration(PermissionService.class); if (permplugin.isPresent()) { data.put("permissionsplugin", permplugin.get().getPlugin().getId() + " / " + permplugin.get().getPlugin().getName() + " / " + permplugin.get().getPlugin().getVersion().orElse("Not Available")); } else { data.put("permissionsplugin", "None"); } //Economy plugin Optional<ProviderRegistration<EconomyService>> economyplugin = Sponge.getServiceManager().getRegistration(EconomyService.class); if (economyplugin.isPresent()) { data.put("economyplugin", economyplugin.get().getPlugin().getId() + " / " + economyplugin.get().getPlugin().getName() + " / " + economyplugin.get().getPlugin().getVersion().orElse("Not Available")); } else { data.put("economyplugin", "None"); } //Return return data; }