All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.neoforged.camelot.module.StatsModule Maven / Gradle / Ivy

There is a newer version: 1.0.177
Show newest version
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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy