Ejemplo n.º 1
0
        private void OnCheckBanStatus(SteamPlayerID playerId, uint remoteIP, ref bool isBanned, ref string banReason, ref uint banRemainingDuration)
        {
            UnturnedPlayerCheckingBanEvent @event = new UnturnedPlayerCheckingBanEvent(playerId, remoteIP, isBanned, banReason, banRemainingDuration);

            Emit(@event);

            isBanned             = @event.IsBanned;
            banReason            = @event.Reason;
            banRemainingDuration = @event.RemainingDuration;
        }
Ejemplo n.º 2
0
        private void OnCheckBanStatus(SteamPlayerID playerId, uint remoteIP, ref bool isBanned, ref string banReason, ref uint banRemainingDuration) // lgtm [cs/too-many-ref-parameters]
        {
            var @event =
                new UnturnedPlayerCheckingBanEvent(playerId, remoteIP, isBanned, banReason, banRemainingDuration);

            Emit(@event);

            isBanned             = @event.IsBanned;
            banReason            = @event.Reason;
            banRemainingDuration = @event.RemainingDuration;
        }
Ejemplo n.º 3
0
        private void OnCheckBanStatus(SteamPlayerID playerId, uint remoteIp, ref bool isBanned, ref string banReason, ref uint banRemainingDuration) // lgtm [cs/too-many-ref-parameters]
        {
            if (!isBanned)
            {
                var banned   = isBanned;
                var duration = banRemainingDuration;
                var reason   = banReason;

                AsyncContext.Run(async() =>
                {
                    var userData = await m_UserDataStore.GetUserDataAsync(playerId.steamID.ToString(), KnownActorTypes.Player);
                    if (userData?.BanInfo?.ExpireDate == null)
                    {
                        return;
                    }

                    var dur = (userData.BanInfo.ExpireDate.Value - DateTime.Now).TotalSeconds;
                    if (dur < 0)
                    {
                        return;
                    }

                    banned   = true;
                    duration = dur > uint.MaxValue ? SteamBlacklist.PERMANENT : (uint)dur;
                    reason   = userData.BanInfo.Reason;
                });

                isBanned             = banned;
                banRemainingDuration = duration;
                banReason            = reason;
            }


            var @event =
                new UnturnedPlayerCheckingBanEvent(playerId, remoteIp, isBanned, banReason, banRemainingDuration);

            Emit(@event);

            isBanned             = @event.IsBanned;
            banReason            = @event.Reason;
            banRemainingDuration = @event.RemainingDuration;
        }