mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Avoid overriding left item name on custom name. fix #8
Also version up for convenience.
This commit is contained in:
parent
76fc354127
commit
2861238f58
3 changed files with 6 additions and 3 deletions
|
|
@ -9,6 +9,7 @@ import io.delilaheve.util.ItemUtil.isEnchantedBook
|
|||
import io.delilaheve.util.ItemUtil.repairFrom
|
||||
import io.delilaheve.util.ItemUtil.setEnchantmentsUnsafe
|
||||
import io.delilaheve.util.ItemUtil.unitRepair
|
||||
import org.bukkit.ChatColor
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.entity.Player
|
||||
|
|
@ -161,7 +162,9 @@ class AnvilEventListener : Listener {
|
|||
private fun handleRename(resultItem: ItemStack, inventory: AnvilInventory): Int {
|
||||
// Rename item and add renaming cost
|
||||
resultItem.itemMeta?.let {
|
||||
if (!it.displayName.contentEquals(inventory.renameText)) {
|
||||
val displayName = ChatColor.stripColor(it.displayName)
|
||||
val inventoryName = ChatColor.stripColor(inventory.renameText)
|
||||
if (!displayName.contentEquals(inventoryName)) {
|
||||
it.setDisplayName(inventory.renameText)
|
||||
resultItem.itemMeta = it
|
||||
return ConfigOptions.itemRenameCost
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
main: io.delilaheve.CustomAnvil
|
||||
name: CustomAnvil
|
||||
prefix: "Custom Anvil"
|
||||
version: 1.4.1a
|
||||
version: 1.4.2a
|
||||
description: Allow to customise anvil mechanics
|
||||
api-version: 1.18
|
||||
load: POSTWORLD
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue