change some packet names, fix some log levels

This commit is contained in:
Bixilon 2021-05-15 00:23:41 +02:00
parent 29c15ad38a
commit 69bb98d3ff
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
10 changed files with 32 additions and 21 deletions

View File

@ -26,12 +26,11 @@ class LoginKickS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
override fun handle(connection: PlayConnection) {
connection.fireEvent(LoginDisconnectEvent(connection, this))
Log.log(LogMessageType.NETWORK_PACKETS_IN, level = LogLevels.VERBOSE) { "Kicked from: $reason" }
Log.log(LogMessageType.NETWORK_STATUS, level = LogLevels.WARN) { "Kicked from: $reason" }
connection.disconnect()
}
override fun log() {
Log.log(LogMessageType.NETWORK_PACKETS_IN, level = LogLevels.VERBOSE) { "Login kick (reason=$reason)" }
}
}

View File

@ -16,12 +16,14 @@ package de.bixilon.minosoft.protocol.packets.s2c.play.border
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
class SetCenterWorldBorderS2CPacket(buffer: PlayInByteBuffer) : PlayS2CPacket() {
class CenterSetWorldBorderS2CPacket(buffer: PlayInByteBuffer) : PlayS2CPacket() {
val x = buffer.readDouble()
val z = buffer.readDouble()
override fun log() {
Log.protocol("[IN] Receiving set center world border packet (x=$x, z=$z")
Log.log(LogMessageType.NETWORK_PACKETS_IN, level = LogLevels.VERBOSE) { "Center set world border (x=$x, z=$z)" }
}
}

View File

@ -16,6 +16,8 @@ package de.bixilon.minosoft.protocol.packets.s2c.play.border
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
class InitializeWorldBorderS2CPacket(buffer: PlayInByteBuffer) : PlayS2CPacket() {
val x = buffer.readDouble()
@ -28,6 +30,6 @@ class InitializeWorldBorderS2CPacket(buffer: PlayInByteBuffer) : PlayS2CPacket()
val warningBlocks = buffer.readVarInt()
override fun log() {
Log.protocol("[IN] Receiving initialize world border packet (x=$x, z=$z, oldRadius=$oldRadius, newRadius=$newRadius, speed=$speed, portalBound=$portalBound, warningTime=$warningTime, warningBlocks=$warningBlocks)")
Log.log(LogMessageType.NETWORK_PACKETS_IN, level = LogLevels.VERBOSE) { "Initialize world border (x=$x, z=$z, oldRadius=$oldRadius, newRadius=$newRadius, speed=$speed, portalBound=$portalBound, warningTime=$warningTime, warningBlocks=$warningBlocks)" }
}
}

View File

@ -16,6 +16,8 @@ package de.bixilon.minosoft.protocol.packets.s2c.play.border
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
class LerpSizeWorldBorderS2CPacket(buffer: PlayInByteBuffer) : PlayS2CPacket() {
val oldRadius = buffer.readDouble()
@ -23,6 +25,6 @@ class LerpSizeWorldBorderS2CPacket(buffer: PlayInByteBuffer) : PlayS2CPacket() {
val speed = buffer.readVarLong()
override fun log() {
Log.protocol("[IN] Receiving lerp size world border packet (oldRadius=$oldRadius, newRadius=$newRadius,speed=$speed)")
Log.log(LogMessageType.NETWORK_PACKETS_IN, level = LogLevels.VERBOSE) { "Lerp size world border (oldRadius=$oldRadius, newRadius=$newRadius, speed=$speed)" }
}
}

View File

@ -16,11 +16,13 @@ package de.bixilon.minosoft.protocol.packets.s2c.play.border
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
class SetSizeWorldBorderS2CPacket(buffer: PlayInByteBuffer) : PlayS2CPacket() {
class SizeSetWorldBorderS2CPacket(buffer: PlayInByteBuffer) : PlayS2CPacket() {
val radius = buffer.readDouble()
override fun log() {
Log.protocol("[IN] Receiving set size world border packet (radius=$radius)")
Log.log(LogMessageType.NETWORK_PACKETS_IN, level = LogLevels.VERBOSE) { "Size set world border (radius=$radius)" }
}
}

View File

@ -16,11 +16,13 @@ package de.bixilon.minosoft.protocol.packets.s2c.play.border
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
class SetWarningBlocksWorldBorderS2CPacket(buffer: PlayInByteBuffer) : PlayS2CPacket() {
class WarningBlocksSetWorldBorderS2CPacket(buffer: PlayInByteBuffer) : PlayS2CPacket() {
val warningBlocks = buffer.readVarInt()
override fun log() {
Log.protocol("[IN] Receiving warning blocks world border packet (warningBlocks=$warningBlocks)")
Log.log(LogMessageType.NETWORK_PACKETS_IN, level = LogLevels.VERBOSE) { "Warning blocks set world border (warningBlocks=$warningBlocks)" }
}
}

View File

@ -16,11 +16,13 @@ package de.bixilon.minosoft.protocol.packets.s2c.play.border
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
class SetWarningTimeWorldBorderS2CPacket(buffer: PlayInByteBuffer) : PlayS2CPacket() {
class WarningTimeSetWorldBorderS2CPacket(buffer: PlayInByteBuffer) : PlayS2CPacket() {
val warningTime = buffer.readVarInt()
override fun log() {
Log.protocol("[IN] Receiving warning time world border packet (warningTime=$warningTime)")
Log.log(LogMessageType.NETWORK_PACKETS_IN, level = LogLevels.VERBOSE) { "Warning time set world border (warningTime=$warningTime)" }
}
}

View File

@ -24,12 +24,12 @@ object WorldBorderS2CF {
// and that means A LOT!
fun createPacket(buffer: PlayInByteBuffer): PlayS2CPacket {
return when (WorldBorderActions[buffer.readVarInt()]) {
WorldBorderActions.SET_SIZE -> SetSizeWorldBorderS2CPacket(buffer)
WorldBorderActions.SET_SIZE -> SizeSetWorldBorderS2CPacket(buffer)
WorldBorderActions.LERP_SIZE -> LerpSizeWorldBorderS2CPacket(buffer)
WorldBorderActions.SET_CENTER -> SetCenterWorldBorderS2CPacket(buffer)
WorldBorderActions.SET_CENTER -> CenterSetWorldBorderS2CPacket(buffer)
WorldBorderActions.INITIALIZE -> InitializeWorldBorderS2CPacket(buffer)
WorldBorderActions.SET_WARNING_TIME -> SetWarningTimeWorldBorderS2CPacket(buffer)
WorldBorderActions.SET_WARNING_BLOCKS -> SetWarningBlocksWorldBorderS2CPacket(buffer)
WorldBorderActions.SET_WARNING_TIME -> WarningTimeSetWorldBorderS2CPacket(buffer)
WorldBorderActions.SET_WARNING_BLOCKS -> WarningBlocksSetWorldBorderS2CPacket(buffer)
}
}

View File

@ -222,11 +222,11 @@ class PacketTypes {
PLAY_SELECT_ADVANCEMENT_TAB({ PacketSelectAdvancementTab(it) }),
PLAY_WORLD_BORDER({ WorldBorderS2CF.createPacket(it) }),
PLAY_WORLD_BORDER_INITIALIZE({ InitializeWorldBorderS2CPacket(it) }),
PLAY_WORLD_BORDER_SET_CENTER({ SetCenterWorldBorderS2CPacket(it) }),
PLAY_CENTER_SET_WORLD_BORDER_({ CenterSetWorldBorderS2CPacket(it) }),
PLAY_WORLD_BORDER_LERP_SIZE({ LerpSizeWorldBorderS2CPacket(it) }),
PLAY_WORLD_BORDER_SIZE({ SetSizeWorldBorderS2CPacket(it) }),
PLAY_WORLD_BORDER_SET_WARN_TIME({ SetWarningTimeWorldBorderS2CPacket(it) }),
PLAY_WORLD_BORDER_SET_WARN_BLOCKS({ SetWarningBlocksWorldBorderS2CPacket(it) }),
PLAY_WORLD_BORDER_SIZE({ SizeSetWorldBorderS2CPacket(it) }),
PLAY_WORLD_BORDER_SET_WARN_TIME({ WarningTimeSetWorldBorderS2CPacket(it) }),
PLAY_WORLD_BORDER_SET_WARN_BLOCKS({ WarningBlocksSetWorldBorderS2CPacket(it) }),
PLAY_CAMERA({ CameraS2CP(it) }),
PLAY_HOTBAR_SLOT_SET({ HotbarSlotSetS2CP(it) }),
PLAY_CHUNK_CENTER_SET({ ChunkCenterSetS2CP(it) }),

File diff suppressed because one or more lines are too long