//<?php

/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	exit;
}

class chatbox_hook_Club extends _HOOK_CLASS_
{

	public static function availableNodeTypes( \IPS\Member $member = NULL )
	{
		try
		{
			$return = parent::availableNodeTypes($member);
			
			if ( \IPS\Settings::i()->room_clubs != 1 )
			{
				foreach( $return as $k => $v )
				{
					if ( $v == "IPS\chatbox\Rooms\Room" )
					{
						unset( $return[ $k ] );
						break;
					}
				}
			}
	
			return $return;
		}
		catch ( \Error | \RuntimeException $e )
		{
			if ( method_exists( get_parent_class(), __FUNCTION__ ) )
			{
				return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
			}
			else
			{
				throw $e;
			}
		}
	}
	
	public function nodes()
	{
		try
		{
			$return = parent::nodes();
			
			if ( \IPS\Settings::i()->room_clubs != 1 )
			{
				foreach( $return as $k => $v )
				{
					if ( $v['node_class'] == "IPS\chatbox\Rooms\Room" )
					{
						unset( $return[ $k ] );
						break;
					}
				}
			}		
			
			return $return;
			}
			catch ( \Error | \RuntimeException $e )
			{
				if ( method_exists( get_parent_class(), __FUNCTION__ ) )
				{
					return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
				}
				else
				{
					throw $e;
				}
			}
	}	
}
