Server Redirect

Server Redirect

Mod and plugin

This mod provides a lightweight way for servers to transfer players to another server address, without the use of a proxy server.

Client or server Utility

6,376 downloads
33 followers
Created2 years ago
Updated6 months ago

Follow Save
Host your Minecraft server on BisectHosting - get 25% off your first month with code MODRINTH.

Server Redirect

This mod provides a lightweight way for servers to transfer players to another server address, without the use of a proxy server.

Server Redirect supports Forge, Fabric, Bukkit/Spigot, SpongeVanilla/SpongeForge, Bungeecord/Waterfall and Velocity.

With Server Redirect, server admins can avoid mod incompatibility issues caused by proxy servers (Bungeecord, Waterfall, and Velocity). In particular, this mod can be used in combination with Waterfall and Forge 1.13+ servers and clients to provide a way to transfer players between servers (currently, the 1.13+ Forge server needs to be "online" as they haven't included IP forwarding yet...).

This mod is optional, so it can be added to modpacks and players can still join servers without this mod. Likewise, servers with this mod can be joined by clients without this mod.

Commands

  • /redirect <Target> <Server Address>: redirects the specified target player(s) to the specified address
  • /fallback <Target> <Server Address>: sets the fallback server address for the specified target player(s)
  • /ifplayercanredirect <Target> <Command...>: runs the specified command for each of the target player(s) that have Server Redirect
  • /ifplayercannotredirect <Target> <Command...>: runs the specified command for each of the target player(s) that have not Server Redirect

The command source can be anything that can run a command, like a command block, a player, or console. Replace /redirect with /fallback to have the specified target players connect to the specified server address when they get forcefully disconnected from the server.

The <Target> argument can be one of the following:
  • Player Name/UUID: the specified player on the server
  • Target Selector: a target selector. Target selectors are not available on Bungeecord and Velocity.
  • r=N: all players within N blocks from the command sender, or from the overworld spawn if run by console. Plugin version only.
  • s=<ServerName>: all players in the specified ServerName. Bungeecord and Velocity only.
  • *: all players on the server.
The <Command...> argument can contain the following placeholders:
  • %PlayerName: this placeholder will be replaced with the player's name
  • %PlayerId: this placeholder will be replaced with the player's UUID

NOTICE: /ifplayercanredirect and /ifplayercannotredirect will likely not work as expected if run when the target player just joined the server. These commands rely on the client sending a packet to the server telling them they have this mod installed. This packet requires some time to be sent by the client and processed by the server. It is recommended to delay this command execution by at least 20 ticks after the player has joined the server!

Examples:

Replace /redirect with /fallback for setting a fallback address for the target players. For more info about the fallback command, read below.

FAQ

How this mod redirects players

  • By running the /redirect command, the server will send a "transfer" packet containing the specified server address to the specified players.
  • All players receiving the packet that have the ServerRedirect mod installed will disconnect from the server, and automatically direct connect to the specified server address.

Any server address that is reachable by the players with the "Direct Connect" button can be used. The "transfer" packet will not affect players without the mod installed: they will simply stay connected on the current server.
This behaves like the transfer packet present in "Minecraft: Bedrock Edition", feature included by Mojang by default on that client. Regrettably, "Minecraft: Java Edition" is missing this feature entirely.
Both the redirect and fallback commands are not supposed to be run by players. They are intended for being run by the console, command blocks and other plugins. Command aliases and "server selector" GUIs are recommended (see BossShop or VirtualChest).

What the fallback command is for

The fallback command tells the clients which server address they should connect to in case they get forcefully disconnected from the server (e.g. the server crashes).

Server admins want to use this by running the fallback command automatically by the server for every player that joins the server. If the server shuts down for any reason, the players will automatically direct connect to the fallback server address specified in the fallback command.

Another use of the fallback feature is when you want to redirect a player to a server, but they might get rejected for some reason (e.g. the server is offline). First, set the fallback address for the player to a server address you can be sure they can reach, then use the redirect command to redirect the player to the server address they might get rejected from. If the player cannot join the server they were redirected to, they'll automatically join the fallback server.

Reasons for using this mod instead of a proxy like Bungeecord, Waterfall or Velocity

Forge mods don't always expect that the player is being moved from one server to another, and when a proxy transfers a player to a different server, it can cause glitches or crashes. Forge mods commonly expect to be disconnected from the server before connecting to another one. Additionally, Forge 1.13+ does not support proxies server switching. This mod solves the issue by properly disconnecting players from the server, and then connecting them to another server. This way, mods can properly handle players switching from a server to another.

Server admins can also use a combination of a proxy and Server Redirect if they want to use all the other features proxies can provide (except on Forge 1.13+ servers currently). Still, it is suggested to look into replacing the proxy with cross-server plugins and mods.

Players with this mod can join servers without this mod

Any combination of presence/absence of this mod will let players connect to servers. Players with this mod can connect to Vanilla servers as well, and players with vanilla Minecraft can also connect to servers with this mod.

This mod can be added in modpacks

Feel free to add this modpack in public and private modpacks. Asking for permission is not required. If you add Server Redirect to your public modpack, feel free to let everyone know in the comments below! Although this mod shouldn't have any conflict with any other mod, feel free to report conflicts here.

License and improvements to the project

This project is MIT licensed. Feel free to fork this project and/or suggest new features on the Issues page! If you cannot find the right version of Server Redirect for your Minecraft version, feel free to ask there!

If you wish to buy me a pizza, click here! I appreciate it very much! :)

External resources



Project members

KaiKikuchi

Owner


Technical information

License
MIT
Project ID