mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-21 14:55:17 +01:00
Fixed permissions
This commit is contained in:
parent
0331234676
commit
8ad08aceb2
@ -1,8 +1,13 @@
|
||||
package com.willfp.ecoenchants.enchant.impl
|
||||
|
||||
import com.willfp.eco.core.config.interfaces.Config
|
||||
import com.willfp.eco.core.fast.fast
|
||||
import com.willfp.eco.core.placeholder.PlayerlessPlaceholder
|
||||
import com.willfp.eco.core.placeholder.context.PlaceholderContext
|
||||
import com.willfp.eco.core.placeholder.templates.SimpleInjectablePlaceholder
|
||||
import com.willfp.eco.util.containsIgnoreCase
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin
|
||||
import com.willfp.ecoenchants.display.getFormattedName
|
||||
import com.willfp.ecoenchants.enchant.EcoEnchant
|
||||
import com.willfp.ecoenchants.enchant.EcoEnchantLevel
|
||||
import com.willfp.ecoenchants.rarity.EnchantmentRarities
|
||||
@ -12,8 +17,11 @@ import com.willfp.ecoenchants.type.EnchantmentType
|
||||
import com.willfp.ecoenchants.type.EnchantmentTypes
|
||||
import com.willfp.libreforge.ViolationContext
|
||||
import com.willfp.libreforge.conditions.Conditions
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.NamespacedKey
|
||||
import org.bukkit.enchantments.Enchantment
|
||||
import org.bukkit.permissions.Permission
|
||||
import org.bukkit.permissions.PermissionDefault
|
||||
import org.jetbrains.annotations.ApiStatus.Internal
|
||||
|
||||
abstract class EcoEnchantBase(
|
||||
@ -69,6 +77,39 @@ abstract class EcoEnchantBase(
|
||||
|
||||
override val isObtainableThroughDiscovery = config.getBool("discoverable")
|
||||
|
||||
init {
|
||||
// Placeholders
|
||||
PlayerlessPlaceholder(plugin, "${id}_name") {
|
||||
this.getFormattedName(0, false)
|
||||
}.register()
|
||||
|
||||
// Setup permissions
|
||||
if (Bukkit.getPluginManager().getPermission("ecoenchants.fromtable.$id") == null) {
|
||||
val permission = Permission(
|
||||
"ecoenchants.fromtable.$id",
|
||||
"Allows getting $id from an Enchanting Table",
|
||||
PermissionDefault.TRUE
|
||||
)
|
||||
|
||||
if (Bukkit.getPluginManager().getPermission("ecoenchants.fromtable.*") == null) {
|
||||
Bukkit.getPluginManager().addPermission(
|
||||
Permission(
|
||||
"ecoenchants.fromtable.*",
|
||||
"Allows getting all enchantments from an Enchanting Table",
|
||||
PermissionDefault.TRUE
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
permission.addParent(
|
||||
Bukkit.getPluginManager().getPermission("ecoenchants.fromtable.*")!!,
|
||||
true
|
||||
)
|
||||
|
||||
Bukkit.getPluginManager().addPermission(permission)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the config for this enchant.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user