summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java
blob: 5df99a44260cedbaa819abe56371aeb6b835e329 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package net.minecraft.server;

import java.io.IOException; // CraftBukkit

public class PacketPlayInCustomPayload extends Packet {

    private String tag;
    public int length; // CraftBukkit - private -> public
    private byte[] data;

    public PacketPlayInCustomPayload() {}

    public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
        this.tag = packetdataserializer.c(20);
        this.length = packetdataserializer.readShort();
        if (this.length > 0 && this.length < 32767) {
            this.data = new byte[this.length];
            packetdataserializer.readBytes(this.data);
        }
    }

    public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
        packetdataserializer.a(this.tag);
        packetdataserializer.writeShort((short) this.length);
        if (this.data != null) {
            packetdataserializer.writeBytes(this.data);
        }
    }

    public void a(PacketPlayInListener packetplayinlistener) {
        packetplayinlistener.a(this);
    }

    public String c() {
        return this.tag;
    }

    public byte[] e() {
        return this.data;
    }

    public void handle(PacketListener packetlistener) {
        this.a((PacketPlayInListener) packetlistener);
    }
}