Skip to content

Commit a70de28

Browse files
committed
[6.0.11][publish] Experimental > fix packet error
1 parent 1c36008 commit a70de28

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import taboolib.common.platform.Awake
1010
import taboolib.common.platform.Platform
1111
import taboolib.common.platform.PlatformSide
1212
import taboolib.common.platform.event.SubscribeEvent
13+
import taboolib.common.platform.function.info
1314
import taboolib.common.platform.function.isListened
1415
import taboolib.common.platform.function.pluginId
1516
import taboolib.common.platform.function.warning
@@ -108,9 +109,19 @@ object ChannelExecutor {
108109
ConnectionGetter.instance.release(e.player.address ?: return)
109110
}
110111

111-
@Awake(LifeCycle.ENABLE)
112+
@Awake(LifeCycle.ACTIVE)
112113
private fun onEnable() {
113-
onlinePlayers.forEach { addPlayerChannel(it, it.address?.address ?: return@forEach) }
114+
if (TabooLibCommon.isStopped()) {
115+
return
116+
}
117+
onlinePlayers.forEach {
118+
val address = it.address?.address
119+
if (address == null) {
120+
warning("Cannot get player address: ${it.name} (${it.address})")
121+
return@forEach
122+
}
123+
addPlayerChannel(it, address)
124+
}
114125
}
115126

116127
@Awake(LifeCycle.DISABLE)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class ConnectionGetterImpl : ConnectionGetter() {
101101
}
102102
used
103103
}
104-
dev("Player connection ($address) -> ${connection.address()} (init=$init)")
104+
dev("Player connection ($address) -> ${connection.address()} (${if (init) "init" else "get"})")
105105
return connection
106106
}
107107

0 commit comments

Comments
 (0)