package __deprecated.server;
import java.io.IOException;
import java.util.Iterator;
import org.quickserver.net.server.ClientHandler;
import org.quickserver.net.server.DataMode;
import org.quickserver.net.server.DataType;
import server.constants.Messages;
import server.protocol.GameRoom;
import server.protocol.Message;
public class SendObject{
public void send(ClientHandler handler, GameRoom room,
String objects) throws IOException {
@SuppressWarnings("rawtypes")
Iterator iterator = room.getClients().iterator();
ClientHandler toHandler = null;
while (iterator.hasNext()) {
toHandler = (ClientHandler) iterator.next();
toHandler.getObjectOutputStream().reset();
toHandler.setDataMode(DataMode.OBJECT, DataType.OUT);
switch (objects) {
case "BOTH":
toHandler.sendClientObject(room.getGameSheet());
toHandler.sendClientObject(room.getDice());
break;
case "DICE":
toHandler.sendClientObject(room.getDice());
if (toHandler != handler) {
toHandler.sendClientObject(new Message(Messages.ROLLMSG(
"test", room.getDice().getDiceValues().toString())));
}
break;
case "GAMESHEET":
toHandler.sendClientObject(room.getGameSheet());
break;
default:
break;
}
}
}
}