mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
change permission and update gitignore
This commit is contained in:
parent
60dd28024e
commit
181dbbb1e4
4 changed files with 10 additions and 16 deletions
|
|
@ -20,7 +20,6 @@ import org.bukkit.event.inventory.PrepareAnvilEvent
|
|||
import org.bukkit.inventory.AnvilInventory
|
||||
import org.bukkit.inventory.InventoryView.Property.REPAIR_COST
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.permissions.Permission
|
||||
import kotlin.math.min
|
||||
|
||||
/**
|
||||
|
|
@ -33,13 +32,6 @@ class AnvilEventListener : Listener {
|
|||
private const val ANVIL_OUTPUT_SLOT = 2
|
||||
}
|
||||
|
||||
// Permission node required for the plugin to take over enchantment combination
|
||||
private val requirePermission: Permission
|
||||
get() = Permission(UnsafeEnchants.unsafePermission)
|
||||
// Permission node to bypass illegal group check
|
||||
private val bypassPermission: Permission
|
||||
get() = Permission(UnsafeEnchants.unsafeBypassPermission)
|
||||
|
||||
/**
|
||||
* Event handler logic for when an anvil contains items to be combined
|
||||
*/
|
||||
|
|
@ -116,13 +108,13 @@ class AnvilEventListener : Listener {
|
|||
|
||||
|
||||
private fun itemAllowed(item: ItemStack, player: HumanEntity): Boolean{
|
||||
if(!player.hasPermission(bypassPermission)){
|
||||
if(player.hasPermission(requirePermission)){
|
||||
if(UnsafeEnchants.conflictManager.isConflicting(item))
|
||||
return false
|
||||
if(player.hasPermission(UnsafeEnchants.unsafeBypassPermission)) return true
|
||||
|
||||
} else if(item.findEnchantments().hasConflicts())
|
||||
if(player.hasPermission(UnsafeEnchants.unsafePermission)){
|
||||
if(UnsafeEnchants.conflictManager.isConflicting(item))
|
||||
return false
|
||||
}else if (item.findEnchantments().hasConflicts()){
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ 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"
|
||||
// Permission string required to bypass enchantment conflicts test
|
||||
const val unsafeBypassPermission = "ue.bypass.fuse"
|
||||
// Item Grouping Configuration file name
|
||||
const val itemGroupingConfigName = "item_groups.yml"
|
||||
// Conflict Configuration file name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue