Skip to content

Commit

Permalink
Update to Minecraft 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-albers committed Nov 18, 2016
1 parent f5b8447 commit b48d994
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
The 5zig Mod API 2.3
The 5zig Mod API 2.3.1
====================
The 5zig Mod ServerAPI is a plugin created for easy communication from a Plugin to a Client using Custom Payloads / Plugin messaging. This will of course only work if the user has got The 5zig Mod installed (http://5zig.eu/downloads).

Expand Down
55 changes: 55 additions & 0 deletions src/eu/the5zig/mod/server/util/protocol/BufferUtils_v1_11_R1.java
@@ -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);
}
}
}
2 changes: 1 addition & 1 deletion src/plugin.yml
@@ -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

0 comments on commit b48d994

Please sign in to comment.