Package server.commands.methods

Source Code of server.commands.methods.SendLeaderboard

package server.commands.methods;

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

import org.quickserver.net.server.ClientHandler;

import server.protocol.GameRoom;

/**
* The Class SendLeaderboard. Handles the sending leaderboard.
*/
public class SendLeaderboard {

  /**
   * Sends the leaderboard.
   *
   * @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 {
    @SuppressWarnings("rawtypes")
    Iterator iterator = handler.getServer().findAllClient();
    ClientHandler toHandler = null;
    while (iterator.hasNext()) {
      toHandler = (ClientHandler) iterator.next();
      toHandler.getObjectOutputStream().reset();
      toHandler.sendClientObject(room.getLeaderboard());
    }
  }

}
TOP

Related Classes of server.commands.methods.SendLeaderboard

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.