Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5b8447
commit b48d994
Showing
3 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/eu/the5zig/mod/server/util/protocol/BufferUtils_v1_11_R1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package eu.the5zig.mod.server.util.protocol; | ||
|
||
import io.netty.buffer.Unpooled; | ||
import net.minecraft.server.v1_11_R1.PacketDataSerializer; | ||
import net.minecraft.server.v1_11_R1.PacketPlayOutCustomPayload; | ||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; | ||
import org.bukkit.entity.Player; | ||
|
||
public class BufferUtils_v1_11_R1 implements IBufferUtils { | ||
|
||
@Override | ||
public IPacketBuffer createBuffer() { | ||
return new PacketBuffer(); | ||
} | ||
|
||
@Override | ||
public IPacketBuffer createBuffer(Protocol.PayloadType payloadType) { | ||
return new PacketBuffer(payloadType); | ||
} | ||
|
||
private class PacketBuffer implements IPacketBuffer { | ||
|
||
private PacketDataSerializer packetDataSerializer; | ||
|
||
public PacketBuffer() { | ||
this.packetDataSerializer = new PacketDataSerializer(Unpooled.buffer()); | ||
} | ||
|
||
public PacketBuffer(Protocol.PayloadType payloadType) { | ||
this(); | ||
writeInt(payloadType.ordinal()); | ||
} | ||
|
||
@Override | ||
public void writeString(String string) { | ||
packetDataSerializer.a(string); | ||
} | ||
|
||
@Override | ||
public void writeInt(int i) { | ||
packetDataSerializer.writeInt(i); | ||
} | ||
|
||
@Override | ||
public void writeLong(long l) { | ||
packetDataSerializer.writeLong(l); | ||
} | ||
|
||
@Override | ||
public void send(Player player, String channel) { | ||
PacketPlayOutCustomPayload packet = new PacketPlayOutCustomPayload(channel, packetDataSerializer); | ||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: The5zigMod | ||
version: 2.3 | ||
version: 2.3.1 | ||
main: eu.the5zig.mod.server.The5zigMod | ||
author: 5zig | ||
website: http://5zig.eu |