Add forced servers back.
This commit is contained in:
parent
c281f008c3
commit
57576912c1
@ -1,6 +1,7 @@
|
||||
package net.md_5.bungee.api.config;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Map;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -32,4 +33,9 @@ public class ListenerInfo
|
||||
* transferred to the default server on connect.
|
||||
*/
|
||||
private final boolean forceDefault;
|
||||
/**
|
||||
* A list of host to server name mappings which will force a user to be
|
||||
* transferred depending on the host they connect to.
|
||||
*/
|
||||
private final Map<String, String> forcedHosts;
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ public class YamlReconnectHandler implements ReconnectHandler
|
||||
{
|
||||
return listener.getDefaultServer();
|
||||
}
|
||||
|
||||
String server = data.get(key(player));
|
||||
String forced = listener.getForcedHosts().get(player.getPendingConnection().getVirtualHost().getHostName());
|
||||
String server = (forced == null) ? data.get(key(player)) : forced;
|
||||
return (server != null) ? server : listener.getDefaultServer();
|
||||
}
|
||||
|
||||
|
@ -147,6 +147,9 @@ public class YamlConfig implements ConfigurationAdapter
|
||||
{
|
||||
new HashMap()
|
||||
}));
|
||||
Map<String, String> forcedDef = new HashMap<>();
|
||||
forcedDef.put("pvp.md-5.net", "pvp");
|
||||
|
||||
Collection<ListenerInfo> ret = new HashSet<>();
|
||||
|
||||
for (Map<String, Object> val : base)
|
||||
@ -157,7 +160,8 @@ public class YamlConfig implements ConfigurationAdapter
|
||||
boolean forceDefault = get("force_default_server", false, val);
|
||||
String host = get("host", "0.0.0.0:25577", val);
|
||||
InetSocketAddress address = Util.getAddr(host);
|
||||
ListenerInfo info = new ListenerInfo(address, motd, maxPlayers, defaultServer, forceDefault);
|
||||
Map<String, String> forced = get("forced_hosts", forcedDef, val);
|
||||
ListenerInfo info = new ListenerInfo(address, motd, maxPlayers, defaultServer, forceDefault, forced);
|
||||
ret.add(info);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user