// Path: src/main/java/me/pascoej/ajario/packet/AgarPacket.java
// public interface AgarPacket {
//     byte[] toBytes();
// 
//     PacketType getType();
// 
//     static AgarPacket parseByteBuffer(ByteBuffer byteBuffer) {
//         if (byteBuffer.capacity() == 0) {
//             return null;
//         }
//         PacketType.ClientBound packetType = PacketType.ClientBound.packetType(byteBuffer.get());
//         if (packetType == null) {
//             return null;
//         }
//         switch (packetType) {
//             case UPDATE_NODES:
//                 return new UpdateNodes(byteBuffer);
//             case UPDATE_POSITION_SIZE:
//                 return new UpdatePositionAndSize(byteBuffer);
//             case CLEAR_ALL_NODES:
//                 return new ClearAllNodes(byteBuffer);
//             case ADD_NODE:
//                 return new AddNode(byteBuffer);
//             case UPDATE_LEADERBOARD:
//                 return new UpdateLeaderBoard(byteBuffer);
//             case SET_BORDER:
//                 return new SetBorder(byteBuffer);
//         }
//         return null;
//     }
// }


import me.pascoej.ajario.packet.AgarPacket;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
package me.pascoej.ajario.packet.serverbound;



/**
 * Created by john on 6/14/15.
 */
public abstract class ServerBoundPacket implements AgarPacket {
    protected ByteBuffer getByteBuffer() {
        ByteBuffer byteBuffer = ByteBuffer.allocate(size()).order(ByteOrder.LITTLE_ENDIAN);
        byteBuffer.put(this.getType().getId());
        addPayload(byteBuffer);
// Path: src/main/java/me/pascoej/ajario/packet/AgarPacket.java
// public interface AgarPacket {
//     byte[] toBytes();
// 
//     PacketType getType();
// 
//     static AgarPacket parseByteBuffer(ByteBuffer byteBuffer) {
//         if (byteBuffer.capacity() == 0) {
//             return null;
//         }
//         PacketType.ClientBound packetType = PacketType.ClientBound.packetType(byteBuffer.get());
//         if (packetType == null) {
//             return null;
//         }
//         switch (packetType) {
//             case UPDATE_NODES:
//                 return new UpdateNodes(byteBuffer);
//             case UPDATE_POSITION_SIZE:
//                 return new UpdatePositionAndSize(byteBuffer);
//             case CLEAR_ALL_NODES:
//                 return new ClearAllNodes(byteBuffer);
//             case ADD_NODE:
//                 return new AddNode(byteBuffer);
//             case UPDATE_LEADERBOARD:
//                 return new UpdateLeaderBoard(byteBuffer);
//             case SET_BORDER:
//                 return new SetBorder(byteBuffer);
//         }
//         return null;
//     }
// }


// Path: src/main/java/me/pascoej/ajario/packet/serverbound/ServerBoundPacket.java
import me.pascoej.ajario.packet.AgarPacket;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

package me.pascoej.ajario.packet.serverbound;



/**
 * Created by john on 6/14/15.
 */
public abstract class ServerBoundPacket implements AgarPacket {
    protected ByteBuffer getByteBuffer() {
        ByteBuffer byteBuffer = ByteBuffer.allocate(size()).order(ByteOrder.LITTLE_ENDIAN);
        byteBuffer.put(this.getType().getId());
        addPayload(byteBuffer);
        return byteBuffer;