Search in sources :

Example 16 with WorldService

use of com.skelril.skree.service.WorldService in project Skree by Skelril.

the class RegionSystem method init.

@NModuleTrigger(trigger = "SERVER_STARTED", dependencies = { "World System" })
public void init() {
    service = new RegionServiceImpl();
    Optional<WorldService> optWorldService = Sponge.getServiceManager().provide(WorldService.class);
    if (optWorldService.isPresent()) {
        for (World world : optWorldService.get().getEffectWrapper(BuildWorldWrapper.class).get().getWorlds()) {
            RegionManager manager = new RegionManager(world.getName());
            manager.load();
            service.addManager(world, manager);
        }
    }
    // Register the service & command
    Sponge.getEventManager().registerListeners(SkreePlugin.inst(), service);
    Sponge.getServiceManager().setProvider(SkreePlugin.inst(), RegionService.class, service);
    Sponge.getCommandManager().register(SkreePlugin.inst(), RegionCommand.aquireSpec(), "region", "rg");
}
Also used : RegionManager(com.skelril.skree.service.internal.region.RegionManager) RegionServiceImpl(com.skelril.skree.service.internal.region.RegionServiceImpl) World(org.spongepowered.api.world.World) WorldService(com.skelril.skree.service.WorldService) NModuleTrigger(com.skelril.nitro.module.NModuleTrigger)

Aggregations

WorldService (com.skelril.skree.service.WorldService)16 World (org.spongepowered.api.world.World)10 WorldEffectWrapper (com.skelril.skree.service.internal.world.WorldEffectWrapper)5 Player (org.spongepowered.api.entity.living.player.Player)4 NModuleTrigger (com.skelril.nitro.module.NModuleTrigger)2 BuildWorldWrapper (com.skelril.skree.content.world.build.BuildWorldWrapper)2 InstanceWorldWrapper (com.skelril.skree.content.world.instance.InstanceWorldWrapper)2 MainWorldWrapper (com.skelril.skree.content.world.main.MainWorldWrapper)2 DecimalFormat (java.text.DecimalFormat)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Sponge (org.spongepowered.api.Sponge)2 CommandException (org.spongepowered.api.command.CommandException)2 CommandResult (org.spongepowered.api.command.CommandResult)2 CommandSource (org.spongepowered.api.command.CommandSource)2 CommandContext (org.spongepowered.api.command.args.CommandContext)2 CommandExecutor (org.spongepowered.api.command.spec.CommandExecutor)2 CommandSpec (org.spongepowered.api.command.spec.CommandSpec)2 Listener (org.spongepowered.api.event.Listener)2 Text (org.spongepowered.api.text.Text)2