package sfs.cluster.lobby.handlers.cluster;

import it.gotoandplay.smartfoxserver.SmartFoxServer;
import it.gotoandplay.smartfoxserver.data.Zone;
import it.gotoandplay.smartfoxserver.extensions.AbstractExtension;

import java.util.logging.Logger;

import sfs.cluster.lobby.ClusterLobbyExtension;
import sfs.cluster.lobby.data.ClusterEvent;

/**
 * This event is received after a game room has been created on another game node
 */
public class OnRoomCreated implements IClusterEvtHandler
{
	ClusterLobbyExtension parentExtension;
	Logger log;
	Zone zone;
	
	public OnRoomCreated(AbstractExtension parentExtension)
    {
	    this.parentExtension = (ClusterLobbyExtension) parentExtension;
	    this.zone = SmartFoxServer.getInstance().getZone(parentExtension.getOwnerZone());
	    log = SmartFoxServer.log;
    }
	
	public void handleClusterEvent(ClusterEvent event) throws Exception
	{
	    parentExtension.updateGameList(
	    								(String) event.getParams().get("gameType"), 
	    								(String) event.getParams().get("gameName")
	    							);
	    
	}
}
