Server Redirect

ServerRedirect

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

ServerRedirect 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.

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.

Downloads

Server admins

Plugin for Spigot (including Cauldron/Mohist), Sponge, Bungeecord and Velocity
Mod for Forge and Fabric servers

Player clients (Forge and Fabric)

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:
  • /redirect KaiNoMood myawesomemcserver.net:25667: the player named KaiNoMood will connect to myawesomemcserver.net:25667
  • /redirect a54a7884-9ea4-4d54-ac35-1623d70ffbe1 myawesomemcserver.net:25667: the player with the specified UUID will connect to myawesomemcserver.net:25667
  • /redirect * myawesomemcserver.net:25667: all players on the server will connect to myawesomemcserver.net:25667.
  • /redirect @a[m=creative] myawesomemcserver.net:25667: all players in creative mode will connect to myawesomemcserver.net:25667.
  • /redirect r=10 myawesomemcserver.net:25667: all players within 6 blocks from the command sender will connect to myawesomemcserver.net:25667. This works on Bukkit and Sponge based servers only.
  • /redirect s=lobby myawesomemcserver.net:25667: all players in the "lobby" server will connect to myawesomemcserver.net:25667. This works on Bungeecord and Velocity proxy servers only.
  • /ifplayercanredirect * say %PlayerName is online and using Server Redirect! Yay!: the specified command will run for each player on the server that has Server Redirect.
  • /ifplayercannotredirect @a[distance=..5] tell %PlayerName It does not seem you have Server Redirect installed! Make sure to install it!: the specified command will run for all players without Server Redirect within 5 blocks of the command source.

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

Permissions

  • /redirect: serverredirect.command.redirect
  • /fallback: serverredirect.command.fallback
  • /ifplayercanredirect: serverredirect.command.ifplayercanredirect
  • /ifplayercannotredirect: serverredirect.command.ifplayercannotredirect

These permissions are not supposed to be granted to players. These are console/command blocks commands only.
These permissions are valid for the plugin version only.

PlaceholderAPI

The plugin supports PlaceholderAPI (currently, Bukkit/Spigot only).

Placeholders:
  • {serverredirect}: 1 if the player has Server Redirect, 0 otherwise
  • {serverredirect_yesno}: "Yes" if the player has Server Redirect, "No" otherwise
  • {serverredirect_yesnof1}: "&aYes" if the player has Server Redirect, "&cNo" otherwise
  • {serverredirect_yesnof2}: "§aYes" if the player has Server Redirect, "§cNo" otherwise

Depending on the PlaceholderAPI version and configuration, you might have to use %serverredirect% instead of {serverredirect}.

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.

More info about this project

Please visit the Server Redirect mod project page.

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!


Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    569869
  • Created
    Jan 18, 2022
  • Last Released File
    Jan 26, 2022
  • Total Downloads
    803
  • License

Categories

Members