23 lines
		
	
	
	
		
			683 B
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
	
		
			683 B
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.network;
 | |
| 
 | |
| import io.netty.buffer.ByteBuf;
 | |
| import io.netty.channel.ChannelHandlerContext;
 | |
| import io.netty.channel.ChannelInboundHandlerAdapter;
 | |
| 
 | |
| public class MonitoredLocalFrameDecoder extends ChannelInboundHandlerAdapter {
 | |
| 	private final BandwidthDebugMonitor monitor;
 | |
| 
 | |
| 	public MonitoredLocalFrameDecoder(BandwidthDebugMonitor monitor) {
 | |
| 		this.monitor = monitor;
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public void channelRead(ChannelHandlerContext channelHandlerContext, Object object) {
 | |
| 		object = HiddenByteBuf.unpack(object);
 | |
| 		if (object instanceof ByteBuf byteBuf) {
 | |
| 			this.monitor.onReceive(byteBuf.readableBytes());
 | |
| 		}
 | |
| 
 | |
| 		channelHandlerContext.fireChannelRead(object);
 | |
| 	}
 | |
| }
 |