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