mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 10:25:06 -04:00
21w19a+: Respond to ping packets, fix eventually task abortion in ThreadPool
This commit is contained in:
parent
08951f7b1c
commit
142d55b7fd
@ -191,7 +191,7 @@ class LeftClickHandler(
|
|||||||
speedMultiplier *= 0.3f.pow(it.amplifier + 1)
|
speedMultiplier *= 0.3f.pow(it.amplifier + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDp: Check if is in water
|
// ToDo: Check if is in water
|
||||||
|
|
||||||
if (!connection.player.entity.onGround) {
|
if (!connection.player.entity.onGround) {
|
||||||
speedMultiplier /= 5.0f
|
speedMultiplier /= 5.0f
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.protocol.packets.s2c.play
|
package de.bixilon.minosoft.protocol.packets.s2c.play
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
|
||||||
|
import de.bixilon.minosoft.protocol.packets.c2s.play.PongC2SP
|
||||||
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
|
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
|
||||||
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer
|
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer
|
||||||
import de.bixilon.minosoft.util.logging.Log
|
import de.bixilon.minosoft.util.logging.Log
|
||||||
@ -22,6 +24,11 @@ import de.bixilon.minosoft.util.logging.LogMessageType
|
|||||||
class PingS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
|
class PingS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
|
||||||
val id = buffer.readInt()
|
val id = buffer.readInt()
|
||||||
|
|
||||||
|
|
||||||
|
override fun handle(connection: PlayConnection) {
|
||||||
|
connection.sendPacket(PongC2SP(id))
|
||||||
|
}
|
||||||
|
|
||||||
override fun log() {
|
override fun log() {
|
||||||
Log.log(LogMessageType.NETWORK_PACKETS_IN, LogLevels.VERBOSE) { "Ping (id=$id)" }
|
Log.log(LogMessageType.NETWORK_PACKETS_IN, LogLevels.VERBOSE) { "Ping (id=$id)" }
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,10 @@ class ThreadPool(
|
|||||||
try {
|
try {
|
||||||
availableThreads += Thread.currentThread()
|
availableThreads += Thread.currentThread()
|
||||||
Thread.sleep(Long.MAX_VALUE)
|
Thread.sleep(Long.MAX_VALUE)
|
||||||
availableThreads -= Thread.currentThread()
|
|
||||||
} catch (exception: InterruptedException) {
|
} catch (exception: InterruptedException) {
|
||||||
// Log.log(LogMessageType.OTHER, LogLevels.VERBOSE) { "Thread (${Thread.currentThread()} sleeping got interrupted" }
|
// Log.log(LogMessageType.OTHER, LogLevels.VERBOSE) { "Thread (${Thread.currentThread()} sleeping got interrupted" }
|
||||||
}
|
}
|
||||||
|
availableThreads -= Thread.currentThread()
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i in 0 until threadCount - threads.size) {
|
for (i in 0 until threadCount - threads.size) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user