Package __deprecated.server

Source Code of __deprecated.server.SendObject

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;
      }
    } 
  }
}
TOP

Related Classes of __deprecated.server.SendObject

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.