package sfs3.extensions.examples.shooter.utils;

import com.smartfoxserver.entities.Room;
import com.smartfoxserver.extensions.BaseClientRequestHandler;
import com.smartfoxserver.extensions.BaseServerEventHandler;
import com.smartfoxserver.extensions.SFSExtension;

import sfs3.extensions.examples.shooter.ShooterExtension;
import sfs3.extensions.examples.shooter.simulation.World;

// Helper methods to easily get current room or zone and precache the link to ExtensionHelper
public class RoomHelper
{
	public static Room getCurrentRoom(BaseClientRequestHandler handler)
	{
		return handler.getParentExtension().getParentRoom();
	}

	public static Room getCurrentRoom(SFSExtension extension)
	{
		return extension.getParentRoom();
	}

	public static World getWorld(BaseClientRequestHandler handler)
	{
		ShooterExtension ext = (ShooterExtension) handler.getParentExtension();
		return ext.getWorld();
	}

	public static World getWorld(BaseServerEventHandler handler)
	{
		ShooterExtension ext = (ShooterExtension) handler.getParentExtension();
		return ext.getWorld();
	}
}
