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
|
|
@ -4,7 +4,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "xyz.alexcrea"
|
group = "xyz.alexcrea"
|
||||||
version = "1.4.1a"
|
version = "1.4.2a"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import io.delilaheve.util.ItemUtil.isEnchantedBook
|
||||||
import io.delilaheve.util.ItemUtil.repairFrom
|
import io.delilaheve.util.ItemUtil.repairFrom
|
||||||
import io.delilaheve.util.ItemUtil.setEnchantmentsUnsafe
|
import io.delilaheve.util.ItemUtil.setEnchantmentsUnsafe
|
||||||
import io.delilaheve.util.ItemUtil.unitRepair
|
import io.delilaheve.util.ItemUtil.unitRepair
|
||||||
|
import org.bukkit.ChatColor
|
||||||
import org.bukkit.GameMode
|
import org.bukkit.GameMode
|
||||||
import org.bukkit.Material
|
import org.bukkit.Material
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
|
|
@ -161,7 +162,9 @@ class AnvilEventListener : Listener {
|
||||||
private fun handleRename(resultItem: ItemStack, inventory: AnvilInventory): Int {
|
private fun handleRename(resultItem: ItemStack, inventory: AnvilInventory): Int {
|
||||||
// Rename item and add renaming cost
|
// Rename item and add renaming cost
|
||||||
resultItem.itemMeta?.let {
|
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)
|
it.setDisplayName(inventory.renameText)
|
||||||
resultItem.itemMeta = it
|
resultItem.itemMeta = it
|
||||||
return ConfigOptions.itemRenameCost
|
return ConfigOptions.itemRenameCost
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
main: io.delilaheve.CustomAnvil
|
main: io.delilaheve.CustomAnvil
|
||||||
name: CustomAnvil
|
name: CustomAnvil
|
||||||
prefix: "Custom Anvil"
|
prefix: "Custom Anvil"
|
||||||
version: 1.4.1a
|
version: 1.4.2a
|
||||||
description: Allow to customise anvil mechanics
|
description: Allow to customise anvil mechanics
|
||||||
api-version: 1.18
|
api-version: 1.18
|
||||||
load: POSTWORLD
|
load: POSTWORLD
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue