use of de.dytanic.cloudnet.cloudflare.database.CloudFlareDatabase 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