progress on new metrics

This commit is contained in:
alexcrea 2026-03-02 21:58:09 +01:00
parent d037263e3f
commit 3e68af06ea
Signed by: alexcrea
GPG key ID: E346CD16413450E3
11 changed files with 141 additions and 47 deletions

View file

@ -23,6 +23,7 @@ import xyz.alexcrea.cuanvil.update.ModrinthUpdateChecker
import xyz.alexcrea.cuanvil.update.PluginSetDefault
import xyz.alexcrea.cuanvil.update.UpdateHandler
import xyz.alexcrea.cuanvil.util.Metrics
import xyz.alexcrea.cuanvil.util.MetricsUtil
import java.io.File
import java.io.FileReader
import java.util.logging.Level
@ -34,7 +35,6 @@ open class CustomAnvil : JavaPlugin() {
companion object {
// pluginIDS
private const val bstatsPluginId = 20923
private const val modrinthPluginID = "S75Ueiq9"
// Permission string required to use the plugin's features
@ -156,15 +156,17 @@ open class CustomAnvil : JavaPlugin() {
}
// Load metrics
try {
Metrics(this, bstatsPluginId)
} catch (_: Exception) {}
MetricsUtil.loadMetrics(this)
// Load other thing later.
// It is so other dependent plugins can implement there event listener before we fire them.
DependencyManager.scheduler.scheduleGlobally(this) { loadEnchantmentSystemDirty() }
}
override fun onDisable() {
MetricsUtil.shutdownMetrics()
}
private fun loadEnchantmentSystemDirty() {
try {
loadEnchantmentSystem()

View file

@ -21,6 +21,8 @@ object ConfigOptions {
// Path for config values
// ----------------------
const val METRIC_TYPE = "metric_type"
const val CAP_ANVIL_COST = "limit_repair_cost"
const val MAX_ANVIL_COST = "limit_repair_value"
const val REMOVE_ANVIL_COST_LIMIT = "remove_repair_limit"