Search in sources :

Example 6 with NModuleTrigger

use of com.skelril.nitro.module.NModuleTrigger in project Skree by Skelril.

the class CustomRegisterySystem method preInit.

@NModuleTrigger(trigger = "PRE_INITIALIZATION")
public void preInit() {
    customItemSystem = new CustomItemSystem();
    customItemSystem.preInit();
    customBlockSystem = new CustomBlockSystem();
    customBlockSystem.preInit();
    customItemSystem.associate();
    customBlockSystem.associate();
    customRecipeSystem = new CustomRecipeSystem();
    customRecipeSystem.associate();
}
Also used : CustomRecipeSystem(com.skelril.skree.system.registry.recipe.CustomRecipeSystem) CustomBlockSystem(com.skelril.skree.system.registry.block.CustomBlockSystem) CustomItemSystem(com.skelril.skree.system.registry.item.CustomItemSystem) NModuleTrigger(com.skelril.nitro.module.NModuleTrigger)

Example 7 with NModuleTrigger

use of com.skelril.nitro.module.NModuleTrigger in project Skree by Skelril.

the class MarketSystem method init.

@NModuleTrigger(trigger = "SERVER_STARTED")
public void init() {
    try {
        service = new MarketServiceImpl(getMarketValueFile());
        loadState();
        // Register the service
        Sponge.getServiceManager().setProvider(SkreePlugin.inst(), MarketService.class, service);
        Sponge.getCommandManager().register(SkreePlugin.inst(), MarketCommand.aquireSpec(), "market", "mk");
        // Calculate delay
        long elapsedTime = System.currentTimeMillis() - state.getLastUpdate();
        long elapsedSeconds = elapsedTime / TimeUnit.SECONDS.toMillis(1);
        long waitDuration = WAIT_UNIT.toSeconds(WAIT_TIME);
        long remainingTime = Math.max(0, waitDuration - elapsedSeconds);
        // Schedule an update task for every two hours
        Task.builder().execute(() -> {
            service.updatePrices();
            state.setLastUpdate(System.currentTimeMillis());
            dumpState();
            MessageChannel.TO_ALL.send(Text.of(TextColors.GOLD, "The market has been updated"));
            GameChatterPlugin.inst().sendSystemMessage("The market has been updated");
        }).interval(WAIT_TIME, WAIT_UNIT).delay(remainingTime, TimeUnit.SECONDS).async().submit(SkreePlugin.inst());
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : MarketServiceImpl(com.skelril.skree.service.internal.market.MarketServiceImpl) IOException(java.io.IOException) NModuleTrigger(com.skelril.nitro.module.NModuleTrigger)

Example 8 with NModuleTrigger

use of com.skelril.nitro.module.NModuleTrigger in project Skree by Skelril.

the class ProjectileWatcherSystem method init.

@NModuleTrigger(trigger = "INITIALIZATION")
public void init() {
    service = new ProjectileWatcherServiceImpl();
    // Register Shooting Item Manipulator
    DataRegistration.builder().dataClass(ShootingItemData.class).immutableClass(ImmutableShootingItemData.class).builder(new ShootingItemDataManipulatorBuilder()).manipulatorId("shooting_item_manipulator").dataName("Shooting Item Data").buildAndRegister(SkreePlugin.container());
    // Register the service & command
    Sponge.getEventManager().registerListeners(SkreePlugin.inst(), service);
    Sponge.getServiceManager().setProvider(SkreePlugin.inst(), ProjectileWatcherService.class, service);
}
Also used : ProjectileWatcherServiceImpl(com.skelril.skree.service.internal.projectilewatcher.ProjectileWatcherServiceImpl) ShootingItemDataManipulatorBuilder(com.skelril.skree.service.internal.projectilewatcher.shooter.ShootingItemDataManipulatorBuilder) ImmutableShootingItemData(com.skelril.skree.service.internal.projectilewatcher.shooter.ImmutableShootingItemData) ShootingItemData(com.skelril.skree.service.internal.projectilewatcher.shooter.ShootingItemData) NModuleTrigger(com.skelril.nitro.module.NModuleTrigger)

Example 9 with NModuleTrigger

use of com.skelril.nitro.module.NModuleTrigger in project Skree by Skelril.

the class WorldGeneratorSystem method init.

@NModuleTrigger(trigger = "PRE_INITIALIZATION")
public void init() {
    Sponge.getRegistry().register(WorldGeneratorModifier.class, new VoidWorldGeneratorModifier());
    Sponge.getRegistry().register(WorldGeneratorModifier.class, new SolidWorldGeneratorModifier());
    Sponge.getRegistry().register(WorldGeneratorModifier.class, new BarrierWorldGeneratorModifier());
    Sponge.getRegistry().register(WorldGeneratorModifier.class, new NoOreWorldGeneratorModifier());
    Sponge.getRegistry().register(WorldGeneratorModifier.class, new WildernessWorldGeneratorModifier());
}
Also used : SolidWorldGeneratorModifier(com.skelril.skree.content.world.SolidWorldGeneratorModifier) WildernessWorldGeneratorModifier(com.skelril.skree.content.world.wilderness.WildernessWorldGeneratorModifier) BarrierWorldGeneratorModifier(com.skelril.skree.content.world.BarrierWorldGeneratorModifier) NoOreWorldGeneratorModifier(com.skelril.skree.content.world.NoOreWorldGeneratorModifier) VoidWorldGeneratorModifier(com.skelril.skree.content.world.VoidWorldGeneratorModifier) NModuleTrigger(com.skelril.nitro.module.NModuleTrigger)

Example 10 with NModuleTrigger

use of com.skelril.nitro.module.NModuleTrigger in project Skree by Skelril.

the class WorldSystem method init.

@NModuleTrigger(trigger = "SERVER_STARTED")
public void init() {
    service = new WorldServiceImpl();
    try {
        config = ConfigLoader.loadConfig("worlds.json", WorldSystemConfig.class);
        // Register the service & command
        Sponge.getEventManager().registerListeners(SkreePlugin.inst(), service);
        Sponge.getServiceManager().setProvider(SkreePlugin.inst(), WorldService.class, service);
        Sponge.getCommandManager().register(SkreePlugin.inst(), LoadWorldCommand.aquireSpec(), "loadworld");
        Sponge.getCommandManager().register(SkreePlugin.inst(), SetSpawnCommand.aquireSpec(), "setspawn");
        Sponge.getCommandManager().register(SkreePlugin.inst(), WorldCommand.aquireSpec(), "world");
        Sponge.getCommandManager().register(SkreePlugin.inst(), WorldListCommand.aquireSpec(), "worlds");
        Sponge.getCommandManager().register(SkreePlugin.inst(), WildernessMetaCommand.aquireSpec(), "wmeta");
        Sponge.getCommandManager().register(SkreePlugin.inst(), SummonWandererCommand.aquireSpec(), "wanderer");
        Sponge.getCommandManager().register(SkreePlugin.inst(), WildernessTeleportCommand.aquireSpec(), "wtp");
        initArchetypes();
        initWrappers();
        initWorlds();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : WorldServiceImpl(com.skelril.skree.service.internal.world.WorldServiceImpl) IOException(java.io.IOException) NModuleTrigger(com.skelril.nitro.module.NModuleTrigger)

Aggregations

NModuleTrigger (com.skelril.nitro.module.NModuleTrigger)20 IOException (java.io.IOException)6 WorldService (com.skelril.skree.service.WorldService)2 World (org.spongepowered.api.world.World)2 AntiPeskListener (com.skelril.skree.content.aid.AntiPeskListener)1 ChatCommandAid (com.skelril.skree.content.aid.ChatCommandAid)1 AntiJumpListener (com.skelril.skree.content.anticheat.AntiJumpListener)1 AntiRailDupeListener (com.skelril.skree.content.anticheat.AntiRailDupeListener)1 ArrowFishingHandler (com.skelril.skree.content.arrowfishing.ArrowFishingHandler)1 ItemCraftBlockingListener (com.skelril.skree.content.itemrestriction.ItemCraftBlockingListener)1 ItemInteractBlockingListener (com.skelril.skree.content.itemrestriction.ItemInteractBlockingListener)1 ModifierNotifier (com.skelril.skree.content.modifier.ModifierNotifier)1 BarrierWorldGeneratorModifier (com.skelril.skree.content.world.BarrierWorldGeneratorModifier)1 NoOreWorldGeneratorModifier (com.skelril.skree.content.world.NoOreWorldGeneratorModifier)1 SolidWorldGeneratorModifier (com.skelril.skree.content.world.SolidWorldGeneratorModifier)1 VoidWorldGeneratorModifier (com.skelril.skree.content.world.VoidWorldGeneratorModifier)1 WildernessWorldGeneratorModifier (com.skelril.skree.content.world.wilderness.WildernessWorldGeneratorModifier)1 CursedMineManager (com.skelril.skree.content.zone.global.cursedmine.CursedMineManager)1 TempleOfFateManager (com.skelril.skree.content.zone.global.templeoffate.TempleOfFateManager)1 TheForgeManager (com.skelril.skree.content.zone.global.theforge.TheForgeManager)1