BungeeCord Support

* Provides support for IP forwarding via BungeeCord.
* Treats Bungee as Online Mode.

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2014-04-12 21:23:58 +10:00
parent 496995ccaa
commit 3d4c222263
11 changed files with 206 additions and 56 deletions

View File

@@ -803,7 +803,13 @@ public final class CraftServer implements Server {
@Override
public long getConnectionThrottle() {
return this.configuration.getInt("settings.connection-throttle");
// Spigot Start - Automatically set connection throttle for bungee configurations
if (org.spigotmc.SpigotConfig.bungee) {
return -1;
} else {
return this.configuration.getInt("settings.connection-throttle");
}
// Spigot End
}
@Override
@@ -1814,7 +1820,7 @@ public final class CraftServer implements Server {
if (result == null) {
GameProfile profile = null;
// Only fetch an online UUID in online mode
if (this.getOnlineMode()) {
if (this.getOnlineMode() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now.
// This is potentially blocking :(
profile = this.console.getProfileCache().get(name).orElse(null);
}

View File

@@ -2344,6 +2344,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private final Player.Spigot spigot = new Player.Spigot()
{
@Override
public InetSocketAddress getRawAddress()
{
return (InetSocketAddress) CraftPlayer.this.getHandle().connection.getRawAddress();
}
@Override
public void respawn()
{

View File

@@ -214,4 +214,14 @@ public class SpigotConfig
SpigotConfig.commands.put( "restart", new RestartCommand( "restart" ) );
WatchdogThread.doStart( SpigotConfig.timeoutTime, SpigotConfig.restartOnCrash );
}
public static boolean bungee;
private static void bungee() {
if ( SpigotConfig.version < 4 )
{
SpigotConfig.set( "settings.bungeecord", false );
System.out.println( "Outdated config, disabling BungeeCord support!" );
}
SpigotConfig.bungee = SpigotConfig.getBoolean( "settings.bungeecord", false );
}
}