From 4662561ab9729d914ec55adbbd59d1f0f0eed4b4 Mon Sep 17 00:00:00 2001 From: TomTom <93038247+AverageGithub@users.noreply.github.com> Date: Fri, 28 Jun 2024 09:22:50 +0200 Subject: [PATCH] Fixes to linking --- .../artillexstudios/axminions/listeners/LinkingListener.kt | 6 ++++++ .../kotlin/com/artillexstudios/axminions/minions/Minion.kt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/com/artillexstudios/axminions/listeners/LinkingListener.kt b/common/src/main/kotlin/com/artillexstudios/axminions/listeners/LinkingListener.kt index bba31a3..f32edd9 100644 --- a/common/src/main/kotlin/com/artillexstudios/axminions/listeners/LinkingListener.kt +++ b/common/src/main/kotlin/com/artillexstudios/axminions/listeners/LinkingListener.kt @@ -15,6 +15,7 @@ import org.bukkit.entity.Player import org.bukkit.event.EventHandler import org.bukkit.event.Listener import org.bukkit.event.player.PlayerInteractEvent +import kotlin.math.min class LinkingListener : Listener { companion object { @@ -50,6 +51,11 @@ class LinkingListener : Listener { return } + val min = minion as com.artillexstudios.axminions.minions.Minion + if (min.broken.get()) { + return + } + event.player.sendMessage(StringUtils.formatToString(Messages.PREFIX() + Messages.LINK_SUCCESS())) minion.setLinkedChest(event.clickedBlock!!.location) } diff --git a/common/src/main/kotlin/com/artillexstudios/axminions/minions/Minion.kt b/common/src/main/kotlin/com/artillexstudios/axminions/minions/Minion.kt index 8c3b7f4..5b0d9ae 100644 --- a/common/src/main/kotlin/com/artillexstudios/axminions/minions/Minion.kt +++ b/common/src/main/kotlin/com/artillexstudios/axminions/minions/Minion.kt @@ -92,7 +92,7 @@ class Minion( @Volatile private var ticking = false private var debugHologram: Hologram? = null - private val broken = AtomicBoolean(false) + val broken = AtomicBoolean(false) private var ownerOnline = false init {