s2s/How it's work
How it's work
Server will interact to each other via S2S listener and sender. By create a listener for server and create each sender for each plugin. This allowed plugin to send data via its data sender (called Server Connector). When server received a packet, S2S will determine which plugin will be interact with it.
When plugin request to be Server Connector, S2S will create a new Server Connector with all information of that plugin included. This help S2S to determine how plugin able to send/receive data to/from another server via permissions (called Plugin Permissions).
And also happen when plugin request to send data to another server. S2S will check if that plugin able to send data via Plugin Permissions. If it is allowed, data is sent and proper response will be returned, if not, data is cancelled to send and proper response will be returned with packet exception.
When server started, S2S will start server listener for receiving incoming packets from another server. At this state, S2S is ready for plugin to request.
When packet is received, S2S will check and determine which plugin will be received. If plugin is found and permission to read is allowed, packet will be sent to that plugin, if permission is not allow, response packet will be sent to that plugin instead with packet exception included.
In each packet that send and received, these are all data for server to know. Server IP is for checking who sent it. Plugin name and version is for checking which plugin will response to this packet. Data is actual data from plugin.