Java Code Examples for org.spongepowered.api.Sponge#getServiceManager()
The following examples show how to use
org.spongepowered.api.Sponge#getServiceManager() .
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: WebAPI.java From Web-API with MIT License | 4 votes |
@Listener public void onPreInitialization(GamePreInitializationEvent event) { WebAPI.instance = this; Timings.STARTUP.startTiming(); Platform platform = Sponge.getPlatform(); spongeApi = platform.getContainer(Component.API).getVersion().orElse(null); spongeGame = platform.getContainer(Component.GAME).getVersion().orElse(null); spongeImpl = platform.getContainer(Component.IMPLEMENTATION).getVersion().orElse(null); pluginList = Sponge.getPluginManager().getPlugins().stream() .map(p -> p.getId() + ": " + p.getVersion().orElse(null)) .collect(Collectors.joining("; \n")); // Create our config directory if it doesn't exist if (!Files.exists(configPath)) { try { Files.createDirectories(configPath); } catch (IOException e) { e.printStackTrace(); } } // Reusable sync executor to run code on main server thread syncExecutor = Sponge.getScheduler().createSyncExecutor(this); asyncExecutor = Sponge.getScheduler().createAsyncExecutor(this); // Register custom serializers TypeSerializers.getDefaultSerializers().registerType( TypeToken.of(WebHook.class), new WebHookSerializer()); TypeSerializers.getDefaultSerializers().registerType( TypeToken.of(UserPermissionStruct.class), new UserPermissionStructSerializer()); TypeSerializers.getDefaultSerializers().registerType( TypeToken.of(PermissionStruct.class), new PermissionStructSerializer()); // Setup services this.blockService = new BlockService(); this.cacheService = new CacheService(); this.linkService = new LinkService(); this.messageService = new InteractiveMessageService(); this.securityService = new SecurityService(); this.serializeService = new SerializeService(); this.serverService = new ServerService(); this.servletService = new ServletService(); this.webHookService = new WebHookService(); this.userService = new UserService(); // Register services ServiceManager serviceMan = Sponge.getServiceManager(); serviceMan.setProvider(this, BlockService.class, blockService); serviceMan.setProvider(this, CacheService.class, cacheService); serviceMan.setProvider(this, LinkService.class, linkService); serviceMan.setProvider(this, InteractiveMessageService.class, messageService); serviceMan.setProvider(this, SecurityService.class, securityService); serviceMan.setProvider(this, SerializeService.class, serializeService); serviceMan.setProvider(this, ServerService.class, serverService); serviceMan.setProvider(this, ServletService.class, servletService); serviceMan.setProvider(this, WebHookService.class, webHookService); serviceMan.setProvider(this, UserService.class, userService); // Register events of services EventManager evenMan = Sponge.getEventManager(); evenMan.registerListeners(this, cacheService); evenMan.registerListeners(this, linkService); evenMan.registerListeners(this, webHookService); // Swagger setup stuff ModelConverters.getInstance().addConverter(new SwaggerModelConverter()); Timings.STARTUP.stopTiming(); }
Example 3
Source File: UltimateCore.java From UltimateCore with MIT License | 4 votes |
public ModuleService getModuleService() { ServiceManager manager = Sponge.getServiceManager(); return manager.provide(ModuleService.class).orElse(null); }
Example 4
Source File: UltimateCore.java From UltimateCore with MIT License | 4 votes |
public CommandService getCommandService() { ServiceManager manager = Sponge.getServiceManager(); return manager.provide(CommandService.class).orElse(null); }
Example 5
Source File: UltimateCore.java From UltimateCore with MIT License | 4 votes |
public UserService getUserService() { ServiceManager manager = Sponge.getServiceManager(); return manager.provide(UserService.class).orElse(null); }
Example 6
Source File: UltimateCore.java From UltimateCore with MIT License | 4 votes |
public PermissionService getPermissionService() { ServiceManager manager = Sponge.getServiceManager(); return manager.provide(PermissionService.class).orElse(null); }
Example 7
Source File: UltimateCore.java From UltimateCore with MIT License | 4 votes |
public TeleportService getTeleportService() { ServiceManager manager = Sponge.getServiceManager(); return manager.provide(TeleportService.class).orElse(null); }
Example 8
Source File: UltimateCore.java From UltimateCore with MIT License | 4 votes |
public TickService getTickService() { ServiceManager manager = Sponge.getServiceManager(); return manager.provide(TickService.class).orElse(null); }
Example 9
Source File: UltimateCore.java From UltimateCore with MIT License | 4 votes |
public VariableService getVariableService() { ServiceManager manager = Sponge.getServiceManager(); return manager.provide(VariableService.class).orElse(null); }
Example 10
Source File: UltimateCore.java From UltimateCore with MIT License | 4 votes |
public LanguageService getLanguageService() { ServiceManager manager = Sponge.getServiceManager(); return manager.provide(LanguageService.class).orElse(null); }
Example 11
Source File: UltimateCore.java From UltimateCore with MIT License | 4 votes |
public ErrorService getErrorService() { ServiceManager manager = Sponge.getServiceManager(); return manager.provide(ErrorService.class).orElse(null); }
Example 12
Source File: UltimateCore.java From UltimateCore with MIT License | 4 votes |
public Optional<SignService> getSignService() { ServiceManager manager = Sponge.getServiceManager(); return manager.provide(SignService.class); }