From 8d6e508ebdcf500498ae7507a13dac160b64067c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=8F=E9=BB=91?= Date: Sat, 24 Jun 2023 11:38:28 +0800 Subject: [PATCH] [6.0.11][publish] Experimental > fix sign & fix connection getter --- .../src/main/kotlin/taboolib/module/nms/NMSSigns.kt | 12 ++++++++---- .../kotlin/taboolib/module/nms/ChannelExecutor.kt | 7 +++++-- .../main/kotlin/taboolib/module/nms/PacketSender.kt | 2 ++ .../taboolib/module/ui/virtual/InventoryHandler.kt | 2 ++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/module/module-nms-util/src/main/kotlin/taboolib/module/nms/NMSSigns.kt b/module/module-nms-util/src/main/kotlin/taboolib/module/nms/NMSSigns.kt index 3adad98cc..531b0cf44 100644 --- a/module/module-nms-util/src/main/kotlin/taboolib/module/nms/NMSSigns.kt +++ b/module/module-nms-util/src/main/kotlin/taboolib/module/nms/NMSSigns.kt @@ -23,17 +23,21 @@ fun Player.inputSign(lines: Array = arrayOf(), function: (lines: Array.format(): Array { +private fun Array.format(line: Int): Array { val list = toMutableList() - while (list.size < 4) { + while (list.size < line) { list.add("") } - while (list.size > 4) { + while (list.size > line) { list.removeLast() } return list.toTypedArray() diff --git a/module/module-nms/src/main/kotlin/taboolib/module/nms/ChannelExecutor.kt b/module/module-nms/src/main/kotlin/taboolib/module/nms/ChannelExecutor.kt index a7adebe0b..23f14c3b8 100755 --- a/module/module-nms/src/main/kotlin/taboolib/module/nms/ChannelExecutor.kt +++ b/module/module-nms/src/main/kotlin/taboolib/module/nms/ChannelExecutor.kt @@ -9,6 +9,7 @@ import taboolib.common.TabooLibCommon import taboolib.common.platform.Awake import taboolib.common.platform.Platform import taboolib.common.platform.PlatformSide +import taboolib.common.platform.event.EventPriority import taboolib.common.platform.event.SubscribeEvent import taboolib.common.platform.function.info import taboolib.common.platform.function.isListened @@ -96,9 +97,11 @@ object ChannelExecutor { } } - @SubscribeEvent + @SubscribeEvent(EventPriority.MONITOR) private fun onJoin(e: PlayerLoginEvent) { - addPlayerChannel(e.player, e.address) + if (e.result == PlayerLoginEvent.Result.ALLOWED) { + addPlayerChannel(e.player, e.address) + } } @SubscribeEvent diff --git a/module/module-nms/src/main/kotlin/taboolib/module/nms/PacketSender.kt b/module/module-nms/src/main/kotlin/taboolib/module/nms/PacketSender.kt index a5ade6fcb..6abdaa4c6 100644 --- a/module/module-nms/src/main/kotlin/taboolib/module/nms/PacketSender.kt +++ b/module/module-nms/src/main/kotlin/taboolib/module/nms/PacketSender.kt @@ -6,6 +6,8 @@ import org.bukkit.event.player.PlayerQuitEvent import org.tabooproject.reflex.ClassMethod import org.tabooproject.reflex.Reflex.Companion.getProperty import org.tabooproject.reflex.ReflexClass +import taboolib.common.platform.Platform +import taboolib.common.platform.PlatformSide import taboolib.common.platform.event.SubscribeEvent import taboolib.common.platform.function.submit import java.util.concurrent.ConcurrentHashMap diff --git a/module/module-ui/src/main/kotlin/taboolib/module/ui/virtual/InventoryHandler.kt b/module/module-ui/src/main/kotlin/taboolib/module/ui/virtual/InventoryHandler.kt index 0cfb5a21d..ee4d67c9e 100644 --- a/module/module-ui/src/main/kotlin/taboolib/module/ui/virtual/InventoryHandler.kt +++ b/module/module-ui/src/main/kotlin/taboolib/module/ui/virtual/InventoryHandler.kt @@ -7,6 +7,8 @@ import org.bukkit.inventory.ItemStack import taboolib.common.LifeCycle import taboolib.common.platform.Awake import taboolib.common.platform.Ghost +import taboolib.common.platform.Platform +import taboolib.common.platform.PlatformSide import taboolib.common.platform.event.SubscribeEvent import taboolib.common.util.unsafeLazy import taboolib.module.nms.MinecraftVersion