简体   繁体   中英

Networking with a remote java program

I'm looking to have a network of bukkit servers that all operate under a single game mod that allows for inter-server communication. The conventional way to do this is to utilize a MySQL database and have all the servers pull from the database periodically (5 seconds or so) to keep all the servers up to date. I'm wondering if there is a better way to accomplish this.

I have an idea, but I don't know enough about networking to know if it is feasible. I'm considering having the game mod run under it's own java server (here-on referred to as the mod server and not related to bukkit). The mod server will have all the data associated with the mod and it will be responsible for executing all the computation regarding the mod (handling money transactions, adding and removing claimed land, and dealing with the tax cycle). All the bukkit servers interface with the mod server whenever it needs to determine if, for instance, a player can break a block, or hurt another player. All changes to the data of the mod is done on the mod server. The bukkit servers are essentially just portals to interact with the mod server. As long as the mod server is single threaded, then there shouldn't be any concurrency issues, race conditions, or conflicts.

I've been reading into Remote Method Invocation and I was thinking that maybe it was the avenue to accomplish this. The mod server would be considered the RMI server, and the clients would be the Bukkit servers. I read through the documentation for the Java Sockets , but I'm not sure that it's what I'm looking for. I'm having a difficult time googling it because it's only a concept for which I don't know all the technical terms. Any ideas or suggestions? Thanks.

Each bukkit server should be in charge of managing the players on it and only those on it. Thus you don't need this mod server to handle SQL when you can simply load player data when a player joins that specific server. Any updates to the player can be done on the local data and then committed to the database when the player leaves or when it happens. As an example, or server uses zPermissions for cross server permissions. It updates on change and players who change to another server have all their permissions from the original. The only problem here is when the group permissions change which simply needs a permissions reload to update, but those will not change often once your server gets organized.

Are you using BungeeCord? If you are, you can create your own plugin channel.
You can send and recieve data from every subserver (bukkit server) to the master server (bungeecord proxy) via your own channel. Here is an explanation:
http://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/#the-bungeecord-plugin-channel

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM