mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-24 00:26:16 +02:00
add more usefull metrics
This commit is contained in:
parent
b36c1827a4
commit
944e4b025c
3 changed files with 143 additions and 18 deletions
|
|
@ -8,7 +8,7 @@ import xyz.alexcrea.command.ReloadExecutor
|
|||
import xyz.alexcrea.group.EnchantConflictManager
|
||||
import xyz.alexcrea.group.ItemGroupManager
|
||||
import xyz.alexcrea.util.Metrics
|
||||
import xyz.alexcrea.util.Metrics.SimplePie
|
||||
import xyz.alexcrea.util.MetricsUtil
|
||||
import java.io.File
|
||||
import java.io.FileReader
|
||||
|
||||
|
|
@ -64,11 +64,11 @@ class UnsafeEnchants : JavaPlugin() {
|
|||
*/
|
||||
override fun onEnable() {
|
||||
instance = this
|
||||
// Load bstats
|
||||
val metric = Metrics(this, bstatsPluginId)
|
||||
|
||||
reloadAllConfigs()
|
||||
addCustomMetric(metric)
|
||||
// Load metrics
|
||||
val metric = Metrics(this, bstatsPluginId)
|
||||
MetricsUtil.addCustomMetric(metric)
|
||||
|
||||
// Add command to reload the plugin
|
||||
val command = getCommand(commandReloadName)
|
||||
|
|
@ -102,19 +102,9 @@ class UnsafeEnchants : JavaPlugin() {
|
|||
// Set the global variable
|
||||
UnsafeEnchants.conflictManager = conflictManager
|
||||
UnsafeEnchants.unitRepairConfig = unitRepairConfig
|
||||
}
|
||||
|
||||
private fun addCustomMetric(metric: Metrics) {
|
||||
metric.addCustomChart(SimplePie("item_rename_cost") {
|
||||
ConfigOptions.itemRenameCost.toString()
|
||||
})
|
||||
metric.addCustomChart(SimplePie("item_repair_cost") {
|
||||
ConfigOptions.itemRepairCost.toString()
|
||||
})
|
||||
metric.addCustomChart(SimplePie("sacrifice_illegal_enchant_cost") {
|
||||
ConfigOptions.sacrificeIllegalCost.toString()
|
||||
})
|
||||
|
||||
// Test if default config
|
||||
MetricsUtil.testIfConfigIsDefault(config, itemGroupConfig, conflictConfig, unitRepairConfig)
|
||||
}
|
||||
|
||||
private fun reloadResource(resourceName: String,
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ object ConfigOptions {
|
|||
// Path for removing repair cost limits
|
||||
private const val REMOVE_REPAIR_LIMIT = "remove_repair_limit"
|
||||
// Root path for enchantment limits
|
||||
private const val ENCHANT_LIMIT_ROOT = "enchant_limits"
|
||||
const val ENCHANT_LIMIT_ROOT = "enchant_limits"
|
||||
// Root path for enchantment values
|
||||
private const val ENCHANT_VALUES_ROOT = "enchant_values"
|
||||
const val ENCHANT_VALUES_ROOT = "enchant_values"
|
||||
// Keys for specific enchantment values
|
||||
private const val KEY_BOOK = "book"
|
||||
private const val KEY_ITEM = "item"
|
||||
|
|
@ -194,4 +194,20 @@ object ConfigOptions {
|
|||
?: DEFAULT_ENCHANT_VALUE
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of key of basic config options
|
||||
*/
|
||||
fun getBasicConfigKeys(): Array<String>{
|
||||
return arrayOf(DEFAULT_LIMIT_PATH,
|
||||
LIMIT_REPAIR_COST,
|
||||
LIMIT_REPAIR_VALUE,
|
||||
ITEM_REPAIR_COST,
|
||||
UNIT_REPAIR_COST,
|
||||
ITEM_RENAME_COST,
|
||||
SACRIFICE_ILLEGAL_COST,
|
||||
REMOVE_REPAIR_LIMIT
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue