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();
}
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();
}
}
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);
}
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());
}
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();
}
}
Aggregations