package sfs.cluster.lobby.handlers.internal;

import it.gotoandplay.smartfoxserver.SmartFoxServer;
import it.gotoandplay.smartfoxserver.events.InternalEventObject;
import it.gotoandplay.smartfoxserver.extensions.AbstractExtension;

import java.util.logging.Logger;

import sfs.cluster.lobby.ClusterGameServerExtension;
import sfs.cluster.lobby.DataStore;

/**
 * Handles the removal of a game room in a game-server node
 */
public class GameRoomLostHandler implements InternalHandler
{
	ClusterGameServerExtension parentExtension;
	Logger log;
	
	public GameRoomLostHandler(AbstractExtension parentExtension)
    {
	    this.parentExtension = (ClusterGameServerExtension) parentExtension;
	    log = SmartFoxServer.log;
    }
	
	public void handleInternalEvent(InternalEventObject ieo) throws Exception
	{
		/*
		 * Remove from DataStore
		 */
		Integer roomId = Integer.parseInt(ieo.getParam("roomId"));
		DataStore.instance().removeGameRoom(roomId);
	}
}
