use of de.dytanic.cloudnet.lib.proxylayout.ServerFallback in project CloudNet by Dytanic.
the class CloudProxy method fallback.
public String fallback(ProxiedPlayer cloudPlayer) {
for (ServerFallback serverFallback : CloudProxy.getInstance().getProxyGroup().getProxyConfig().getDynamicFallback().getFallbacks()) {
if (serverFallback.getGroup().equals(CloudProxy.getInstance().getProxyGroup().getProxyConfig().getDynamicFallback().getDefaultFallback()))
continue;
if (serverFallback.getPermission() != null) {
if (!cloudPlayer.hasPermission(serverFallback.getPermission()))
continue;
List<String> servers = CloudProxy.getInstance().getServers(serverFallback.getGroup());
if (servers.size() != 0) {
return servers.get(NetworkUtils.RANDOM.nextInt(servers.size()));
}
}
}
String fallback = getProxyGroup().getProxyConfig().getDynamicFallback().getDefaultFallback();
List<String> liste = new ArrayList<>(MapWrapper.filter(cachedServers, new Acceptable<ServerInfo>() {
@Override
public boolean isAccepted(ServerInfo value) {
return value.getServiceId().getGroup().equalsIgnoreCase(fallback);
}
}).keySet());
if (liste.size() == 0)
return null;
else
return liste.get(NetworkUtils.RANDOM.nextInt(liste.size()));
}
use of de.dytanic.cloudnet.lib.proxylayout.ServerFallback in project CloudNet by Dytanic.
the class CloudProxy method fallbackOnEnabledKick.
public String fallbackOnEnabledKick(ProxiedPlayer cloudPlayer, String group, String kickedFrom) {
for (ServerFallback serverFallback : CloudProxy.getInstance().getProxyGroup().getProxyConfig().getDynamicFallback().getFallbacks()) {
if (serverFallback.getGroup().equals(CloudProxy.getInstance().getProxyGroup().getProxyConfig().getDynamicFallback().getDefaultFallback()))
continue;
if (serverFallback.getPermission() != null) {
if (!cloudPlayer.hasPermission(serverFallback.getPermission()))
continue;
List<String> servers = CloudProxy.getInstance().getServers(serverFallback.getGroup());
servers.remove(kickedFrom);
if (servers.size() != 0) {
return servers.get(NetworkUtils.RANDOM.nextInt(servers.size()));
}
}
}
{
List<String> liste = new ArrayList<>(MapWrapper.filter(cachedServers, new Acceptable<ServerInfo>() {
@Override
public boolean isAccepted(ServerInfo value) {
return value.getServiceId().getGroup().equalsIgnoreCase(group);
}
}).keySet());
liste.remove(kickedFrom);
if (liste.size() != 0) {
return liste.get(NetworkUtils.RANDOM.nextInt(liste.size()));
}
}
String fallback = getProxyGroup().getProxyConfig().getDynamicFallback().getDefaultFallback();
List<String> liste = new ArrayList<>(MapWrapper.filter(cachedServers, new Acceptable<ServerInfo>() {
@Override
public boolean isAccepted(ServerInfo value) {
return value.getServiceId().getGroup().equalsIgnoreCase(fallback);
}
}).keySet());
liste.remove(kickedFrom);
if (liste.size() == 0)
return null;
else
return liste.get(NetworkUtils.RANDOM.nextInt(liste.size()));
}
use of de.dytanic.cloudnet.lib.proxylayout.ServerFallback in project CloudNet by Dytanic.
the class CloudProxy method fallback.
public String fallback(ProxiedPlayer cloudPlayer, String kickedFrom) {
for (ServerFallback serverFallback : CloudProxy.getInstance().getProxyGroup().getProxyConfig().getDynamicFallback().getFallbacks()) {
if (serverFallback.getGroup().equals(CloudProxy.getInstance().getProxyGroup().getProxyConfig().getDynamicFallback().getDefaultFallback()))
continue;
if (serverFallback.getPermission() != null) {
if (!cloudPlayer.hasPermission(serverFallback.getPermission()))
continue;
List<String> servers = CloudProxy.getInstance().getServers(serverFallback.getGroup());
servers.remove(kickedFrom);
if (servers.size() != 0) {
return servers.get(NetworkUtils.RANDOM.nextInt(servers.size()));
}
}
}
String fallback = getProxyGroup().getProxyConfig().getDynamicFallback().getDefaultFallback();
List<String> liste = new ArrayList<>(MapWrapper.filter(cachedServers, new Acceptable<ServerInfo>() {
@Override
public boolean isAccepted(ServerInfo value) {
return value.getServiceId().getGroup().equalsIgnoreCase(fallback);
}
}).keySet());
liste.remove(kickedFrom);
if (liste.size() == 0)
return null;
else
return liste.get(NetworkUtils.RANDOM.nextInt(liste.size()));
}
Aggregations