How can I send the player the chat from the last server after he transferred using the TransferPacket?
Spoiler: Really? Send player from MCPE to CS:GO Add fully functioning parrots in MCPE 1.0.8 without using mods or textures. Scoreboard in MCPE 1.0.8 exactly like the way it looks on PC 1.1 There was an "unless" exception. What if the player was transferred from LifeBoat to LifeGoat (assuming the OP's server as LifeGoat and not having any permission to interfere with LifeBoat's database).
It would theoretically be possible by letting a fake client join the other server and getting the chat
That was meant to be a joke, it's totally impractical because you would need to let the server think that you are an actual player
This is completely practical. OP is asking how he could implement chat forwarding between two servers he owns. You can.. Communicate between the two servers utilizing TCP. Both servers are listening on a port. When a player is transferred, the origin server opens a connection to the destination server on the specified port, sends ClientID or some other uniquely identifying data to the destination server, then forwards all chat messages captured through some means (command preprocess event? fake player? witch magic? you decide!) to the destination server. The destination server then sends the forwarded messages to the newly connected client with the matching ClientID. This is, of course, not the only approach. In fact, there probably are better approaches. Implementation is left as an exercise to the reader.
Using the Hormones API, you can detect PlayerChatEvent and release a hormone onto other servers to display it.
My reply was meant for the method of using a fake client to connect to a server that the person does NOT own...
In the terminology of Hormones, this is called "Nervous coordinate system". This is not feasible if there are too many servers. Imagine... If you have 5 servers, you need nCr(5, 2) = 10 connections, and if you have 10 servers, you need nCr(10, 2) = 45 connections. Moreover, you need to determine the appropriate port for the server, which is not quite convenient if you have multiple servers on the same machine. You may use a relay system like IRC, but it has the same problem with ports, and it might be slow. On the other hand, using a system like Hormones might be more efficient with a centralized server that does not require much extra setup. With a kidney, using MySQL isn't a big problem.
This is client-dependent. I don't think this is possible. According to your code, it'd be very slow if you have a lot of other servers to send to, since you're broadcasting in the same thread. Using an async pool for it would be better.