private void CmdPlayerInfo(IPlayer player, string cmd, string[] args)
        {
            IPlayer target;

            if (args.Length == 0 || !player.HasPermission(AdminPermission))
            {
                target = player;
            }
            else
            {
                target = FindPlayer(args[0], player);
            }

            if (target == null)
            {
                return;
            }

            var information = PlayerInformation.Get(target.Id);

            if (information == null)
            {
                player.Reply(GetMessage("Player Has No Info", player.Id));
            }
            else
            {
                string msg = GetMessage("Player Info", player.Id);

                msg = msg.Replace("{player}", $"{information.Name} ({information.Id})");
                msg = msg.Replace("{groups}", string.Join(", ", (from g in information.Groups select $"{g.Value} until {g.ExpireDate.ToLongDateString() + " " + g.ExpireDate.ToShortTimeString()} UTC").ToArray()));
                msg = msg.Replace("{permissions}", string.Join(", ", (from p in information.Permissions select $"{p.Value} until {p.ExpireDate.ToLongDateString() + " " + p.ExpireDate.ToShortTimeString()} UTC").ToArray()));

                player.Reply(msg);
            }
        }
        private void CmdRemoveGroup(IPlayer player, string cmd, string[] args)
        {
            if (args.Length != 2)
            {
                player.Reply(GetMessage("Syntax : removegroup", player.Id));
                return;
            }

            IPlayer target = FindPlayer(args[0], player);

            if (target == null)
            {
                return;
            }

            PlayerInformation information = PlayerInformation.Get(target.Id);

            if (information == null || !information.Groups.Any(p => p.Value == args[1].ToLower()))
            {
                player.Reply(GetMessage("User Isn't In Group", player.Id).Replace("{target}", target.Name).Replace("{group}", args[1].ToLower()));
                return;
            }

            information.RemoveGroup(args[1].ToLower());
        }
        private void CmdRevokePerm(IPlayer player, string cmd, string[] args)
        {
            if (args.Length != 2)
            {
                player.Reply(GetMessage("Syntax : revokeperm", player.Id));
                return;
            }

            IPlayer target = FindPlayer(args[0], player);

            if (target == null)
            {
                return;
            }

            PlayerInformation information = PlayerInformation.Get(target.Id);

            if (information == null || !information.Permissions.Any(p => p.Value == args[1].ToLower()))
            {
                player.Reply(GetMessage("User Doesn't Have Permission", player.Id).Replace("{target}", target.Name).Replace("{permission}", args[1].ToLower()));
                return;
            }

            information.RemovePermission(args[1].ToLower());
        }
 private void OnUserConnected(IPlayer player)
 {
     PlayerInformation.Get(player.Id)?.EnsureAllAccess();
 }