All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minecraft.server.PacketPlayInCustomPayload Maven / Gradle / Ivy

package net.minecraft.server;

import io.netty.buffer.Unpooled;

import java.io.IOException;

public class PacketPlayInCustomPayload implements Packet {
	
	private String a;
	private PacketDataSerializer b;
	
	public PacketPlayInCustomPayload() {
	}
	
	public void a(PacketDataSerializer packetdataserializer) throws IOException {
		this.a = packetdataserializer.c(20);
		int i = packetdataserializer.readableBytes();
		
		if (i >= 0 && i <= 32767) {
			this.b = new PacketDataSerializer(packetdataserializer.readBytes(i));
		} else {
			throw new IOException("Payload may not be larger than 32767 bytes");
		}
	}
	
	public void b(PacketDataSerializer packetdataserializer) throws IOException {
		packetdataserializer.a(this.a);
		packetdataserializer.writeBytes(this.b);
	}
	
	public void a(PacketListenerPlayIn packetlistenerplayin) {
		packetlistenerplayin.a(this);
	}
	
	public void setChannel(String channel) {
		this.a = channel;
	}
	
	public void setMessage(PacketDataSerializer message) {
		this.b = message;
	}
	
	public void setMessageArray(byte[] message) {
		this.b = new PacketDataSerializer(Unpooled.wrappedBuffer(message));
	}
	
	public String a() {
		return this.a;
	}
	
	public PacketDataSerializer b() {
		return this.b;
	}
	
	public String getChannel() {
		return a;
	}
	
	public PacketDataSerializer getMessage() {
		return b;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy