Skip to content

Commit 8d6e508

Browse files
committed
[6.0.11][publish] Experimental > fix sign & fix connection getter
1 parent 65d1649 commit 8d6e508

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

module/module-nms-util/src/main/kotlin/taboolib/module/nms/NMSSigns.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,21 @@ fun Player.inputSign(lines: Array<String> = arrayOf(), function: (lines: Array<S
2323
} catch (t: NoSuchMethodError) {
2424
sendBlockChange(location, XMaterial.OAK_WALL_SIGN.parseMaterial()!!, 0.toByte())
2525
}
26-
sendSignChange(location, lines.format())
26+
try {
27+
sendSignChange(location, lines.format(4))
28+
} catch (ex: Throwable) {
29+
sendSignChange(location, lines.format(3))
30+
}
2731
SignsListener.inputs[name] = function
2832
nmsGeneric.openSignEditor(this, location.block)
2933
}
3034

31-
private fun Array<String>.format(): Array<String> {
35+
private fun Array<String>.format(line: Int): Array<String> {
3236
val list = toMutableList()
33-
while (list.size < 4) {
37+
while (list.size < line) {
3438
list.add("")
3539
}
36-
while (list.size > 4) {
40+
while (list.size > line) {
3741
list.removeLast()
3842
}
3943
return list.toTypedArray()

module/module-nms/src/main/kotlin/taboolib/module/nms/ChannelExecutor.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import taboolib.common.TabooLibCommon
99
import taboolib.common.platform.Awake
1010
import taboolib.common.platform.Platform
1111
import taboolib.common.platform.PlatformSide
12+
import taboolib.common.platform.event.EventPriority
1213
import taboolib.common.platform.event.SubscribeEvent
1314
import taboolib.common.platform.function.info
1415
import taboolib.common.platform.function.isListened
@@ -96,9 +97,11 @@ object ChannelExecutor {
9697
}
9798
}
9899

99-
@SubscribeEvent
100+
@SubscribeEvent(EventPriority.MONITOR)
100101
private fun onJoin(e: PlayerLoginEvent) {
101-
addPlayerChannel(e.player, e.address)
102+
if (e.result == PlayerLoginEvent.Result.ALLOWED) {
103+
addPlayerChannel(e.player, e.address)
104+
}
102105
}
103106

104107
@SubscribeEvent

module/module-nms/src/main/kotlin/taboolib/module/nms/PacketSender.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import org.bukkit.event.player.PlayerQuitEvent
66
import org.tabooproject.reflex.ClassMethod
77
import org.tabooproject.reflex.Reflex.Companion.getProperty
88
import org.tabooproject.reflex.ReflexClass
9+
import taboolib.common.platform.Platform
10+
import taboolib.common.platform.PlatformSide
911
import taboolib.common.platform.event.SubscribeEvent
1012
import taboolib.common.platform.function.submit
1113
import java.util.concurrent.ConcurrentHashMap

module/module-ui/src/main/kotlin/taboolib/module/ui/virtual/InventoryHandler.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import org.bukkit.inventory.ItemStack
77
import taboolib.common.LifeCycle
88
import taboolib.common.platform.Awake
99
import taboolib.common.platform.Ghost
10+
import taboolib.common.platform.Platform
11+
import taboolib.common.platform.PlatformSide
1012
import taboolib.common.platform.event.SubscribeEvent
1113
import taboolib.common.util.unsafeLazy
1214
import taboolib.module.nms.MinecraftVersion

0 commit comments

Comments
 (0)