use of de.dytanic.cloudnet.lib.utility.Catcher in project CloudNet by Dytanic.
the class NetworkManager method newCloudNetwork.
public CloudNetwork newCloudNetwork() {
CloudNetwork cloudNetwork = new CloudNetwork();
cloudNetwork.setOnlineCount(getOnlineCount());
cloudNetwork.setMessages(messageConfig.load());
cloudNetwork.setModules(moduleProperties);
// cloudNetwork.setNotifySystem(CloudNet.getInstance().getConfig().isNotifyService());
cloudNetwork.setWebPort(CloudNet.getInstance().getConfig().getWebServerConfig().getPort());
// cloudNetwork.setDevServices(CloudNet.getInstance().getConfig().isCloudDevServices());
Collection<WrapperInfo> wrappers = new LinkedList<>();
for (Wrapper wrapper : CloudNet.getInstance().getWrappers().values()) if (wrapper.getWrapperInfo() != null)
wrappers.add(wrapper.getWrapperInfo());
cloudNetwork.setWrappers(wrappers);
cloudNetwork.setServerGroups(MapWrapper.transform(CloudNet.getInstance().getServerGroups(), new Catcher<String, String>() {
@Override
public String doCatch(String key) {
return key;
}
}, new Catcher<SimpleServerGroup, ServerGroup>() {
@Override
public SimpleServerGroup doCatch(ServerGroup key) {
return key.toSimple();
}
}));
// cloudNetwork.setPermissionPool(permissionPool);
cloudNetwork.setProxyGroups(CloudNet.getInstance().getProxyGroups());
cloudNetwork.setModules(moduleProperties);
return cloudNetwork;
}
use of de.dytanic.cloudnet.lib.utility.Catcher in project CloudNet by Dytanic.
the class CloudFlareModule method onBootstrap.
@Override
public void onBootstrap() {
configCloudFlare = new ConfigCloudFlare();
cloudFlareDatabase = new CloudFlareDatabase(getCloud().getDatabaseManager().getDatabase("cloud_internal_cfg"));
try {
CloudFlareService cloudFlareAPI = new CloudFlareService(configCloudFlare.load());
cloudFlareAPI.bootstrap(MapWrapper.transform(getCloud().getWrappers(), new Catcher<String, String>() {
@Override
public String doCatch(String key) {
return key;
}
}, new Catcher<SimpledWrapperInfo, Wrapper>() {
@Override
public SimpledWrapperInfo doCatch(Wrapper key) {
return new SimpledWrapperInfo(key.getServerId(), key.getNetworkInfo().getHostName());
}
}), getCloud().getProxyGroups(), cloudFlareDatabase);
} catch (Exception ex) {
ex.printStackTrace();
}
getCloud().getEventManager().registerListener(this, new ProxyAddListener());
getCloud().getEventManager().registerListener(this, new ProxyRemoveListener());
}
Aggregations