If you did made your own system. Than vanilla clients will crash if the server sends a packet from you. They way you have to see it is like reading a book in another language. The client will be : I don’t understand this packet. But even worse, it will be unable to determine where the next packet is. Result: It disconnects the server with protocol error.
A solution for the above would be framing each packet. But for legacy and timing reasons, Minecraft does not do that.
When the event onServerStartingEvent is called, MinecraftGUI start listening on the port 20000.
At this point, the server is waiting connection.
Client side:
When you connect to a server. MinecraftGUI will try to connect to the port 20000. If he can’t, MinecraftGUI won’t start.
MinecraftGUI mod will send the player UUID to MinecraftGUI plugin. MinecraftGUI plugin will do the authentication of this player.
If the authentication is good, the player can receive command from the server. If not, MinecraftGUI plugin will close the connection and MinecraftGUI mod will stop.
The port is configurable. When the client try his connection and it failed, a pop-up will appear on his screen to ask if the player know if the server has the plugin. If the player click yes, he will have to enter the port.
I like how you handle Vanilla Clients. But what happens if i try to write a message to a vanilla user? he can’t read it obviously via the gui (is there a commandline/chat option for vanilla?) or is this message just “lost”?
Example:
I create a messenger plugin. To send a messenge to someone I need to write to command:
/message sendTo [player name] message [message]
That command call the function:
sendMessageTo(String playerNameFrom, String playerNameTo, String message);
Now I want to support MinecraftGUI.
You will create two input and one button. First input will receive the name of the player to send the message. The second will receive the content of the message. After, you link the button to the two inputs. When the player will click the button, the server will receive the two input. The server will call an event when he will receive the two inputs.
When you receive the event, you will have to call the same function that the command call.
sendMessageTo(String playerNameFrom, String playerNameTo, String message);