Exemple #1
0
        public override void Load()
        {
            // Setup thread
            tGame = new Thread(new ThreadStart(delegate()
            {
                while (RunThread)
                {
                    ServerEvents.RunThreadTick();
                }
            }));

            // Setup events
            Provider.onEnemyConnected          += new Provider.EnemyConnected(ServerEvents.RunPlayerConnected);
            Provider.onEnemyDisconnected       += new Provider.EnemyDisconnected(ServerEvents.RunPlayerDisconnected);
            Provider.onServerShutdown          += new Provider.ServerShutdown(ServerEvents.RunServerShutdown);
            Provider.onServerHosted            += new Provider.ServerHosted(ServerEvents.RunServerInitialized);
            LightingManager.onDayNightUpdated  += new DayNightUpdated(ServerEvents.RunDayNight);
            LightingManager.onMoonUpdated      += new MoonUpdated(ServerEvents.RunFullMoon);
            LightingManager.onRainUpdated      += new RainUpdated(ServerEvents.RunRainUpdated);
            StructureEvents.OnDestroyStructure += new StructureEvents.StructureDestroyHandler(ServerEvents.RunStructureRemoved);
            StructureEvents.OnSalvageStructure += new StructureEvents.StructureDestroyHandler(ServerEvents.RunStructureRemoved);
            BarricadeEvents.OnBarricadeDestroy += new BarricadeEvents.BarricadeDestroyHandler(ServerEvents.RunBarricadeRemoved);
            BarricadeEvents.OnBarricadeSalvage += new BarricadeEvents.BarricadeDestroyHandler(ServerEvents.RunBarricadeRemoved);

            CommandWindow.onCommandWindowInputted += new CommandWindowInputted(OnConsoleCommand);
            ChatManager.onCheckPermissions        += new CheckPermissions(OnUnturnedCommand);

            // Setup pointblank events
            ServerEvents.OnPlayerConnected        += new ServerEvents.PlayerConnectionHandler(OnPlayerJoin);
            ServerEvents.OnPlayerDisconnected     += new ServerEvents.PlayerConnectionHandler(OnPlayerLeave);
            ChatManager.onChatted                 += new Chatted(OnPlayerChat);
            PlayerEvents.OnInvisiblePlayerAdded   += new PlayerEvents.InvisiblePlayersChangedHandler(OnSetInvisible);
            PlayerEvents.OnInvisiblePlayerRemoved += new PlayerEvents.InvisiblePlayersChangedHandler(OnSetVisible);
            PluginEvents.OnPluginsLoaded          += new VoidHandler(OnPluginsLoaded);
            ServerEvents.OnServerInitialized      += new OnVoidDelegate(OnServerInitialized);
            ServerEvents.OnPacketSent             += new ServerEvents.PacketSentHandler(OnPacketSend);
            PlayerEvents.OnPrefixAdded            += new PlayerEvents.PrefixesChangedHandler(OnPrefixChange);
            PlayerEvents.OnPrefixRemoved          += new PlayerEvents.PrefixesChangedHandler(OnPrefixChange);
            PlayerEvents.OnSuffixAdded            += new PlayerEvents.SuffixesChangedHandler(OnSuffixChange);
            PlayerEvents.OnSuffixRemoved          += new PlayerEvents.SuffixesChangedHandler(OnSuffixChange);
            PlayerEvents.OnGroupAdded             += new PlayerEvents.GroupsChangedHandler(OnGroupChange);
            PlayerEvents.OnGroupRemoved           += new PlayerEvents.GroupsChangedHandler(OnGroupChange);
            PlayerEvents.OnPlayerDied             += new PlayerEvents.PlayerDeathHandler(OnPlayerDie);
            PlayerEvents.OnPlayerKill             += new PlayerEvents.PlayerKillHandler(OnPlayerKill);

            // Run code
            tGame.Start();
        }