Firstly, as Kuyan suggested, see http://wiki.vg/Main_Page , which has links to various programs that may be useful, either directly or for the source, see.
For example, in the Utilities section, the first thing that appears is a proxy server.
And a little down, there is mc3p , a program proposed by Joran Beasley - a Python proxy with plugin support. It only works until 1.2.5, but sadimusi/mc3p claims to be a 1.4.2 compatible plug. As J.F. Sebastian says, mc3p has an interface for log plugins, so you can just write the one that logs into postgres.
If you want to read the packages yourself, this is not difficult. You can write a generic TCP proxy in dozens of Python lines or write one in 2 shellscript lines around netcat that maps the data to your Python script.
The hard part does not intercept data; he analyzes the protocol. Minecraft probably doesn't send "Nightbane: 1 tnt for $ 100,000 each," but something like "offer: Nightbane: 1: tnt: 100" or "\ x13 \ x09Nightbane \ x00 \ x01 \ x72 \ x00 \ x64 " From what the wiki says, the protocol is documented, but bad and sometimes inaccurate, and the wiki is sometimes wrong too, and the official code is very ugly and hard to read. This means that the best way to understand the protocol is probably to read sadimusi / mc3p or one of the other projects like McPacketSniffer or ProtoProxy, after which you need to ask if it will be easier to just use this project and not to redefine it.
In any case, cleaning the screen should be your last resort.
source share