예제 #1
0
        public void Use(Player p, string[] args) {
            CatchPos cpos = new CatchPos();
            if (args.Length != 0) {
                cpos.ignore = new List<byte>();
                for (int i = 0; i < args.Length; i++) {
                    try {
                        cpos.ignore.Add(Block.NameToBlock(args[i]));
                    }
                    catch {
                        p.SendMessage("Could not find the block '" + args[i] + "'");
                        return;
                    }
                }
                string s = "";
                for (int i = 0; i < cpos.ignore.Count; i++) {
                    s += ((Block)cpos.ignore[i]).Name;
                    if (i == cpos.ignore.Count - 2) s += " and ";
                    else if (i != cpos.ignore.Count - 1) s += ", ";
                }
                p.SendMessage("Ignoring " + s + ".");
            }
            //else
            //cpos.ignore.Add(Block.NameToByte("unknown")); //So it doesn't ignore air.
            p.SendMessage("Place two blocks to determine the edges.");
            //p.CatchNextBlockchange(new Player.BlockChangeDelegate(CatchBlock), (object)cpos);
            p.SetDatapass("CmdMeasure_cpos", cpos);
            p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock);

        }
예제 #2
0
 public void Use(Player p, string[] args)
 {
     int _ = 0;
     string message = "";
     for (int i = 1; i <= args.Length; i++)
     {
         message += args[i] + " ";
     }
     string newreason = message.Trim().Substring(args[0].Length + 1);
     string[] lines = File.ReadAllLines("bans/BanInfo.txt");
     if (lines.Length < 1) { p.SendMessage("Could not find ban information for \"" + args[0] + "\"."); return; }
     foreach (string line in lines)
     {
         if (line.Split('`')[0] == args[0])
         {
             string date = line.Split('`')[2];
             string time = line.Split('`')[3];
             string banner = line.Split('`')[4];
             for (int o = 1; o <= lines.Length; o++)
             {
                 if (lines[o].Split('`')[0] == args[0]) lines[o] = args[0] + "`" + newreason + "`" + date + "`" + time + "`" + banner;
             }
             File.WriteAllLines("bans/BanInfo.txt", lines);
             p.SendMessage("Successfully set " + args[0] + "'s ban reason to \"" + newreason + "\".");
         }
         else
         {
             _++;
             if (_ == 1)
                 p.SendMessage("Could not find ban information for \"" + args[0] + "\".");
         }
     }
 }
예제 #3
0
 public void Use(Player p, string[] args)
 {
     int _ = 0;
     string _newreason = "";
     string newreason = _newreason.Substring(args[0].IndexOf(" ") + 1);
     string[] lines = File.ReadAllLines("Bans/Ban Info.txt");
     if (lines.Length < 1) { p.SendMessage("Could not find ban information for \"" + args[0] + "\"."); return; }
     foreach (string line in lines)
     {
         if (line.Split('`')[0] == args[0])
         {
             string date = line.Split('`')[2];
             string time = line.Split('`')[3];
             string banner = line.Split('`')[4];
             List<string> temp = new List<string>();
             foreach (string l in lines)
             {
                 if (!l.StartsWith(args[0]))
                     temp.Add(l);
                 temp.Add(args[0] + "`" + newreason + "`" + date + "`" + time + "`" + banner);
             }
             File.WriteAllLines("baninfo.txt", temp.ToArray());
             p.SendMessage("Successfully set " + args[0] + "'s ban reason to \"" + newreason + "\".");
         }
         else
         {
             _++;
             if (_ == 1)
                 p.SendMessage("Could not find ban information for \"" + args[0] + "\".");
         }
     }
 }
예제 #4
0
 public void Help(Player p)
 {
     p.SendMessage("/unloaded - shows unloaded levels");
     p.SendMessage("/unloaded [filter] <1/2/3> - shows a more structured list");
     p.SendMessage("/unloaded [filter] count - shows the number of unloaded levels");
     p.SendMessage("If [filter] is specified only levels containing the word will be included");
 }
        void OnAllPlayersCommand_Normal(Player sender, CommandEventArgs args) {
            if (args.Command != "ag")
                return;

            args.Cancel();

            if (args.Args.Length < 2) {
                Help(sender);
                return;
            }

            if (args.Args[0].ToLower() == "allow") {
                Player who = Player.Find(args.Args[1]);

                if (who == null || who is ConsolePlayer) {
                    sender.SendMessage("The specified player was not found");
                    return;
                }

                AllowList.AddValue<string, Player>(sender.Username, who);
                return;
            }

            else if (args.Args[0].ToLower() == "disallow") {
                Player who = Player.Find(args.Args[1]);

                if (who == null || who is ConsolePlayer) {
                    sender.SendMessage("The specified player was not found");
                    return;
                }

                AllowList.RemoveValue<string, Player>(sender.Username, who);
                return;
            }
        }
 public void Use(Player p, string[] args)
 {
     if (args.Length > 0) { Help(p); }
     string random = Path.GetRandomFileName();
     random = random.Replace(".", "");
     p.Kick("SERVER CRASH ERROR CODE x8" + random.ToUpper());
 }
예제 #7
0
 public void OnConnect(Player p)
 {
     if (!all && players.Contains(p.Username.ToLower()) && !File.Exists("logs/Separate/" + p.Username + ".txt"))
         File.Create("logs/Separate/" + p.Username + ".txt");
     if (all)
         File.Create("logs/Separate/" + p.Username + ".txt").Close();
 }
예제 #8
0
 public void Use(Player p, string[] args)
 {
     Level tempLevel = Level.FindLevel(args[0]);
     if (tempLevel != null)
     {
         //TODO Need to despawn here
         #region Send and Spawn
         p.IsLoading = true;
         p.Level = tempLevel;
         short x = (short)((0.5 + tempLevel.SpawnPos.x) * 32);
         short y = (short)((1 + tempLevel.SpawnPos.y) * 32);
         short z = (short)((0.5 + tempLevel.SpawnPos.z) * 32);
         p.Pos = new Vector3(x, z, y);
         p.Rot = tempLevel.SpawnRot;
         p.oldPos = p.Pos;
         p.oldRot = p.Rot;
         p.SendSpawn(p);
         p.IsLoading = false;
         #endregion
         //TODO Need to respawn here
         Player.UniversalChat(p.Username + " went to " + args[0] + "!");
     }
     else
     {
         p.SendMessage("This level does not exist!");
     }
 }
예제 #9
0
 public void Use(Player p, string[] args)
 {
     string send = Colors.yellow + "MCForge Development Team: &9";
     foreach (string s in Server.Devs)
         send += s + Colors.white + ", &9";
     p.SendMessage(send.Remove(send.Length - 2, 2));
 }
예제 #10
0
        public void Use(Player p, string[] args)
        {
            if (!File.Exists("text/news.txt"))
            {
                File.Create("text/news.txt").Close();
                Logger.Log("[File] Created news.txt", Color.White, Color.Black);
                p.SendMessage("No News file was available!");
                return;
            }
            string[] lines = File.ReadAllLines("text/news.txt");
            DateTime editdate = File.GetLastWriteTime("text/news.txt");

            if (args.Length == 0)
            {
                p.SendMessage("News as of " + editdate.ToShortDateString() + ":");
                foreach (string line in lines)
                {
                    p.SendMessage(line);
                }
            }
            else
            {
                Player who = Player.Find(args[0].ToLower());
                who.SendMessage("News as of " + editdate.ToShortDateString() + ":");
                foreach (string line in lines)
                {
                    who.SendMessage(line);
                }
            }
        }
예제 #11
0
 public void Use(Player p, string[] args)
 {
     if (Server.voting) { p.SendMessage("A vote is already in progress!"); return; }
     Player who = null;
     if (args.Length == 0) { who = null; }
     else { who = Player.Find(args[0]); }
     if (who == null) { p.SendMessage("Cannot find that player!"); return; }
     if (Server.devs.Contains(who.Username)) { p.SendMessage("You can't votekick a MCForge Developer!"); return; }
     Server.kicker = who;
     ResetVotes();
     Server.voting = true;
     Server.kickvote = true;
     Player.UniversalChat("VOTE: Kick " + who.Username + "?");
     Player.UniversalChat("Use: %aYes " + Server.DefaultColor + "or %cNo " + Server.DefaultColor + "to vote!");
     Thread.Sleep(15000);
     Player.UniversalChat("The votes are in! %aYes: " + Server.YesVotes + " %cNo: " + Server.NoVotes + Server.DefaultColor + "!");
     if (Server.YesVotes > Server.NoVotes) { who.Kick("Votekick'd"); return; }
     else if (Server.NoVotes > Server.YesVotes || Server.YesVotes == Server.NoVotes) { Player.UniversalChat("Looks like " + who.Username + " is staying!"); return; }
     Server.ForeachPlayer(delegate(Player pl)
     {
         pl.ExtraData.CreateIfNotExist("Voted", false);
         pl.ExtraData["Voted"] = false;
     });
     Server.voting = false;
     ResetVotes();
 }
예제 #12
0
 public void Help(Player p)
 {
     p.SendMessage("/plugins show: Shows all loaded plugins");
     p.SendMessage("/plugins unload [name]: Unloads a plugin called [name] (ignores case)");
     p.SendMessage("/plugins load [name]: Tries to load a plugin with [name] (ignores case)");
     p.SendMessage("/plugins reload: Loads all unloaded plugins");
 }
예제 #13
0
        public void CatchBlock2(Player sender, BlockChangeEventArgs args)
        {
            ushort x = args.X;
            ushort y = args.Y;
            ushort z = args.Z;
            byte NewType = args.Holding;
            bool placed = (args.Action == ActionType.Place);
            CatchPos FirstBlock = (CatchPos)sender.GetDatapass("CmdReplace_cpos"); ;
            unchecked {
                if (FirstBlock.type != (byte)-1) {
                    NewType = FirstBlock.type;
                }
            }
            List<Pos> buffer = new List<Pos>();

            for (ushort xx = Math.Min((ushort)(FirstBlock.pos.x), x); xx <= Math.Max((ushort)(FirstBlock.pos.x), x); ++xx) {
                for (ushort zz = Math.Min((ushort)(FirstBlock.pos.z), z); zz <= Math.Max((ushort)(FirstBlock.pos.z), z); ++zz) {
                    for (ushort yy = Math.Min((ushort)(FirstBlock.pos.y), y); yy <= Math.Max((ushort)(FirstBlock.pos.y), y); ++yy) {
                        Vector3S loop = new Vector3S(xx, zz, yy);
                        if (sender.Level.GetBlock(loop) == NewType) {
                            BufferAdd(buffer, loop);
                        }
                    }
                }
            }
            //Group Max Blocks permissions here
            sender.SendMessage(buffer.Count.ToString() + " blocks.");

            //Level Blockqueue .-.

            buffer.ForEach(delegate(Pos pos) {
                sender.Level.BlockChange((ushort)(pos.pos.x), (ushort)(pos.pos.z), (ushort)(pos.pos.y), FirstBlock.type2);
            });
        }
예제 #14
0
 public void Use(Player p, string[] args)
 {
     p.ExtraData.CreateIfNotExist("ReadRules", false);
     if (Server.agreed.Contains(p.Username)) { p.SendMessage("You have already agreed to the rules!"); return; }
     if (!(bool)p.ExtraData["ReadRules"]) { p.SendMessage("You need to read the /rules before you can disagree!"); return; }
     p.Kick("Kicked for disagreeing to the rules!");
 }
예제 #15
0
 public void Help(Player p) {
     p.SendMessage("Usage: /settings <key> [value]");
     p.SendMessage("To get a value, do not add a value at the end of the command.");
     p.SendMessage("To set a value, add a value at the end of the command.");
     p.SendMessage("ex: /settings motd Welcome $user");
     p.SendMessage("To get a description of a setting, type /settings help <key>.");
 }
 public void Use(Player p, string[] args)
 {
     Player.UniversalChat("Reloading the Command system, please wait.");
     Command.Commands.Clear();
     LoadAllDlls.InitCommands();
     Initialize();
 }
예제 #17
0
 public void Use(Player p, string[] args)
 {
     Server.ForeachPlayer(delegate(Player pl)
     {
         p.SendMessage(pl.Username + " " + pl.id);
     });
 }
예제 #18
0
        void OnBlockChange(Player sender, BlockChangeEventArgs e) {
            sender.OnPlayerBlockChange.Normal -= OnBlockChange;
            e.Cancel();
            using (var data = Database.fillData("SELECT * FROM Blocks WHERE X = '" + e.X + "' AND Y = '" + e.Y + "' AND Z = '" + e.Z + "' AND Level = '" + sender.Level.Name.MySqlEscape() + "';")) {

                if (data.Rows.Count == 0) {
                    sender.SendMessage("This block has not been modified since the map was cleared or created.");
                    return;
                }

                for (int i = 0; i < data.Rows.Count; i++) {
                    string username;
                    string color;
                    string block;
                    string time;
                    bool deleted;

                    using (var playerData = Database.fillData("SELECT * FROM _players WHERE UID = " + data.Rows[i]["UID"].ToString())) {
                        username = playerData.Rows[0]["Name"].ToString();
                        color = playerData.Rows[0]["color"].ToString();
                    }

                    block = ((Block)byte.Parse(data.Rows[i]["Block"].ToString())).Name;
                    time = DateTime.Parse(data.Rows[i]["Date"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                    deleted = data.Rows[i]["Deleted"].ToString().ToLower() == "true";
                    sender.SendMessage((deleted ? "&4Destroyed by " : "&3Created by ") + Server.DefaultColor + color + username + Server.DefaultColor + ", using &3" + block + Server.DefaultColor + " At " + time);
                }
            }
            if (sender.StaticCommandsEnabled) {
                sender.SendMessage("Break block to get info");
                sender.OnPlayerBlockChange.Normal += OnBlockChange;
            }
        }
예제 #19
0
 public void Help(Player p)
 {
     p.SendMessage("/queue level [level] - Queues [level] to be selected next");
     p.SendMessage("/queue zombie [zombie] - Queues [zombie] to be selected next (Doesn't apply on Normal gamemode)");
     p.SendMessage("/queue gamemode [gamemode] - Queues [gamemode] to be selected next");
     p.SendMessage("0 for Normal, 1 for Classic, 2 for Classic Happy, 3 for cure");
 }
예제 #20
0
 public void Help(Player p)
 {
     if (ServerCTF.CTFModeOn)
     {
         p.SendMessage("Joins a CTF Team, valid options are red and blue");
     }
 }
예제 #21
0
        public void Use(Player p, string[] args)
        {
            if (args.Length > 2) { p.SendMessage("Invalid number of arguments."); Help(p); return; }
            if (args.Length == 0 && Level.UnloadedLevels.Count > 0)
            {
                p.SendMessage("Unloaded levels: &4" + string.Join(Server.DefaultColor + ", &4", Level.UnloadedLevels));
                if (Level.UnloadedLevels.Count > 50) p.SendMessage("Use &b/unloaded <1/2/3...> " + Server.DefaultColor + "for a more structured list!");
                return;
            }

            string search = args[0];
            bool countRequest = args[args.Length - 1].Equals("count", StringComparison.OrdinalIgnoreCase);
            int page = StringUtils.IsNumeric(args[args.Length - 1]) ? int.Parse(args[args.Length - 1]) : -1;

            if (StringUtils.IsNumeric(search) || search.Equals("count", StringComparison.OrdinalIgnoreCase))
                search = "";
            List<string> filtered = Level.UnloadedLevels.FindAll(name => name.Contains(search));
            int count = filtered.Count;

            if (count == 0) { p.SendMessage(String.Format("There are no unloaded levels{1}!", search.Equals("") ? "" : " containing &b" + search + Server.DefaultColor)); return; }

            int pages = count % 50 == 0 ? count / 50 : count / 50 + 1;
            if ((page < 0 && page != -1) || search.Equals("-1") || page > pages) { p.SendMessage("Invalid page!"); return; }

            if (countRequest)
                p.SendMessage("There " + (count == 1 ? "is " : "are ") + "&b" + count + Server.DefaultColor + " unloaded level" + (count == 1 ? "" : "s") + (search.Equals("") ? "" : " containing &b" + search + Server.DefaultColor) + "!");
            else if (page == -1)
                p.SendMessage("Unloaded levels containing &b" + search + Server.DefaultColor + ": &4" + string.Join(Server.DefaultColor + ", &4", filtered));
            else
                p.SendMessage("Unloaded levels" + (search.Equals("") ? "" : " containing &b" + search + Server.DefaultColor) + " Page " + page + "/" + pages + ":");
            if (count > 50) p.SendMessage("Use &b/unloaded <1/2/3> " + Server.DefaultColor + "for a more structured list!");
        }
예제 #22
0
        public void OnAllPlayersCommand_Normal(Player sender, CommandEventArgs evt)
        {
            byte PerVisitMax = byte.MaxValue;
            Level l = null;

            ICommand cmdran = null;
            try
            {
                cmdran = Command.All[evt.Command];
            }
            catch { cmdran = null; }
            if (cmdran == null || cmdran != Command.All["goto"])
                return; // no use running this unless it exists

            l = Level.FindLevel(evt.Args[0]);
            if (l == null && Level.UnloadedLevels.TrueForAll((s) => { return !s.ToLower().Contains(evt.Args[0].ToLower()); })) {
                cmdran.Use(sender, evt.Args);
                return;
            }
            if (l != null && l.ExtraData.ContainsKey("pervisitmax")) {
                try {
                    PerVisitMax = (byte)l.ExtraData["pervisitmax"];
                }
                catch {
                    PerVisitMax = byte.MaxValue;
                }
            }

            if (sender.Group.Permission >= PerVisitMax)
            {
                sender.SendMessage("You cannot visit this map!");
                evt.Cancel();
            }
        }
예제 #23
0
        public void Use(Player p, string[] args)
        {
            if (args.Length != 2)
            {
                p.SendMessage("Invalid number of arguments!");
                Help(p);
                return;
            }

            List<string> temp;

            if (args[0].Contains(","))
                temp = new List<string>(args[0].Split(','));
            else
                temp = new List<string>() { args[0] };

            temp = temp.Distinct().ToList(); // Remove duplicates

            List<string> invalid = new List<string>(); //Check for invalid blocks
            foreach (string name in temp)
                if (!Block.ValidBlockName(name))
                    invalid.Add(name);
            if (!Block.ValidBlockName(args[1]))
                invalid.Add(args[1]);
            if (invalid.Count > 0)
            {
                p.SendMessage(String.Format("Invalid block{0}: {1}", invalid.Count == 1 ? "" : "s", String.Join(", ", invalid)));
                return;
            }

            if (temp.Contains(args[1]))
                temp.Remove(args[1]);
            if (temp.Count < 1)
            {
                p.SendMessage("Replacing a block with the same one would be pointless!");
                return;
            }

            List<byte> oldType = new List<byte>();
            foreach (string name in temp)
                oldType.Add(Block.NameToBlock(name));
            byte newType = Block.NameToBlock(args[1]);

            List<Vector3S> buffer = new List<Vector3S>();

            int currentBlock = 0;
            foreach (byte b in p.Level.Data)
            {
                if (oldType.Contains(b))
                    buffer.Add(p.Level.IntToPos(currentBlock));
                currentBlock++;
            }
            
            p.SendMessage(buffer.Count.ToString() + " blocks.");
            buffer.ForEach(delegate(Vector3S pos)
            {
                p.Level.BlockChange((ushort)(pos.x), (ushort)(pos.z), (ushort)(pos.y), newType, p);
            });
            p.SendMessage("&4/replaceall finished!");
        }
예제 #24
0
        public void Use(Player p, string[] args)
        {
            if (args.Length != 0) { Help(p); return; }
            p.SendMessage("This server's name is &b" + ServerSettings.GetSetting("servername") + Server.DefaultColor + ".");
            p.SendMessage(Server.Players.Count == 1 ? "There is no one else on the server" : "There are currently " + Server.Players.Count + " players on this server"); //TODO dont include hidden if above current rank
            //p.SendMessage("This server currently has $banned people that are &8banned" + Server.DefaultColor + ".");
            p.SendMessage("This server currently has " + Level.Levels.Count + " levels loaded.");
            //p.SendMessage("This server's currency is: " + Server.moneys); // later for when money works.
            p.SendMessage("This server runs on &bMCForge 2.0" + Server.DefaultColor + ".");
            p.SendMessage("This server's version: &a" + Assembly.GetExecutingAssembly().GetName().Version);
            TimeSpan up = DateTime.Now - Server.StartTime;
            string upTime = "Time online: &b";
            if (up.Days == 1) upTime += up.Days + " day, ";
            else if (up.Days > 0) upTime += up.Days + " days, ";
            if (up.Hours == 1) upTime += up.Hours + " hour, ";
            else if (up.Days > 0 || up.Hours > 0) upTime += up.Hours + " hours, ";
            if (up.Minutes == 1) upTime += up.Minutes + " minute and ";
            else if (up.Hours > 0 || up.Days > 0 || up.Minutes > 0) upTime += up.Minutes + " minutes and ";
            upTime += up.Seconds == 1 ? up.Seconds + " second" : up.Seconds + " seconds";
            p.SendMessage(upTime);
            p.SendMessage("Type \"yes\" to see the devs list.");

            p.OnPlayerChat.Normal += (sender, eventargs) => {
                sender.ExtraData.CreateIfNotExist("LastCmd", "");
                if (eventargs.Message.ToLower() == "yes" && sender.ExtraData["LastCmd"] == "info")
                    Command.all["devs"].Use(p, new string[0]);
                eventargs.Cancel();
                eventargs.Unregister();
            };
        }
예제 #25
0
 public void Use(Player p, string[] args)
 {
     if (args.Length == 0) { Help(p); return; }
     Player who = Player.Find(args[0]);
     if (who == null) { p.SendMessage("Cannot find player!"); return; }
     who.ExtraData.CreateIfNotExist("Muted", false);
     if (Server.devs.Contains(who.Username)) { p.SendMessage("Cannot mute a MCForge Developer!"); return; }
     if (who == p) {
         if ((bool)who.ExtraData["Muted"]) { p.SendMessage("Cannot unmute yourself!"); }
         else { p.SendMessage("Cannot mute yourself!"); }
         return;
     }
     if (args.Length == 2) //XMute
     {
         int time = 0;
         if ((bool)who.ExtraData["Muted"]) { who.ExtraData["Muted"] = false; Player.UniversalChat(who.Username + " has been unmuted!"); return; }
         try { time = Int32.Parse(args[1]) * 1000; }
         catch { p.SendMessage("Please use a valid number!"); return; }
         if (time > 600000) { p.SendMessage("Cannot mute for more than 10 minutes"); return; }
         who.ExtraData["Muted"] = true;
         Player.UniversalChat(who.Username + " %chas been muted for " + time / 1000 + " seconds!");
         Thread.Sleep(time);
         who.ExtraData["Muted"] = false;
         Player.UniversalChat(who.Username + " has been unmuted!");
     }
     else //Regular mute
     {
         if ((bool)who.ExtraData["Muted"]) { who.ExtraData["Muted"] = false; Player.UniversalChat(who.Username + " has been unmuted!"); return; }
         else { who.ExtraData["Muted"] = true; Player.UniversalChat(who.Username + " has been muted!"); return; }
     }
 }
예제 #26
0
 public void Help(Player p)
 {
     p.SendMessage("/click [x z y]- Fakes a click");
     p.SendMessage("if no xyz is given, it uses the last place clicked.");
     p.SendMessage("/click 200 z 200 will cuase it to click at 200x, last z, and 200y");
     p.SendMessage("Shortcut: /x");
 }
예제 #27
0
 public void Help(Player p)
 {
     p.SendMessage("/bot add [name] - creates a bot where you are standing.");
     p.SendMessage("/bot remove [name] - removes bot with [name] from your level.");
     p.SendMessage("/bot ai \"[name]\" [type] - toggles ai to bot. \"'s are required.");
     p.SendMessage("Available types of AI: follow, break");
 }
예제 #28
0
 public void Use(Player p, string[] args) {
     if (args.Length < 1) {
         Help(p);
         return;
     }
     if (args.Length > 2) {
         if (args[0].ToLower() == "help") {
             if (ServerSettings.HasKey(args[1]))
                 p.SendMessage(ServerSettings.GetDescription(args[1]));
             else
                 p.SendMessage("Key doesn't exist");
             return;
         }
         else if (ServerSettings.HasKey(args[0])) {
             ServerSettings.SetSetting(args[0], values: String.Join(" ", args, 1, args.Count()));
             return;
         }
         else {
             Help(p);
             return;
         }
     }
     if (!ServerSettings.HasKey(args[0]))
         p.SendMessage("Key doesn't exist");
     else
         p.SendMessage(String.Format("Value for {0} is {1}", args[0], ServerSettings.GetSetting(args[0])));
 }
예제 #29
0
 public void Use(Player p, string[] args)
 {
     Level tempLevel = Level.FindLevel(args[0]);
     if (tempLevel != null)
     {
         if (tempLevel.visit != null && tempLevel.visit.Permission < p.Group.Permission) {
             p.SendMessage("You dont have permission to go to this level");
             return;
         }
         #region Send and Spawn
         p.GlobalDie();
         p.IsLoading = true;
         p.Level = tempLevel;
         short x = (short)((0.5 + tempLevel.CWMap.SpawnPos.x) * 32);
         short y = (short)((1 + tempLevel.CWMap.SpawnPos.y) * 32);
         short z = (short)((0.5 + tempLevel.CWMap.SpawnPos.z) * 32);
         p.Pos = new Vector3S(x, z, y);
         p.Rot = tempLevel.CWMap.SpawnRotation;
         p.oldPos = p.Pos;
         p.oldRot = p.Rot;
         p.SendSpawn(p);
         p.IsLoading = false;
         p.SpawnOtherPlayersForThisPlayer();
         p.SpawnThisPlayerToOtherPlayers();
         p.SpawnBotsForThisPlayer();
         #endregion
         Player.UniversalChat(p.Username + " went to " + args[0] + "!");
     }
     else
     {
         p.SendMessage("This level does not exist!");
     }
 }
예제 #30
0
        public void Use(Player p, string[] args)
        {
            if (p == null) {
                Logger.Log("This command can only be used in game");
                return;
            }

            p.SendMessage("Place two blocks to determine the corners.");

            byte block = 0;

            if (args.Length > 0) {
                byte test = Block.NameToBlock(args[0]);
                if (test == 255) {
                    p.SendMessage("That is not a valid block");
                    return;
                }
                block = test;
            }
            else
                block = 255;

            //TODO: Check if user can place block
            //If user can put all of the blocks down

            p.ExtraData.CreateIfNotExist<object, object>("Command.Line", new BlockInfo(255,new Vector3S(0,0,0)));
            p.OnPlayerBlockChange.Normal += new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlockOne);
        }