mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-24 00:26:16 +02:00
renamed the plugin
This commit is contained in:
parent
944e4b025c
commit
c366b45e16
12 changed files with 125 additions and 100 deletions
|
|
@ -1,6 +1,6 @@
|
|||
package io.delilaheve.util
|
||||
|
||||
import io.delilaheve.UnsafeEnchants
|
||||
import io.delilaheve.CustomAnvil
|
||||
import io.delilaheve.util.EnchantmentUtil.enchantmentName
|
||||
import org.bukkit.enchantments.Enchantment
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ object ConfigOptions {
|
|||
*/
|
||||
private val defaultEnchantLimit: Int
|
||||
get() {
|
||||
return UnsafeEnchants.instance
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getInt(DEFAULT_LIMIT_PATH, DEFAULT_ENCHANT_LIMIT)
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ object ConfigOptions {
|
|||
*/
|
||||
val limitRepairCost: Boolean
|
||||
get() {
|
||||
return UnsafeEnchants.instance
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getBoolean(LIMIT_REPAIR_COST, DEFAULT_LIMIT_REPAIR)
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ object ConfigOptions {
|
|||
*/
|
||||
val limitRepairValue: Int
|
||||
get() {
|
||||
return UnsafeEnchants.instance
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getInt(LIMIT_REPAIR_VALUE, DEFAULT_LIMIT_REPAIR_VALUE)
|
||||
.takeIf { it in REPAIR_LIMIT_RANGE }
|
||||
|
|
@ -103,7 +103,7 @@ object ConfigOptions {
|
|||
*/
|
||||
val itemRepairCost: Int
|
||||
get() {
|
||||
return UnsafeEnchants.instance
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getInt(ITEM_REPAIR_COST, DEFAULT_ITEM_REPAIR_COST)
|
||||
.takeIf { it in REPAIR_COST_RANGE }
|
||||
|
|
@ -115,7 +115,7 @@ object ConfigOptions {
|
|||
*/
|
||||
val unitRepairCost: Int
|
||||
get() {
|
||||
return UnsafeEnchants.instance
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getInt(UNIT_REPAIR_COST, DEFAULT_UNIT_REPAIR_COST)
|
||||
.takeIf { it in REPAIR_COST_RANGE }
|
||||
|
|
@ -127,7 +127,7 @@ object ConfigOptions {
|
|||
*/
|
||||
val itemRenameCost: Int
|
||||
get() {
|
||||
return UnsafeEnchants.instance
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getInt(ITEM_RENAME_COST, DEFAULT_ITEM_RENAME_COST)
|
||||
.takeIf { it in ITEM_RENAME_COST_RANGE }
|
||||
|
|
@ -139,7 +139,7 @@ object ConfigOptions {
|
|||
*/
|
||||
val sacrificeIllegalCost: Int
|
||||
get() {
|
||||
return UnsafeEnchants.instance
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getInt(SACRIFICE_ILLEGAL_COST, DEFAULT_SACRIFICE_ILLEGAL_COST)
|
||||
.takeIf { it in SACRIFICE_ILLEGAL_COST_RANGE }
|
||||
|
|
@ -150,7 +150,7 @@ object ConfigOptions {
|
|||
*/
|
||||
val removeRepairLimit: Boolean
|
||||
get() {
|
||||
return UnsafeEnchants.instance
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getBoolean(REMOVE_REPAIR_LIMIT, DEFAULT_REMOVE_LIMIT)
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ object ConfigOptions {
|
|||
*/
|
||||
val debugLog: Boolean
|
||||
get() {
|
||||
return UnsafeEnchants.instance
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getBoolean(DEBUG_LOGGING, DEFAULT_DEBUG_LOG)
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ object ConfigOptions {
|
|||
*/
|
||||
fun enchantLimit(enchantment: Enchantment): Int {
|
||||
val path = "${ENCHANT_LIMIT_ROOT}.${enchantment.enchantmentName}"
|
||||
return UnsafeEnchants.instance
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getInt(path, defaultEnchantLimit)
|
||||
.takeIf { it in ENCHANT_LIMIT_RANGE }
|
||||
|
|
@ -187,7 +187,7 @@ object ConfigOptions {
|
|||
): Int {
|
||||
val typeKey = if (isFromBook) KEY_BOOK else KEY_ITEM
|
||||
val path = "${ENCHANT_VALUES_ROOT}.${enchantment.enchantmentName}.$typeKey"
|
||||
return UnsafeEnchants.instance
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getInt(path, DEFAULT_ENCHANT_VALUE)
|
||||
.takeIf { it >= DEFAULT_ENCHANT_VALUE }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package io.delilaheve.util
|
||||
|
||||
import io.delilaheve.UnsafeEnchants
|
||||
import io.delilaheve.CustomAnvil
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.enchantments.Enchantment
|
||||
import org.bukkit.entity.HumanEntity
|
||||
|
|
@ -33,8 +33,8 @@ object EnchantmentUtil {
|
|||
if (!containsKey(enchantment)) {
|
||||
// Add the enchantment if it doesn't have conflicts, or, if player is allowed to bypass enchantment restrictions
|
||||
this[enchantment] = level
|
||||
if(!player.hasPermission(UnsafeEnchants.bypassFusePermission) &&
|
||||
(UnsafeEnchants.conflictManager.isConflicting(this.keys,mat,enchantment) != ConflictType.NO_CONFLICT)){
|
||||
if(!player.hasPermission(CustomAnvil.bypassFusePermission) &&
|
||||
(CustomAnvil.conflictManager.isConflicting(this.keys,mat,enchantment) != ConflictType.NO_CONFLICT)){
|
||||
this.remove(enchantment)
|
||||
}
|
||||
|
||||
|
|
@ -42,8 +42,8 @@ object EnchantmentUtil {
|
|||
// Enchantment already in result list
|
||||
else{
|
||||
// ... and they are conflicting
|
||||
if((UnsafeEnchants.conflictManager.isConflicting(this.keys,mat,enchantment) != ConflictType.NO_CONFLICT)
|
||||
&& !player.hasPermission(UnsafeEnchants.bypassFusePermission)){
|
||||
if((CustomAnvil.conflictManager.isConflicting(this.keys,mat,enchantment) != ConflictType.NO_CONFLICT)
|
||||
&& !player.hasPermission(CustomAnvil.bypassFusePermission)){
|
||||
return@forEach
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ object EnchantmentUtil {
|
|||
// try to increase the enchantment level by 1
|
||||
var newLevel = this[enchantment]!! +1
|
||||
// Get max level or 255 if player can bypass
|
||||
val maxLevel = if(player.hasPermission(UnsafeEnchants.bypassLevelPermission)){
|
||||
val maxLevel = if(player.hasPermission(CustomAnvil.bypassLevelPermission)){
|
||||
255
|
||||
}else{
|
||||
ConfigOptions.enchantLimit(enchantment)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package io.delilaheve.util
|
||||
|
||||
import io.delilaheve.UnsafeEnchants
|
||||
import io.delilaheve.CustomAnvil
|
||||
import org.bukkit.Material.ENCHANTED_BOOK
|
||||
import org.bukkit.enchantments.Enchantment
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
|
@ -59,7 +59,7 @@ object ItemUtil {
|
|||
}
|
||||
enchantments.forEach { (enchant, level) ->
|
||||
val added = addStoredEnchant(enchant, level, true)
|
||||
UnsafeEnchants.log("${enchant.key} added to item? $added")
|
||||
CustomAnvil.log("${enchant.key} added to item? $added")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue