mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-24 00:26:16 +02:00
Add material groups and prepare additional permissions.
This commit is contained in:
parent
e2aa0509f0
commit
e18e5b224e
8 changed files with 256 additions and 2 deletions
|
|
@ -1,7 +1,9 @@
|
|||
package io.delilaheve
|
||||
|
||||
import io.delilaheve.util.ConfigOptions
|
||||
import org.bukkit.configuration.file.YamlConfiguration
|
||||
import org.bukkit.plugin.java.JavaPlugin
|
||||
import xyz.alexcrea.group.ItemGroupManager
|
||||
|
||||
/**
|
||||
* Bukkit/Spigot/Paper plugin to alter enchantment max
|
||||
|
|
@ -12,8 +14,15 @@ class UnsafeEnchants : JavaPlugin() {
|
|||
companion object {
|
||||
// Permission string required to use the plugin's features
|
||||
const val unsafePermission = "ue.unsafe"
|
||||
// Permission string required to bypass illegal enchantment group
|
||||
const val unsafeBypassPermission = "ue.unsafe_all"
|
||||
// Item Grouping Configuration file name
|
||||
const val itemGroupingConfigName = "item_groups.yml"
|
||||
|
||||
// Current plugin instance
|
||||
lateinit var instance: UnsafeEnchants
|
||||
// Current item grouping configuration instance
|
||||
lateinit var itemGroups: ItemGroupManager
|
||||
|
||||
/**
|
||||
* Logging handler
|
||||
|
|
@ -31,6 +40,21 @@ class UnsafeEnchants : JavaPlugin() {
|
|||
override fun onEnable() {
|
||||
instance = this
|
||||
saveDefaultConfig()
|
||||
|
||||
// Save default material grouping config
|
||||
saveResource(itemGroupingConfigName,false)
|
||||
// Load material grouping config
|
||||
val itemGroupConfig = YamlConfiguration()
|
||||
val configReader = this.getTextResource(itemGroupingConfigName)
|
||||
if(configReader == null){
|
||||
logger.severe("could no load item grouping configuration")
|
||||
}else{
|
||||
itemGroupConfig.load(configReader)
|
||||
}
|
||||
// Read material groups from config
|
||||
itemGroups = ItemGroupManager()
|
||||
itemGroups.prepareGroups(itemGroupConfig)
|
||||
|
||||
server.pluginManager.registerEvents(
|
||||
AnvilEventListener(),
|
||||
this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue