Ejemplo n.º 1
0
 public static PlayerList Load(bool AgreeToRules)
 {
     string path = "text/agreedtorules.txt";
     if (!Directory.Exists("text")) { Directory.CreateDirectory("text"); }
     PlayerList list = new PlayerList();
     list.group = null;
     if (File.Exists(path))
     {
         foreach (string line in File.ReadAllLines(path)) { list.Add(line); }
     }
     else
     {
         File.Create(path).Close();
     } return list;
 }
Ejemplo n.º 2
0
 public static PlayerList GCIgnoreLoad()
 {
     string path = "text/ignoreglobal.txt";
     if (!Directory.Exists("text")) { Directory.CreateDirectory("text"); }
     PlayerList list = new PlayerList();
     list.group = null;
     list.Clear();
     if (File.Exists(path))
     {
         foreach (string line in File.ReadAllLines(path)) { list.Add(line); }
     }
     else
     {
         File.Create(path).Close();
     } return list;
 }
Ejemplo n.º 3
0
 public static PlayerList Load(string path, Group groupName)
 {
     if (!Directory.Exists("ranks")) { Directory.CreateDirectory("ranks"); }
     path = "ranks/" + path;
     PlayerList list = new PlayerList();
     list.group = groupName;
     if (File.Exists(path))
     {
         foreach (string line in File.ReadAllLines(path)) { list.Add(line); }
     }
     else
     {
         File.Create(path).Close();
         Server.s.Log("CREATED NEW: " + path);
     } return list;
 }
Ejemplo n.º 4
0
        public override void Use(Player p, string message)
        {
            if (p == null)
            {
                p.SendMessage("Command not usable in Console."); return;
            }
            if (message == "" || message.Split(' ').Length > 2)
            {
                Help(p); return;
            }
            switch (message.Split(' ')[0].ToLower())
            {
            case "global":
                if (message.Split(' ').Length > 1)
                {
                    goto default;
                }
                if (!Server.ignoreGlobal.Contains(p.name.ToLower()))
                {
                    Server.ignoreGlobal.Add(p.name.ToLower());
                    p.SendMessage("You are now ignoring incoming chat messages from Global Chat.");
                }
                else
                {
                    Server.ignoreGlobal.Remove(p.name.ToLower());
                    p.SendMessage("You are no longer ignoring incoming chat messages from Global Chat.");
                }
                Server.ignoreGlobal.GCIgnoreSave();
                Server.ignoreGlobal = PlayerList.GCIgnoreLoad();
                break;

            default:
                Player who     = Player.Find(message.Split(' ')[0]);
                string ignored = "";
                if (who != null)
                {
                    ignored = who.name;
                }
                else
                {
                    ignored = message.Split(' ')[0];
                }

                if (Server.allowIgnoreOps && (Server.hasProtection(name)) || who.group.Permission >= LevelPermission.Operator || Group.findPlayerGroup(ignored).Permission >= LevelPermission.Operator)
                {
                    Player.SendMessage(p, "Cannot ignore operators."); return;
                }

                if (p.ignoreList.Contains(ignored.ToLower()))
                {
                    Player.IgnoreRemove(p, ignored.ToLower());
                    p.SendMessage("You are no longer ignoring incoming chat messages from " + ignored + ".");
                }
                else
                {
                    foreach (Group gr in Group.GroupList)
                    {
                        if (gr.playerList.Contains(ignored.ToLower()) && gr.Permission >= LevelPermission.Operator && !Server.allowIgnoreOps || Server.devs.Contains(ignored.ToLower()) || Server.staff.Contains(ignored.ToLower()) || Server.administration.Contains(ignored.ToLower()))
                        {
                            p.SendMessage("You can't ignore a " + who.group.trueName + "."); return;
                        }
                    }
                    Player.IgnoreAdd(p, ignored.ToLower());
                    p.SendMessage("You are now ignoring incoming chat messages from " + ignored + ".");
                }
                break;
            }
        }