mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
add bstats cause why not
This commit is contained in:
parent
8c3447338e
commit
f51240adc6
4 changed files with 910 additions and 4 deletions
|
|
@ -6,6 +6,8 @@ import org.bukkit.configuration.file.YamlConfiguration
|
|||
import org.bukkit.plugin.java.JavaPlugin
|
||||
import xyz.alexcrea.group.EnchantConflictManager
|
||||
import xyz.alexcrea.group.ItemGroupManager
|
||||
import xyz.alexcrea.group.util.Metrics
|
||||
import xyz.alexcrea.group.util.Metrics.SimplePie
|
||||
import java.io.File
|
||||
import java.io.FileReader
|
||||
|
||||
|
|
@ -16,6 +18,9 @@ import java.io.FileReader
|
|||
class UnsafeEnchants : JavaPlugin() {
|
||||
|
||||
companion object {
|
||||
// bstats plugin id
|
||||
private const val bstatsPluginId = 20923
|
||||
|
||||
// Permission string required to use the plugin's features
|
||||
const val unsafePermission = "ue.unsafe"
|
||||
// Permission string required to bypass enchantment conflicts test
|
||||
|
|
@ -48,8 +53,12 @@ class UnsafeEnchants : JavaPlugin() {
|
|||
*/
|
||||
override fun onEnable() {
|
||||
instance = this
|
||||
// Load bstats
|
||||
val metric = Metrics(this, bstatsPluginId)
|
||||
saveDefaultConfig()
|
||||
|
||||
addCustomMetric(metric)
|
||||
|
||||
// Load material grouping config
|
||||
val itemGroupConfig = reloadResource(itemGroupingConfigName) ?: return
|
||||
// Read material groups from config
|
||||
|
|
@ -69,6 +78,22 @@ class UnsafeEnchants : JavaPlugin() {
|
|||
|
||||
}
|
||||
|
||||
private fun addCustomMetric(metric: Metrics) {
|
||||
metric.addCustomChart(SimplePie("item_rename_cost") {
|
||||
ConfigOptions.itemRenameCost.toString()
|
||||
})
|
||||
println("item_rename_cost: ${ConfigOptions.itemRenameCost}")
|
||||
metric.addCustomChart(SimplePie("item_repair_cost") {
|
||||
ConfigOptions.itemRepairCost.toString()
|
||||
})
|
||||
println("item_repair_cost: ${ConfigOptions.itemRepairCost}")
|
||||
metric.addCustomChart(SimplePie("sacrifice_illegal_enchant_cost") {
|
||||
ConfigOptions.sacrificeIllegalCost.toString()
|
||||
})
|
||||
println("sacrifice_illegal_enchant_cost: ${ConfigOptions.sacrificeIllegalCost}")
|
||||
|
||||
}
|
||||
|
||||
private fun reloadResource(resourceName: String,
|
||||
hardFailSafe:Boolean = true): YamlConfiguration?{
|
||||
// Save default resource
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue