Add sendNow methods
This commit is contained in:
parent
85ca7d8a24
commit
c4e7b8ff15
@ -58,6 +58,12 @@ abstract class MatteryNetworkChannel(val version: String, val name: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun sendNow(ply: Player, packet: Any) {
|
||||||
|
if (ply is ServerPlayer) {
|
||||||
|
channel.send(PacketDistributor.PLAYER.with { ply }, packet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun sendTracking(entity: Entity, packet: Any) {
|
fun sendTracking(entity: Entity, packet: Any) {
|
||||||
if ((NULLABLE_MINECRAFT_SERVER?.playerCount ?: 0) <= 0) {
|
if ((NULLABLE_MINECRAFT_SERVER?.playerCount ?: 0) <= 0) {
|
||||||
return
|
return
|
||||||
@ -78,6 +84,10 @@ abstract class MatteryNetworkChannel(val version: String, val name: String) {
|
|||||||
queue.add(Task(channel, distributor, packet))
|
queue.add(Task(channel, distributor, packet))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun sendNow(distributor: PacketDistributor.PacketTarget, packet: Any) {
|
||||||
|
channel.send(distributor, packet)
|
||||||
|
}
|
||||||
|
|
||||||
private var nextNetworkPacketID = 0
|
private var nextNetworkPacketID = 0
|
||||||
|
|
||||||
fun <T> add(
|
fun <T> add(
|
||||||
|
Loading…
Reference in New Issue
Block a user