Note: This question is just for my curiosity
So from what I know, it is 100% legal to write your own Minecraft server software that is interoperable with the Minecraft client. This can be done by reverse-engineering the protocol, without looking at Minecraft's server code.
So in this case, must you still abide to the EULA (end-user license agreement) of Minecraft server's? The Vanilla server software require's you to accept this by typing "true" in a text file, but this doesn't apply with custom server software.