Esempio n. 1
0
        public override void Load(bool startup)
        {
            command = new CmdCustomModel();
            Command.Register(command);

            OnPlayerConnectEvent.Register(OnPlayerConnect, Priority.Low);
            OnPlayerDisconnectEvent.Register(OnPlayerDisconnect, Priority.Low);
            OnJoiningLevelEvent.Register(OnJoiningLevel, Priority.Low);
            OnJoinedLevelEvent.Register(OnJoinedLevel, Priority.Low);
            OnSendingModelEvent.Register(OnSendingModel, Priority.Low);
            OnPlayerCommandEvent.Register(OnPlayerCommand, Priority.Low);
            // OnEntitySpawnedEvent.Register(OnEntitySpawned, Priority.Low);

            Directory.CreateDirectory(PublicModelsDirectory);
            Directory.CreateDirectory(PersonalModelsDirectory);

            int numModels         = CreateMissingCCModels(false);
            int numPersonalModels = CreateMissingCCModels(true);

            Logger.Log(
                LogType.SystemActivity,
                "CustomModels Loaded with {0} Models and {1} Personal Models",
                numModels,
                numPersonalModels
                );

            // initialize because of a late plugin load
            foreach (Player p in PlayerInfo.Online.Items)
            {
                SentCustomModels.TryAdd(p.name, new HashSet <string>(StringComparer.OrdinalIgnoreCase));
                ModelNameToIdForPlayer.TryAdd(p.name, new ConcurrentDictionary <string, byte>(StringComparer.OrdinalIgnoreCase));
            }
        }
Esempio n. 2
0
        protected override void HookEventHandlers()
        {
            OnEntitySpawnedEvent.Register(HandleEntitySpawned, Priority.High);
            OnTabListEntryAddedEvent.Register(HandleTabListEntryAdded, Priority.High);
            OnMoneyChangedEvent.Register(HandleMoneyChanged, Priority.High);
            OnBlockChangeEvent.Register(HandleBlockChange, Priority.High);
            OnSendingModelEvent.Register(HandleSendingModel, Priority.High);

            OnPlayerConnectEvent.Register(HandlePlayerConnect, Priority.High);
            OnPlayerMoveEvent.Register(HandlePlayerMove, Priority.High);
            OnPlayerSpawningEvent.Register(HandlePlayerSpawning, Priority.High);
            OnJoinedLevelEvent.Register(HandleJoinedLevel, Priority.High);
            OnPlayerChatEvent.Register(HandlePlayerChat, Priority.High);

            base.HookEventHandlers();
        }