Search in sources :

Example 1 with ScreenInfo

use of de.dytanic.cloudnet.lib.server.screen.ScreenInfo in project CloudNet by Dytanic.

the class ScreenLoader method run.

@Override
public void run() {
    this.thread = Thread.currentThread();
    String input;
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(screenable.getInstance().getInputStream(), StandardCharsets.UTF_8));
    try {
        while ((input = bufferedReader.readLine()) != null) {
            CloudNetWrapper.getInstance().getNetworkConnection().sendPacket(new PacketOutSendScreenLine(Arrays.asList(new ScreenInfo(screenable.getServiceId(), input))));
        }
    } catch (IOException e) {
    }
}
Also used : PacketOutSendScreenLine(de.dytanic.cloudnetwrapper.network.packet.out.PacketOutSendScreenLine) ScreenInfo(de.dytanic.cloudnet.lib.server.screen.ScreenInfo)

Example 2 with ScreenInfo

use of de.dytanic.cloudnet.lib.server.screen.ScreenInfo 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

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