diff --git a/build.gradle b/build.gradle index e5a1868..7ab4102 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { } group 'me.gabytm.minecraft' -version '2.3.0-SNAPSHOT' +version '2.3.1-SNAPSHOT' subprojects { if (project.name != 'comet') { diff --git a/plugin/build.gradle b/plugin/build.gradle index e37278e..ad2d8bd 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -44,16 +44,17 @@ dependencies { compileOnly('com.github.MilkBowl:VaultAPI:1.7') { transitive false } // NBT - compileOnly 'de.tr7zw:item-nbt-api-plugin:2.11.3' + compileOnly 'de.tr7zw:item-nbt-api-plugin:2.12.1' // Adventure def adventureVersion = '4.14.0' + def adventurePlatformVersion = '4.3.1' implementation "net.kyori:adventure-api:$adventureVersion" - implementation 'net.kyori:adventure-platform-bukkit:4.3.0' + implementation "net.kyori:adventure-platform-bukkit:$adventurePlatformVersion" implementation "net.kyori:adventure-text-minimessage:$adventureVersion" // GUis and commands - implementation 'dev.triumphteam:triumph-gui:3.1.5' + implementation 'dev.triumphteam:triumph-gui:3.1.7' implementation 'me.mattstudios.utils:matt-framework:1.4.6' // Heads diff --git a/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/listeners/VoucherUseListener.kt b/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/listeners/VoucherUseListener.kt index a8f349e..e59832f 100644 --- a/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/listeners/VoucherUseListener.kt +++ b/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/listeners/VoucherUseListener.kt @@ -123,8 +123,8 @@ class VoucherUseListener(private val plugin: ArcaneVouchers) : Listener { return } - val compound = nbt.getCompound(NBT.VOUCHER_COMPOUND) - val voucherId = compound.getString(NBT.VOUCHER_NAME) + val compound = nbt.getCompound(NBT.VOUCHER_COMPOUND) ?: return + val voucherId = compound.getString(NBT.VOUCHER_NAME) ?: return val voucher = voucherManager.getVoucher(voucherId) ?: return // it was probably removed from config val settings = voucher.settings @@ -138,7 +138,7 @@ class VoucherUseListener(private val plugin: ArcaneVouchers) : Listener { this.isCancelled = true - val args = compound.getCompound(NBT.ARGUMENTS_COMPOUND).getArgs() + val args = compound.getCompound(NBT.ARGUMENTS_COMPOUND)?.getArgs() ?: mutableMapOf() val (placeholders, values) = args val audience = audiences.player(this.player) diff --git a/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/voucher/VoucherManager.kt b/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/voucher/VoucherManager.kt index 1ef197e..4fa7563 100644 --- a/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/voucher/VoucherManager.kt +++ b/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/voucher/VoucherManager.kt @@ -62,8 +62,8 @@ class VoucherManager(private val plugin: ArcaneVouchers) { val nbt = NBTItem(voucher.item.clone()) // Set the arguments and player's name inside the item - val compound = nbt.getCompound(NBT.VOUCHER_COMPOUND) - val argumentsCompound = compound.getCompound(NBT.ARGUMENTS_COMPOUND) + val compound = nbt.getOrCreateCompound(NBT.VOUCHER_COMPOUND) + val argumentsCompound = compound.getOrCreateCompound(NBT.ARGUMENTS_COMPOUND) argsMap.entries.forEach { (key, value) -> argumentsCompound.setString(key, value) } compound.setReceiverUUID(player.uniqueId)