use of com.github.dirtpowered.dirtmv.session.MultiSession in project DirtMultiversion by DirtPowered.
the class ServerSession method broadcastPacket.
@SneakyThrows
public void broadcastPacket(PacketData packetData, MinecraftVersion from) {
for (MultiSession entry : main.getSessionRegistry().getSessions().values()) {
if (entry != null) {
ServerSession serverSession = entry.getServerSession();
if (!(serverSession.userData.getClientVersion().getRegistryId() >= from.getRegistryId())) {
return;
}
serverSession.sendPacket(packetData, PacketDirection.TO_CLIENT, from);
}
}
}
use of com.github.dirtpowered.dirtmv.session.MultiSession in project DirtMultiversion by DirtPowered.
the class ClientSession method channelActive.
@Override
public void channelActive(ChannelHandlerContext ctx) {
Logger.info("[{}] connected to remote server", serverSession.getLogTag());
serverSession.getMain().getSessionRegistry().addSession(key, new MultiSession(this, serverSession));
callback.onComplete();
}
use of com.github.dirtpowered.dirtmv.session.MultiSession in project DirtMultiversion by DirtPowered.
the class Server method getAllConnections.
@Override
public List<UserData> getAllConnections() {
List<UserData> list = new ArrayList<>();
for (MultiSession entry : main.getSessionRegistry().getSessions().values()) {
UserData userData = entry.getServerSession().getUserData();
list.add(userData);
}
return list;
}
Aggregations