package voxo.server.actions;
import java.io.IOException;
import java.net.UnknownHostException;
import voxo.common.entities.Packet;
import voxo.common.entities.User;
import voxo.common.enums.EnumPacket;
import voxo.server.services.NetworkService;
public class SendMessageAction {
public SendMessageAction(String m, User u, EnumPacket ep) throws UnknownHostException, IOException {
if (u.getOnline() && (u.getIp() != null)) {
if ((ep != EnumPacket.SERVER_Notice) && (ep != EnumPacket.SERVER_Error)) {
return;
}
NetworkService.sendPacket(u.getIp(), new Packet(ep, m));
}
}
}