public static DGAdmin.GroupsDatabase.Group GetGroup(this Entity entity, DGAdmin.GroupsDatabase database)
        {
            KeyValuePair <DGAdmin.PlayerInfo, string>?playerFromGroups = database.FindEntryFromPlayersAND(entity.GetInfo());

            if (playerFromGroups == null)
            {
                return(database.GetGroup("default"));
            }
            DGAdmin.GroupsDatabase.Group grp = database.GetGroup(playerFromGroups.Value.Value);
            if (grp != null)
            {
                return(grp);
            }
            else
            {
                DGAdmin.WriteLog.Error("# Player " + entity.Name + ": GUID=" + entity.GUID + ", HWID = " + entity.GetHWID().ToString());
                DGAdmin.WriteLog.Error("# Is in nonexistent group: " + playerFromGroups);
                return(database.GetGroup("default"));
            }
        }
        public static string GetFormattedName(this Entity player, DGAdmin.GroupsDatabase database)
        {
            DGAdmin.GroupsDatabase.Group grp = player.GetGroup(database);
            var alias = "";

            if (DGAdmin.ChatAlias.Keys.Contains(player.GUID))
            {
                alias = DGAdmin.ChatAlias[player.GUID];
            }
            if (!string.IsNullOrWhiteSpace(grp.short_name))
            {
                return(DGAdmin.Lang_GetString("FormattedNameRank").Format(new Dictionary <string, string>()
                {
                    { "<shortrank>", grp.short_name },
                    { "<rankname>", grp.group_name },
                    { "<name>", (alias != "")?alias : player.Name },
                }));
            }
            return(DGAdmin.Lang_GetString("FormattedNameRankless").Format(new Dictionary <string, string>()
            {
                { "<name>", (alias != "")?alias : player.Name },
            }));
        }