CrossEvents v0.2-beta

#CrossEvents

Crossevents is a small plugin that allows you to send events across different servers. This can be usefully for plugins to update their data on every server. For example:

  • Pushing a UpdateSQLEvent to make your plugin update their sql data on every server.
  • Preparing a Players spawn position before a plugin teleports the player to a server (With bungeecord).
  • Syncing chat across servers.
  • Etc, …

##Feactures

  • Sending basic events across servers.
  • Allow events to return a value to the sending server. For example a Cancellable that got canceled.
  • Smart Connection. You can copy around configs without having to worry about serverId conflicts.

##Download and Source
Github
Jenkins

2 Likes

Pretty cool! How are the servers configured?

Sweet thinking of putting up a modded Sponge server and linking it with the test server tonight. This oughtta be useful

Fairly simple:

#Bind or connect IP
HostName=localhost
#Defines if the server is a hosting server or not
IsServer=true
#Server port
Port=3947
#The unique ID of the server
ServerId="20cf6a75-f4c8-48d0-a799-a6103d1c5a21"
#The password for connections
password=eaf082e5-157d-418e-8681-14cab5453f76
version=1

To be honest I started with this plugin at 8AM. I have an exam java tomorrow xD.

What about syncing inventories too (or adding a simple switch to en/dis syncing)?

I can imagine expanding this plugin to a bungeecord alternative too :stuck_out_tongue:

Yeah, could technically seen work. As long you don’t forward sponge events directly xD. And if the connection stays solid. I still need to add reconnect stuff.

It doesn’t allow switching servers. Thats is something the player has to do. But yeah all possible :smile:

Can this handle any event or do events need to follow some pattern?

Any event that can be remade by gson will do.

But it is recommended to stick with primitive fields. For example don’t use the player object as field. Just use its UUID.

Why not use redis pub/sub?

I made this project as preparation on my java exam (Sockets and Pojo’s). So yeah I didn’t thought about using libraries. Also I don’t see any benefit of changing it to redis … .

ahh. do you have a master server which isn’t a plugin? plugin = downtime due to restarts… or is it a master less setup`?
redis would come with the ease of implementation. For example, the chat on our servers is running via redis. Now we have a 26 row node js app that bridges the entire chat to slack and back. This wouldn’t be possible (in this size) without the great redis lib for nodejs.
Another thing that comes in handy for us is the ease of tunneling redis so the connection is encrypted and authenticates with a 4096bit key.
In the end I guess it doesn’t matter much, I was just wondering why the extra work.

This plugin needs a master server indeed. And it is a plugin atm. But I will provide a way to run it standalone.

Out of curiosity I looked a bit deeper in to that redis lib. And I don’t think it will be helpfully because these reasons:

  • First of all server owners need to setup a redis server. And I know some people are limited if they use minecraft hosting. You could say that it is their fault for using hosting, but that is unfair isn’t it?
  • This plugin isn’t for chat only. It needs to forward Event objects to servers without breaking the complexity that comes with calling events across servers.
  • Your asking me to redo everything :frowning:. And I was already really happy about my packet framework.

don’t asking you anything, just curiosity. :smile:

Serialization FTW :stuck_out_tongue: (redission supports most collections)

Yeah, I totally agree. Lets hope those shared hosters allow incoming traffic on custom ports.

1 Like

Curious about performance. Any benchmarks to show off?

Is this even in a usable state yet? Also, examples on how to use it would be great. And how does it handle events that contain references to non serializable Objects?

I haven’t benchmarked this yet. But I will when I come home. I also wonder how many events I can push trough.

It is usable. Only the API is missing some parts like sending events to a specific server. I am working on that.

The readme contains a simple crosschat example.

I haven’t figured that out yet. Atm it just parses the event object to Json.
Also Sponge objects are totally worthless on other servers. It is better to make sure you only store the stuff you need.

Mind also benchmarking when sending to a lot of servers at the same time repeatedly?

I did some benchmarking.

  • A Returnable takes 2ms for every server it has to pass to, So lets say you have 10 servers. 20ms to pass the event. I have no idea how I could fix that. A event should get passed synchronously.
  • Actually the above is not true. I just runned 3 servers and it stayed around 2 at 3 ms.
  • And a normal event takes 1ms to pass across servers. It doesn’t matter how many servers you have.

Also notice I fired 1 event every 1 ms with a [email protected] and it only did something like 9% extra.

I used this to benchmark it:

Were all servers hosted on the same machine?

Well yeah. I don’t have test machines :frowning:. I am just a poor dev. But indeed good point. I have no idea how this would handle if servers where running on multiple machines … .