be ready for commands that are more than 1 byte

This commit is contained in:
Jake Probst 2019-08-29 23:43:48 -07:00
parent 53d2484f3f
commit dcd47fa384

View File

@ -36,7 +36,7 @@ pub enum RecvCharacterPacket {
impl RecvServerPacket for RecvCharacterPacket {
fn from_bytes(data: &Vec<u8>) -> Result<RecvCharacterPacket, PacketParseError> {
match data[2] {
match u16::from_le_bytes([data[2], data[3]]) {
0x93 => Ok(RecvCharacterPacket::Login(Login::from_bytes(data)?)),
0xE0 => Ok(RecvCharacterPacket::RequestSettings(RequestSettings::from_bytes(data)?)),
0xE3 => Ok(RecvCharacterPacket::CharSelect(CharSelect::from_bytes(data)?)),