Package server.commands.methods

Source Code of server.commands.methods.SendDice

package server.commands.methods;

import java.io.IOException;
import java.util.Iterator;

import org.quickserver.net.server.ClientHandler;

import server.protocol.GameRoom;

/**
* The Class SendDice. Handles the dice-sending.
*/
public class SendDice {

  /**
   * Sends the dice.
   *
   * @param handler the handler
   * @param room the room
   * @throws IOException Signals that an I/O exception has occurred.
   */
  public void send(ClientHandler handler, GameRoom room) throws IOException {
    Iterator<ClientHandler> iterator = room.getClients().iterator();
    ClientHandler toHandler = null;
    while (iterator.hasNext()) {
      toHandler = (ClientHandler) iterator.next();
      toHandler.getObjectOutputStream().reset();
      toHandler.sendClientObject(room.getDice());
    }
  }

}
TOP

Related Classes of server.commands.methods.SendDice

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.