From 7e8ee86c13f405e7dc806099d0b3963e3d9fcc94 Mon Sep 17 00:00:00 2001 From: Boy Date: Sun, 22 Sep 2024 14:12:50 +0200 Subject: [PATCH] fix: blocklocker causing issues when not on server --- gradle.properties | 2 +- .../deeperworld/synchronization/ContainerSyncListener.kt | 2 +- .../deeperworld/synchronization/SectionSyncListener.kt | 2 +- .../mineinabyss/deeperworld/synchronization/Updaters.kt | 3 ++- src/main/resources/paper-plugin.yml | 8 -------- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/gradle.properties b/gradle.properties index e253746..c70906a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ group=com.mineinabyss version=0.11 -idofrontVersion=0.24.12 +idofrontVersion=0.25.6 diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/synchronization/ContainerSyncListener.kt b/src/main/kotlin/com/mineinabyss/deeperworld/synchronization/ContainerSyncListener.kt index 45b2eef..9bac9d4 100644 --- a/src/main/kotlin/com/mineinabyss/deeperworld/synchronization/ContainerSyncListener.kt +++ b/src/main/kotlin/com/mineinabyss/deeperworld/synchronization/ContainerSyncListener.kt @@ -26,7 +26,7 @@ import org.bukkit.inventory.ItemStack private fun updateProtection(block: Block) = - blockLocker.protectionFinder.findProtection(block, SearchMode.ALL).ifPresent { + blockLocker?.protectionFinder?.findProtection(block, SearchMode.ALL)?.ifPresent { it.signs.forEach { sign -> sign.location.sync(signUpdater()) } } diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/synchronization/SectionSyncListener.kt b/src/main/kotlin/com/mineinabyss/deeperworld/synchronization/SectionSyncListener.kt index ec129e9..116c88b 100644 --- a/src/main/kotlin/com/mineinabyss/deeperworld/synchronization/SectionSyncListener.kt +++ b/src/main/kotlin/com/mineinabyss/deeperworld/synchronization/SectionSyncListener.kt @@ -38,7 +38,7 @@ import org.bukkit.event.world.StructureGrowEvent import org.bukkit.inventory.EquipmentSlot private fun syncBlockLocker(corr: Block) { - blockLocker.protectionFinder.findProtection(corr, SearchMode.ALL).ifPresent { + blockLocker?.protectionFinder?.findProtection(corr, SearchMode.ALL)?.ifPresent { it.signs.forEach { linkedSign -> linkedSign.location.block.type = Material.AIR } } } diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/synchronization/Updaters.kt b/src/main/kotlin/com/mineinabyss/deeperworld/synchronization/Updaters.kt index 5d81975..0213b02 100644 --- a/src/main/kotlin/com/mineinabyss/deeperworld/synchronization/Updaters.kt +++ b/src/main/kotlin/com/mineinabyss/deeperworld/synchronization/Updaters.kt @@ -4,6 +4,7 @@ import com.mineinabyss.deeperworld.world.section.* import net.kyori.adventure.text.Component import nl.rutgerkok.blocklocker.BlockLockerAPIv2 import nl.rutgerkok.blocklocker.BlockLockerPlugin +import org.bukkit.Bukkit import org.bukkit.Location import org.bukkit.Material import org.bukkit.block.Block @@ -13,7 +14,7 @@ import org.bukkit.block.sign.Side import org.bukkit.inventory.ItemStack import org.bukkit.util.Vector -internal val blockLocker: BlockLockerPlugin by lazy { BlockLockerAPIv2.getPlugin() } +internal val blockLocker: BlockLockerPlugin? by lazy { Bukkit.getPluginManager().getPlugin("BlockLocker") as? BlockLockerPlugin } internal fun copyBlockData(original: Block, corresponding: Block) { corresponding.blockData = original.blockData.clone() diff --git a/src/main/resources/paper-plugin.yml b/src/main/resources/paper-plugin.yml index 7c3043c..b14071f 100644 --- a/src/main/resources/paper-plugin.yml +++ b/src/main/resources/paper-plugin.yml @@ -26,15 +26,7 @@ dependencies: required: false load: BEFORE join-classpath: true - ProtocolLib: - required: false - load: BEFORE - join-classpath: true FastAsyncWorldEdit: required: false load: BEFORE join-classpath: true - Multiverse-Core: - required: false - load: BEFORE - join-classpath: false