public void Initialise(Scene scene, IConfigSource source)
        {
            m_scene = scene;
            m_landIDList.Initialize();
            landChannel = new LandChannel(scene, this);

            parcelInfoCache = new Cache();
            parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache
            parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0);

            m_scene.EventManager.OnParcelPrimCountAdd += AddPrimToLandPrimCounts;
            m_scene.EventManager.OnParcelPrimCountUpdate += UpdateLandPrimCounts;
            m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(handleAvatarChangingParcel);
            m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(handleAnyClientMovement);
            m_scene.EventManager.OnValidateLandBuy += handleLandValidationRequest;
            m_scene.EventManager.OnLandBuy += handleLandBuyRequest;
            m_scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient);
            m_scene.EventManager.OnSignificantClientMovement += handleSignificantClientMovement;
            m_scene.EventManager.OnObjectBeingRemovedFromScene += RemovePrimFromLandPrimCounts;

            m_scene.EventManager.OnNoticeNoLandDataFromStorage += this.NoLandDataFromStorage;
            m_scene.EventManager.OnIncomingLandDataFromStorage += this.IncomingLandObjectsFromStorage;
            m_scene.EventManager.OnSetAllowForcefulBan += this.SetAllowedForcefulBans;
            m_scene.EventManager.OnRequestParcelPrimCountUpdate += this.PerformParcelPrimCountUpdate;
            m_scene.EventManager.OnParcelPrimCountTainted += this.SetPrimsTainted;
            m_scene.EventManager.OnRegisterCaps += this.OnRegisterCaps;

            lock (m_scene)
            {
                m_scene.LandChannel = (ILandChannel)landChannel;
            }
        }
        public void AddRegion(Scene scene)
        {
            m_scene = scene;
            m_landIDList.Initialize();
            landChannel = new LandChannel(scene, this);

            parcelInfoCache = new Cache();
            parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache
            parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0);

            m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
            m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
            m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;            
            m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
            
            m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
            m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement;
            m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy;
            m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy;
            m_scene.EventManager.OnNewClient += EventManagerOnNewClient;
            m_scene.EventManager.OnMakeChildAgent += EventMakeChildAgent;
            m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement;
            m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage;
            m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
            m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan;            
            m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
            m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;

            lock (m_scene)
            {
                m_scene.LandChannel = (ILandChannel)landChannel;
            }
            
            InstallInterfaces();
        }
        public void AddRegion(Scene scene)
        {
            m_scene = scene;
            m_landIDList.Initialize();

            if (m_UpdateDirectoryOnTimer)
            {
                m_UpdateDirectoryTimer.Interval = 1000 * 60 * m_minutesBeforeTimer;
                m_UpdateDirectoryTimer.Elapsed += UpdateDirectoryTimerElapsed;
                m_UpdateDirectoryTimer.Start();
            }

            landChannel = new LandChannel(scene, this);

            parcelInfoCache = new Cache();
            parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache
            parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0);

            m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
            m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
            m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
            m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement;
            m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy;
            m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy;
            m_scene.EventManager.OnNewClient += EventManagerOnNewClient;
            m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement;
            m_scene.EventManager.OnSignificantObjectMovement += EventManagerOnSignificantObjectMovement;
            m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
            m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
            m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan;
            m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
            m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted;
            m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
            m_scene.EventManager.OnLandObjectAdded += AddLandObject;
            m_scene.EventManager.OnClientMovement += EventManager_OnClientMovement;
            m_scene.EventManager.OnClosingClient += OnClosingClient;

            lock (m_scene)
            {
                m_scene.LandChannel = (ILandChannel)landChannel;
            }
        }
        public void Initialize(Scene scene, IConfigSource config)
        {
            m_scene = scene;
            m_landIDList.Initialize();
            landChannel = new LandChannel(scene, this);

            parcelInfoCache = new Cache();
            parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache
            parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0);

            m_scene.EventManager.OnParcelPrimCountAdd += AddPrimToLandPrimCounts;
            m_scene.EventManager.OnParcelPrimCountUpdate += UpdateLandPrimCounts;
            m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(handleAvatarChangingParcel);
            m_scene.EventManager.OnValidateLandBuy += handleLandValidationRequest;
            m_scene.EventManager.OnLandBuy += handleLandBuyRequest;
            m_scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient);
            m_scene.EventManager.OnSignificantClientMovement += handleSignificantClientMovement;
            m_scene.EventManager.OnObjectBeingRemovedFromScene += RemovePrimFromLandPrimCounts;

            m_scene.EventManager.OnNoticeNoLandDataFromStorage += this.NoLandDataFromStorage;
            m_scene.EventManager.OnIncomingLandDataFromStorage += this.IncomingLandObjectsFromStorage;
            m_scene.EventManager.OnSetAllowForcefulBan += this.SetAllowedForcefulBans;
            m_scene.EventManager.OnRequestParcelPrimCountUpdate += this.PerformParcelPrimCountUpdate;
            m_scene.EventManager.OnParcelPrimCountTainted += this.SetPrimsTainted;
            m_scene.EventManager.OnRegisterCaps += this.OnRegisterCaps;

            IConfig myConfig = config.Configs["Startup"];
            string connstr = myConfig.GetString("core_connection_string", String.Empty);
            _rdbConnectionTemplate = myConfig.GetString("rdb_connection_template", String.Empty);
            _rdbConnectionTemplateDebug = myConfig.GetString("rdb_connection_template_debug", String.Empty);
            _connFactory = new ConnectionFactory("MySQL", connstr);

            CacheRdbHosts();

            lock (m_scene)
            {
                m_scene.LandChannel = (ILandChannel)landChannel;
            }
        }
        public void AddRegion(Scene scene)
        {
            m_scene = scene;
            m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
            landChannel = new LandChannel(scene, this);

            parcelInfoCache = new ThreadedClasses.ExpiringCache<string, ExtendedLandData>(new TimeSpan(0, 5, 0));

            m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
            m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
            m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;            
            m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
            
            m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
            m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement;
            m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy;
            m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy;
            m_scene.EventManager.OnNewClient += EventManagerOnNewClient;
            m_scene.EventManager.OnMakeChildAgent += EventMakeChildAgent;
            m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement;
            m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage;
            m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
            m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan;            
            m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;

            m_landListRwLock.AcquireWriterLock(-1);
            try
            {
                m_scene.LandChannel = (ILandChannel)landChannel;
            }
            finally
            {
                m_landListRwLock.ReleaseWriterLock();
            }
            
            RegisterCommands();
        }