Open-source multiplayer game server compatible with the RuneScape client https://www.openrs2.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
openrs2/protocol/src/main/kotlin/org/openrs2/protocol/jaggrab/upstream/JaggrabRequestDecoder.kt

19 lines
657 B

package org.openrs2.protocol.jaggrab.upstream
import io.netty.channel.ChannelHandler
import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.DecoderException
import io.netty.handler.codec.MessageToMessageDecoder
@ChannelHandler.Sharable
public object JaggrabRequestDecoder : MessageToMessageDecoder<String>() {
private const val PREFIX = "JAGGRAB "
override fun decode(ctx: ChannelHandlerContext, msg: String, out: MutableList<Any>) {
if (!msg.startsWith(PREFIX)) {
throw DecoderException("JAGGRAB request has invalid prefix")
}
out += JaggrabRequest(msg.substring(PREFIX.length))
}
}