Search in sources :

Example 1 with ScreenInfoEvent

use of de.dytanic.cloudnetcore.api.event.server.ScreenInfoEvent in project CloudNet by Dytanic.

the class PacketInSendScreenLine method handleInput.

@Override
public void handleInput(Document data, PacketSender packetSender) {
    Collection<ScreenInfo> screenInfos = data.getObject("screenInfo", new TypeToken<Collection<ScreenInfo>>() {
    }.getType());
    CloudNet.getInstance().getEventManager().callEvent(new ScreenInfoEvent(screenInfos));
    for (ScreenInfo screenInfo : screenInfos) {
        if (CloudNet.getInstance().getScreenProvider().getMainServiceId() != null && screenInfo.getServiceId().getServerId().equalsIgnoreCase(CloudNet.getInstance().getScreenProvider().getMainServiceId().getServerId()))
            System.out.println("[" + screenInfo.getServiceId().getServerId() + "] " + screenInfo.getLine());
    }
    CloudNet.getInstance().getNetworkManager().handleScreen(((INetworkComponent) packetSender), screenInfos);
}
Also used : INetworkComponent(de.dytanic.cloudnetcore.network.components.INetworkComponent) ScreenInfo(de.dytanic.cloudnet.lib.server.screen.ScreenInfo) TypeToken(com.google.gson.reflect.TypeToken) ScreenInfoEvent(de.dytanic.cloudnetcore.api.event.server.ScreenInfoEvent)

Aggregations

TypeToken (com.google.gson.reflect.TypeToken)1 ScreenInfo (de.dytanic.cloudnet.lib.server.screen.ScreenInfo)1 ScreenInfoEvent (de.dytanic.cloudnetcore.api.event.server.ScreenInfoEvent)1 INetworkComponent (de.dytanic.cloudnetcore.network.components.INetworkComponent)1