use of de.dytanic.cloudnet.lib.network.protocol.packet.Packet in project CloudNet by Dytanic.
the class CloudNetClient method channelRead0.
@Override
protected void channelRead0(ChannelHandlerContext channelHandlerContext, Object obj) throws Exception {
if (!(obj instanceof Packet))
return;
CloudNet.getLogger().debug("Receiving Packet on " + getChannel().remoteAddress().toString());
Packet packet = (Packet) obj;
CloudNet.getInstance().getPacketManager().dispatchPacket(packet, networkComponent);
}
use of de.dytanic.cloudnet.lib.network.protocol.packet.Packet in project CloudNet by Dytanic.
the class PacketInCopyDirectory method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
if (!data.contains("serverInfo") || !data.contains("directory"))
return;
ServerInfo info = data.getObject("serverInfo", ServerInfo.TYPE);
Wrapper wrapper = CloudNet.getInstance().getWrappers().get(info.getServiceId().getWrapperId());
if (wrapper != null && wrapper.getChannel() != null)
wrapper.sendPacket(new Packet(PacketRC.CN_CORE + 14, data));
}
use of de.dytanic.cloudnet.lib.network.protocol.packet.Packet in project CloudNet by Dytanic.
the class NetDispatcher method channelRead0.
@Override
protected void channelRead0(ChannelHandlerContext channelHandlerContext, Object o) throws Exception {
if (o instanceof Packet) {
TaskScheduler.runtimeScheduler().schedule(new Runnable() {
@Override
public void run() {
networkConnection.getPacketManager().dispatchPacket(((Packet) o), networkConnection);
}
});
} else {
if (o instanceof FileDeploy) {
FileDeploy deploy = ((FileDeploy) o);
TaskScheduler.runtimeScheduler().schedule(new Runnable() {
@Override
public void run() {
deploy.toWrite();
}
});
}
}
}
use of de.dytanic.cloudnet.lib.network.protocol.packet.Packet in project CloudNet by Dytanic.
the class PacketAPIInGetPlayers method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
Packet packet = getResult(new Document().append("players", CloudNet.getInstance().getNetworkManager().getOnlinePlayers().values()));
packetSender.sendPacket(packet);
}
use of de.dytanic.cloudnet.lib.network.protocol.packet.Packet in project CloudNet by Dytanic.
the class PacketAPIInGetStatistic method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
Packet packet = getResult(StatisticManager.getInstance().getStatistics());
packetSender.sendPacket(packet);
}
Aggregations