mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Fix Custom Recipe not being registered.
Fix conflict from api not working. Add remove api for custom recipe, material group and conflict.
This commit is contained in:
parent
a40d2c6530
commit
6f1e53f68e
8 changed files with 93 additions and 10 deletions
|
|
@ -5,7 +5,7 @@ import org.bukkit.Material
|
|||
import xyz.alexcrea.cuanvil.enchant.CAEnchantment
|
||||
|
||||
class EnchantConflictGroup(
|
||||
private val name: String,
|
||||
val name: String,
|
||||
private val cantConflict: AbstractMaterialGroup,
|
||||
var minBeforeBlock: Int
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -52,12 +52,21 @@ class EnchantConflictManager {
|
|||
val section = config.getConfigurationSection(key)!!
|
||||
val conflict = createConflict(section, itemManager, key)
|
||||
|
||||
addConflictToEnchantments(conflict)
|
||||
conflictList.add(conflict)
|
||||
addConflict(conflict)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun addConflict(conflict: EnchantConflictGroup){
|
||||
addConflictToEnchantments(conflict)
|
||||
conflictList.add(conflict)
|
||||
}
|
||||
|
||||
fun removeConflict(conflict: EnchantConflictGroup){
|
||||
removeConflictFromEnchantments(conflict)
|
||||
conflictList.remove(conflict)
|
||||
}
|
||||
|
||||
// Add the conflict to enchantments
|
||||
private fun addConflictToEnchantments(conflict: EnchantConflictGroup) {
|
||||
conflict.getEnchants().forEach { enchant ->
|
||||
|
|
@ -65,6 +74,13 @@ class EnchantConflictManager {
|
|||
}
|
||||
}
|
||||
|
||||
// Remove the conflict from enchantments
|
||||
private fun removeConflictFromEnchantments(conflict: EnchantConflictGroup) {
|
||||
conflict.getEnchants().forEach { enchant ->
|
||||
enchant.removeConflict(conflict)
|
||||
}
|
||||
}
|
||||
|
||||
// create and read a conflict from a yaml section
|
||||
private fun createConflict(
|
||||
section: ConfigurationSection,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder
|
|||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant
|
||||
|
||||
class AnvilCustomRecipe(
|
||||
private val name: String,
|
||||
val name: String,
|
||||
var exactCount: Boolean,
|
||||
//var exactLeft: Boolean,
|
||||
//var exactRight: Boolean,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue