net.neoforged.camelot.module.StatsModule Maven / Gradle / Ivy
package net.neoforged.camelot.module;
import com.google.auto.service.AutoService;
import net.neoforged.camelot.Database;
import net.neoforged.camelot.config.module.Statistics;
import net.neoforged.camelot.db.transactionals.StatsDAO;
import net.neoforged.camelot.module.api.CamelotModule;
import org.jdbi.v3.core.extension.ExtensionConsumer;
/**
* The module used to track statistics.
*/
@AutoService(CamelotModule.class)
public class StatsModule extends CamelotModule.Base {
public StatsModule() {
super(Statistics.class);
}
@Override
public String id() {
return "stats";
}
/**
* Use the extension of the given {@code type}.
*/
public void use(Class type, ExtensionConsumer dao) {
if (type == StatsDAO.Tricks.class && !config().isTricks()) return;
Database.stats().useExtension(type, dao);
}
}