Skip to content

Commit

Permalink
[6.0.11][publish] Experimental > fix sign & fix connection getter
Browse files Browse the repository at this point in the history
  • Loading branch information
Bkm016 committed Jun 24, 2023
1 parent 65d1649 commit 8d6e508
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ fun Player.inputSign(lines: Array<String> = arrayOf(), function: (lines: Array<S
} catch (t: NoSuchMethodError) {
sendBlockChange(location, XMaterial.OAK_WALL_SIGN.parseMaterial()!!, 0.toByte())
}
sendSignChange(location, lines.format())
try {
sendSignChange(location, lines.format(4))
} catch (ex: Throwable) {
sendSignChange(location, lines.format(3))
}
SignsListener.inputs[name] = function
nmsGeneric.openSignEditor(this, location.block)
}

private fun Array<String>.format(): Array<String> {
private fun Array<String>.format(line: Int): Array<String> {
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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8d6e508

Please sign in to comment.