Search in sources :

Example 1 with CloudNetwork

use of de.dytanic.cloudnet.lib.CloudNetwork in project CloudNet by Dytanic.

the class CloudNet method updateNetwork.

public void updateNetwork() {
    CloudNetwork cloudNetwork = networkManager.newCloudNetwork();
    networkManager.sendAll(new PacketOutCloudNetwork(cloudNetwork));
}
Also used : PacketOutCloudNetwork(de.dytanic.cloudnetcore.network.packet.out.PacketOutCloudNetwork) PacketOutCloudNetwork(de.dytanic.cloudnetcore.network.packet.out.PacketOutCloudNetwork) CloudNetwork(de.dytanic.cloudnet.lib.CloudNetwork)

Example 2 with CloudNetwork

use of de.dytanic.cloudnet.lib.CloudNetwork 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;
}
Also used : Catcher(de.dytanic.cloudnet.lib.utility.Catcher) MapWrapper(de.dytanic.cloudnet.lib.utility.MapWrapper) CollectionWrapper(de.dytanic.cloudnet.lib.utility.CollectionWrapper) ServerGroup(de.dytanic.cloudnet.lib.server.ServerGroup) SimpleServerGroup(de.dytanic.cloudnet.lib.server.SimpleServerGroup) WrapperInfo(de.dytanic.cloudnet.lib.network.WrapperInfo) CloudNetwork(de.dytanic.cloudnet.lib.CloudNetwork)

Example 3 with CloudNetwork

use of de.dytanic.cloudnet.lib.CloudNetwork in project CloudNet by Dytanic.

the class PacketInCloudNetwork method handleInput.

@Override
public void handleInput(Document data, PacketSender packetSender) {
    if (CloudAPI.getInstance() != null) {
        CloudNetwork cloudNetwork = data.getObject("cloudnetwork", NetworkUtils.cloudnet().getType());
        CloudAPI.getInstance().setCloudNetwork(cloudNetwork);
        CloudAPI.getInstance().getNetworkHandlerProvider().iterator(new Runnabled<NetworkHandler>() {

            @Override
            public void run(NetworkHandler obj) {
                obj.onCloudNetworkUpdate(cloudNetwork);
            }
        });
    }
}
Also used : NetworkHandler(de.dytanic.cloudnet.api.handlers.NetworkHandler) CloudNetwork(de.dytanic.cloudnet.lib.CloudNetwork)

Aggregations

CloudNetwork (de.dytanic.cloudnet.lib.CloudNetwork)3 NetworkHandler (de.dytanic.cloudnet.api.handlers.NetworkHandler)1 WrapperInfo (de.dytanic.cloudnet.lib.network.WrapperInfo)1 ServerGroup (de.dytanic.cloudnet.lib.server.ServerGroup)1 SimpleServerGroup (de.dytanic.cloudnet.lib.server.SimpleServerGroup)1 Catcher (de.dytanic.cloudnet.lib.utility.Catcher)1 CollectionWrapper (de.dytanic.cloudnet.lib.utility.CollectionWrapper)1 MapWrapper (de.dytanic.cloudnet.lib.utility.MapWrapper)1 PacketOutCloudNetwork (de.dytanic.cloudnetcore.network.packet.out.PacketOutCloudNetwork)1