Example #1
0
        public override void Dispose()
        {
            channel.RemoveRemoteEvent("Server_SetBlock");
            channel.RemoveRemoteEvent("Server_ThrowGrenade");
            channel.RemoveRemoteEvent("Server_ShootMelon");

            objectComponent.OnCreatableInstantiated   -= ObjectComponent_OnCreatableInstantiated;
            objectComponent.OnCreatableDestroyed      -= ObjectComponent_OnCreatableDestroyed;
            snapshotComponent.OnWorldSnapshotOutbound -= Server_OnWorldSnapshotOutbound;
            base.Dispose();
        }
        public override void Dispose()
        {
            // Dipose of each player (correctly removes and lights associated with them as well)
            foreach (Player player in players.Values)
            {
                player.Dispose();
            }

            // Remove instantiation events
            objectComponent.RemoveInstantiationEvent("Client_CreatePlayer");

            // Remove remotes
            channel.RemoveRemoteEvent("Client_ThrowGrenade");
            channel.RemoveRemoteEvent("Client_ShootMelon");
            channel.RemoveRemoteEvent("Client_ServerImpact");
            channel.RemoveRemoteEvent("Client_RolledBackServerPlayer");

            // Unhook component events
            objectComponent.OnCreatableInstantiated  -= ObjectComponent_OnCreatableInstantiated;
            objectComponent.OnCreatableDestroyed     -= ObjectComponent_OnCreatableDestroyed;
            snapshotComponent.OnWorldSnapshotInbound -= SnapshotComponent_OnWorldSnapshotInbound;

            base.Dispose();
        }