use of me.time6628.clag.sponge.config.ConfigLoader in project CatClearLag by Time6628.
the class CatClearLag method onPreInit.
@Listener
public void onPreInit(GamePreInitializationEvent event) {
getLogger().info("Setting up config...");
cfgLoader = new ConfigLoader(this);
if (cfgLoader.loadConfig())
cclConfig = cfgLoader.getCclConfig();
if (cfgLoader.loadMessages())
messages = cfgLoader.getMessagesConfig();
game.getServiceManager().setProvider(this, CCLService.class, cclService);
}
use of me.time6628.clag.sponge.config.ConfigLoader in project CatClearLag by Time6628.
the class CatClearLag method onReload.
@Listener
public void onReload(GameReloadEvent event) {
cfgLoader = new ConfigLoader(this);
if (cfgLoader.loadConfig())
cclConfig = cfgLoader.getCclConfig();
if (cfgLoader.loadMessages())
messages = cfgLoader.getMessagesConfig();
for (Task task : tasks) {
task.cancel();
}
tasks = new ArrayList<>();
Task.Builder builder = getGame().getScheduler().createTaskBuilder();
tasks.add(builder.execute(new ItemClearer()).async().delay(cclConfig.interval, TimeUnit.MINUTES).interval(cclConfig.interval, TimeUnit.MINUTES).name("CatClearLag Item Remover").submit(this));
cclConfig.warnings.forEach((d) -> tasks.add(builder.execute(new ItemClearingWarning(((cclConfig.interval * 60) - d))).async().delay(d, TimeUnit.SECONDS).interval(cclConfig.interval, TimeUnit.MINUTES).name("CatClearLag Removal Warnings").submit(this)));
tasks.add(builder.execute(new EntityChecker()).async().delay(cclConfig.limits.entityCheckInterval, TimeUnit.MINUTES).interval(cclConfig.limits.entityCheckInterval, TimeUnit.MINUTES).name("CatClearLag hostile checker").submit(this));
}
Aggregations