int actionId = ByteBufUtils.readVarInt(buffer);
WorldBorderMessage.Action action = WorldBorderMessage.Action.getAction(actionId);
switch (action) {
case SET_SIZE:
double radius = buffer.readDouble();
return new WorldBorderMessage(action, radius);
case LERP_SIZE:
double oldRadius = buffer.readDouble();
double newRadius = buffer.readDouble();
long speed = buffer.readLong();
return new WorldBorderMessage(action, oldRadius, newRadius, speed);
case SET_CENTER:
double x = buffer.readDouble();
double z = buffer.readDouble();
return new WorldBorderMessage(action, x, z);
case INITIALIZE:
x = buffer.readDouble();
z = buffer.readDouble();
oldRadius = buffer.readDouble();
newRadius = buffer.readDouble();
speed = ByteBufUtils.readVarLong(buffer);
int portalTeleportBoundary = ByteBufUtils.readVarInt(buffer);
int warningTime = ByteBufUtils.readVarInt(buffer);
int warningBlocks = ByteBufUtils.readVarInt(buffer);
return new WorldBorderMessage(action, x, z, oldRadius, newRadius, speed, portalTeleportBoundary, warningTime, warningBlocks);
case SET_WARNING_TIME:
case SET_WARNING_BLOCKS:
warningTime = ByteBufUtils.readVarInt(buffer);
return new WorldBorderMessage(action, warningTime);
default:
throw new DecoderException("Invalid WorldBorderMessage action " + actionId + "/" + action);
}
}