implement compression threshold setting
This commit is contained in:
@@ -39,7 +39,7 @@ type LoginServer struct {
|
|||||||
ServerPort uint16
|
ServerPort uint16
|
||||||
Requested NameAndUUID
|
Requested NameAndUUID
|
||||||
Given *NameAndUUID
|
Given *NameAndUUID
|
||||||
CompressionThreshold int32 //FIXME: implement this
|
CompressionThreshold int32
|
||||||
Status []byte
|
Status []byte
|
||||||
CompatibleVersions []int32
|
CompatibleVersions []int32
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ func (l *LoginServer) SetCompressionThreshold(threshold int32) (err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
l.CompressionThreshold = threshold
|
l.RawConn.SetCompressionThreshold(threshold)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +94,13 @@ func (l *LoginServer) OnLoginStart(packet *v1_21_8.LoginToServerPacketLoginStart
|
|||||||
if l.Given == nil {
|
if l.Given == nil {
|
||||||
l.Given = &l.Requested
|
l.Given = &l.Requested
|
||||||
}
|
}
|
||||||
|
if l.CompressionThreshold < 0 {
|
||||||
|
err = l.SetCompressionThreshold(l.CompressionThreshold)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = l.Send(&v1_21_8.LoginToClientPacketSuccess{
|
err = l.Send(&v1_21_8.LoginToClientPacketSuccess{
|
||||||
Uuid: l.Given.UUID,
|
Uuid: l.Given.UUID,
|
||||||
Username: l.Given.Name,
|
Username: l.Given.Name,
|
||||||
|
|||||||
Reference in New Issue
Block a user