GetChannelUsers() public static méthode

public static GetChannelUsers ( string channel ) : List
channel string
Résultat List
Exemple #1
0
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Help(p);
         return;
     }
     else
     {
         string hasirc;
         string ircdetails = "";
         if (Server.irc)
         {
             hasirc     = "&aEnabled" + "&g.";
             ircdetails = Server.ircServer + " > " + Server.ircChannel;
         }
         else
         {
             hasirc = "&cDisabled" + "&g.";
         }
         Player.SendMessage(p, "IRC is " + hasirc);
         if (ircdetails != "")
         {
             Player.SendMessage(p, "Location: " + ircdetails);
             Player.SendMessage(p, "Current users in IRC channels:");
             string[] names = IRCBot.GetChannelUsers(Server.ircChannel).ToArray();
             Player.SendMessage(p, "(IRC) " + Server.ircChannel + ": " + (names.Length > 0 ? String.Join(", ", names) : "None"));
             if (p == null || (p != null && p.group.Permission > Server.opchatperm))
             {
                 names = IRCBot.GetChannelUsers(Server.ircOpChannel).ToArray();
                 Player.SendMessage(p, "(OP IRC) " + Server.ircOpChannel + ": " + (names.Length > 0 ? String.Join(", ", names) : "None"));
             }
         }
     }
 }
Exemple #2
0
        public override void Use(Player p, string message)
        {
            try
            {
                List <groups> playerList = new List <groups>();

                foreach (Group grp in Group.GroupList)
                {
                    if (grp.name != "nobody")
                    {
                        if (String.IsNullOrEmpty(message) || !Group.Exists(message))
                        {
                            groups groups;
                            groups.group   = grp;
                            groups.players = new List <string>();
                            playerList.Add(groups);
                        }
                        else
                        {
                            Group grp2 = Group.Find(message);
                            if (grp2 != null && grp == grp2)
                            {
                                groups groups;
                                groups.group   = grp;
                                groups.players = new List <string>();
                                playerList.Add(groups);
                            }
                        }
                    }
                }

                string devs       = "";
                string unverified = "";
                //string devUnverified = "";
                int totalPlayers = 0;
                foreach (Player pl in Player.players)
                {
                    if (pl.group.Permission == LevelPermission.Nobody && !Server.devs.Contains(pl.name.ToLower()))
                    {
                        continue;
                    }
                    if (p == null || !pl.hidden || p.group.Permission >= pl.group.Permission || Server.devs.Contains(p.name.ToLower()))
                    {
                        totalPlayers++;
                        string foundName = pl.name;

                        if (Server.afkset.Contains(pl.name))
                        {
                            foundName = pl.name + "-afk";
                        }

                        if (Server.devs.Contains(pl.name.ToLower()) && !pl.devUnverified && !pl.unverified)
                        {
                            if (pl.voice)
                            {
                                devs += " " + "&f+&g" + foundName + " (" + pl.level.name + "),";
                            }
                            else
                            {
                                devs += " " + foundName + " (" + pl.level.name + "),";
                            }
                        }
                        else if (pl.unverified || pl.devUnverified)
                        {
                            if (pl.voice)
                            {
                                unverified += " " + "&f+&g" + foundName + " (" + pl.level.name + "),";
                            }
                            else
                            {
                                unverified += " " + foundName + " (" + pl.level.name + "),";
                            }
                        }
                        else
                        {
                            if (pl.voice)
                            {
                                playerList.Find(grp => grp.group == pl.group).players.Add("&f+&g" + foundName + " (" + pl.level.name + ")");
                            }
                            else
                            {
                                playerList.Find(grp => grp.group == pl.group).players.Add(foundName + " (" + pl.level.name + ")");
                            }
                        }
                    }
                }
                Player.SendMessage(p, "There are " + totalPlayers + " players online" +
                                   (Server.irc ? (" (" + IRCBot.GetChannelUsers(Server.ircChannel).Count + " users on IRC" +
                                                  ((p == null || (p != null && p.group.Permission > Server.opchatperm)) ? ", " +
                                                   IRCBot.GetChannelUsers(Server.ircOpChannel).Count + " users on OP IRC" : "") + ")") : "") + ".");
                if (devs.Length > 0)
                {
                    Player.SendMessage(p, ":&9Developers:&g" + devs.Trim(','));
                }
                for (int i = playerList.Count - 1; i >= 0; i--)
                {
                    groups groups       = playerList[i];
                    string appendString = "";

                    foreach (string player in groups.players)
                    {
                        appendString += ", " + player;
                    }

                    if (appendString != "")
                    {
                        appendString = appendString.Remove(0, 2);
                    }
                    appendString = ":" + groups.group.color + getPlural(groups.group.trueName) + ": " + appendString;

                    Player.SendMessage(p, appendString);
                }
                if (unverified.Length > 0)
                {
                    Player.SendMessage(p, ":&3Admin Security System:&g" + unverified.Trim(','));
                }
                //if (devUnverified.Length > 0) { Player.SendMessage(p, ":&3Developer Security System:&g" + unverified.Trim(',')); }
                if (Server.irc)
                {
                    Player.SendMessage(p, ":" + Server.IRCColour + "IRC: " + String.Join(", ", IRCBot.GetChannelUsers(Server.ircChannel).ToArray()).Trim());
                    if (p == null || (p != null && p.group.Permission > Server.opchatperm))
                    {
                        Player.SendMessage(p, ":" + Server.IRCColour + "OP IRC: " + String.Join(", ", IRCBot.GetChannelUsers(Server.ircOpChannel).ToArray()).Trim());
                    }
                }
            }
            catch (Exception e) { Server.ErrorLog(e); }
        }