minecrafter / RedisBungee

The leading player synchronization system for BungeeCord
https://www.spigotmc.org/resources/redisbungee.13494/
Eclipse Public License 1.0
157 stars 122 forks source link

Get all servers to send data to #56

Closed kangarko closed 6 years ago

kangarko commented 6 years ago

Hello!

I am facing a difficulty when finding a way on how to (easier) send data from one server to another. The only way I found is very obscure through getting ServerInfo for each player on the network.

This is my code that I am currently using:

a

Any help would be appreciated.

yzimroni commented 6 years ago

To get all the proxies in the network, you can use RedisBungeeAPI#getAllServers, but if you want to send data from one proxy to all the proxies in the network, you can simply use RedisBungeeAPI#sendChannelMessage (register the channel you want to use using RedisBungeeAPI#registerPubSubChannels and listen to PubSubMessageEvent for incoming messages from other proxies)

kangarko commented 6 years ago

Hey, thank you.

I am just curious (since I don't have redis environment right now) whether sending that data as a byte stream would work. Right now I am using this method to forward the data (that's why I need the ServerInfo class):

a

yzimroni commented 6 years ago

Do you want to send the data to all bungeecords (proxies) in the network or to all the Minecraft servers connected to bungeecord (it looks like it from your code)? If to all bungeecords, use RedisBungeeAPI#sendChannelMessage, If you want to send to all the Minecraft servers, use ServerInfo#sendData (this is BungeecordAPI, you don't have to use Redis/RedisBungee for this)

kangarko commented 6 years ago

I would like to forward the data from one Minecraft server to another just like my image excerpt above looks like. The method getAllServers() is the one from my first post.

Okay it seems that my approach is correct. Thanks again. Closing this :)