示例#1
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] + "\".");
         }
     }
 }
示例#2
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");
 }
示例#3
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);
                }
            }
        }
        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!");
        }
示例#5
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; }
     }
 }
        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; }
            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();
        }
示例#7
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");
 }
示例#8
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");
 }
 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!");
 }
示例#10
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);

        }
示例#11
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.SpawnPos.x) * 32);
         short y = (short)((1 + tempLevel.SpawnPos.y) * 32);
         short z = (short)((0.5 + tempLevel.SpawnPos.z) * 32);
         p.Pos = new Vector3S(x, z, y);
         p.Rot = tempLevel.SpawnRot;
         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!");
     }
 }
示例#12
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])));
 }
示例#13
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>.");
 }
示例#14
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");
 }
示例#15
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();
            };
        }
示例#16
0
        public void Use(Player p, string[] args) {
            if (args.Length == 0 || args.Length > 2) { Help(p); return; }
            Player who;
            string color;

            p.Color = p.Group.Color;

            if (args.Length == 1) {
                who = p;
                color = args[0] == "del" ? p.Group.Color : Colors.Parse(args[0]);
                if (p.Color == color) { p.SendMessage("You are already that color!"); return; }
            }
            else {
                who = Player.Find(args[0]);
                if (who == null) { p.SendMessage("Could not find player."); return; }
                if (p.Group.Permission <= who.Group.Permission) { p.SendMessage("You can't change the color of someone of equal or higher rank!"); return; }

                color = args[1] == "del" ? who.Group.Color : Colors.Parse(args[1]);
                if (who.Color == color) { p.SendMessage("They are already that color!"); return; }
            }
            if (color == "") { p.SendMessage("Could not find color."); return; }

            string message = "";
            if (color == who.Group.Color)
                message = "their groups default.";
            else
                message = color + Colors.Name(color) + who.Color+ ".";
            Player.UniversalChat(who.Color + "*" + who.Username + (who.Username.EndsWith("s") || who.Username.EndsWith("x") ? "'" : "'s") + " color was changed to " + message);
            who.Color= color;

            who.GlobalDie();
            who.SendSpawn(who);
            who.SetPrefix();
            //TODO Save to database.
        }
示例#17
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;
            }
        }
示例#19
0
        public void Use(Player p, string[] args)
        {
            if (args.Length != 1)
            {
                p.SendMessage("Invalid arguments!");
                return;
            }
            else
            {
                if (args[0].ToLower() == "all")
                {
					Server.ForeachPlayer(delegate(Player pl)
					{
						if (pl.Level == p.Level && pl != p && p.Group.Permission > pl.Group.Permission) //Missing permissions
						{
							pl.SendToPos(p.Pos, p.Rot);
                            pl.SendMessage("You were summoned by " + p.Color+ p.Username + Server.DefaultColor + ".");
						}
					});
                    Player.UniversalChat(p.Color + p.Username + Server.DefaultColor + " summoned everyone!");
                    return;
                }
                else
                {
                    Player who = Player.Find(args[0]);
                    if (who == null || who.IsHidden && p.Group.Permission < who.Group.Permission)
                    {
                        p.SendMessage("Player: " + args[0] + " not found!");
                        return;
                    }
                    else if (who == p)
                    {
                        p.SendMessage("Why are you trying to summon yourself?");
                        return;
                    }
                    else if (p.Group.Permission < who.Group.Permission)
                    {
                        p.SendMessage("You cannot summon someone ranked higher thank you!");
                        return;
                    }
                    else
                    {
                        if (p.Level != who.Level)
                        {
                            p.SendMessage(who.Username + " is in a different level. Forcefetching has started!");
                            Level where = p.Level;
                            //Need to use goto here
                            Thread.Sleep(1000); //Let them load;   
                            while (who.IsLoading)
                            {
                                Thread.Sleep(250);
                            }
                        }
                    }
                    who.SendToPos(p.Pos, p.Rot);
                }
                return;
            }
        }
示例#20
0
        public void Use(Player p, string[] args)
        {
            if (args.Length < 2)
            {
                Help(p);
                return;
            }

            byte perVisitMax = byte.MaxValue;
            PlayerGroup g = null;
            Level l = null;
            l = Level.FindLevel(args[0]);

            if (l == null)
            {
                p.SendMessage("Level not found!");
                return; //no need to continue (troll)
            }

            try
            {
                perVisitMax = byte.Parse(args[1]);
            }
            catch
            {
                try
                {
                    g = PlayerGroup.Find(args[1]);
                    perVisitMax = g.Permission;
                }
                catch
                {
                    p.SendMessage("Error parsing new build permission");
                    return;
                }
            }

            if (perVisitMax > p.Group.Permission)
            {
                p.SendMessage("You cannot set the build permission to a greater rank or permission than yours");
                return;
            }

            if (l.ExtraData.ContainsKey("pervisitmax"))
            {
                l.ExtraData["pervisitmax"] = perVisitMax;
            }
            else
                l.ExtraData.Add("pervisitmax", perVisitMax);

            if (g != null)
            {
                p.SendMessage("Successfully put " + Colors.gold + l.Name + Server.DefaultColor + "'s max visit permission to " + g.Color + g.Name);
            }
            else
            {
                p.SendMessage("Successfully put " + Colors.gold + l.Name + Server.DefaultColor + "'s max visit permission to " + Colors.red + perVisitMax);
            }
        }
示例#21
0
 public void Use(Player p, string[] args) {
     if (args.Length == 0) { p.SendMessage("Please specify a message to write!"); Help(p); return; }
     CatchPos cpos = new CatchPos();
     cpos.message = string.Join(" ", args);
     p.SetDatapass(Name, cpos);
     p.SendMessage("Place two blocks to determine the direction!");
     p.OnPlayerBlockChange.Normal += BlockChange1;
 }
 public void Help(Player p)
 {
     p.SendMessage("/calculate <num1> <method> <num2> - Evaluates two number using a method.");
     p.SendMessage("Available methods for two numbers: /, x, -, +, ^(Exponent),");
     p.SendMessage("/calculate <num1> <method> - Evaluates a number using a complex method.");
     p.SendMessage("Available methods for one number: square, root, pi, cube");
     p.SendMessage("Shortcut: /calc");
 }
示例#23
0
 public void Help(Player p)
 {
     p.SendMessage("/teleport <x> <z> <y> - Telports you to a coordinate.");
     p.SendMessage("/teleport <player1> [player2] - Teleports yourself to a player.");
     p.SendMessage("[player2] is optional, but if present will send player1 to the player2.");
     p.SendMessage("If <player> is blank, you are sent to spawn");
     p.SendMessage("Shortcut: /tp");
 }
示例#24
0
 public void Help(MCForge.Entity.Player p)
 {
     p.SendMessage("/brush <brush type> [optional: size] [optional: block]  - place blocks on the level using a brush");
     p.SendMessage("/brush off - turns off the brush...");
     p.SendMessage("Valid brush types:");
     p.SendMessage("Cube, Sphere, Random");
     //TODO: add more types....
 }
 public void Help(Player p)
 {
     p.SendMessage("/tempban <player> [amount] [m/h/d] - Bans <player> for [amount] of minutes, hours, or days");
     p.SendMessage("If amount isn't specified, player will be banned for an hour");
     p.SendMessage("m = minutes : h = hours : d = days");
     p.SendMessage("&cTempbans will be reset if the server restarts!");
     p.SendMessage("Shortcut: /tb");
 }
示例#26
0
 public void Use(Player p, string[] args)
 {
     if (!ServerSettings.GetSettingBoolean("AgreeingToRules")) { p.SendMessage("Agreeing to rules is disabled on this server!"); return; }
     p.ExtraData.CreateIfNotExist("ReadRules", false);
     if (Server.AgreedPlayers.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!");
 }
示例#27
0
 public void Help(Player p)
 {
     p.SendMessage("/titlecolor <color> - Change your own title color.");
     p.SendMessage("/titlecolor [player] <color> - Changes [player]'s title color.");
     p.SendMessage("Available colors: &0black &1navy &2green &3teal &4maroon &5purple &6gold &7silver");
     p.SendMessage("&8gray &9blue &alime &baqua &cred &dpink &eyellow &fwhite");
     p.SendMessage("Shortcut: /tcolor");
 }
示例#28
0
 public void Help(Player p)
 {
     p.SendMessage("/rainbowtitle - Rainbows your current title.");
     p.SendMessage("/rainbowtitle <title> - Gives you a rainbow title.");
     p.SendMessage("/rainbowtitle [player] <title> - Gives [player] a rainbow title.");
     p.SendMessage("Note: Rainbow titles can only be up to 15 letters long.");
     p.SendMessage("Shortcut: /rtitle");
 }
示例#29
0
 public void Use(Player p, string[] args)
 {
     Block b = Block.BlockList.UNKNOWN;
     ushort x, z, y;
     Vector3S pos = p.Pos;
     try
     {
         switch (args.Length)
         {
             case 0:
                 x = (ushort)(pos.x / 32);
                 z = (ushort)(pos.z / 32);
                 y = (ushort)(pos.y / 32 - 1);
                 b = Block.BlockList.STONE;
                 break;
             case 1:
                 x = (ushort)(pos.x / 32);
                 z = (ushort)(pos.z / 32);
                 y = (ushort)(pos.y / 32 - 1);
                 b = Block.NameToBlock(args[0]);
                 break;
             case 3:
                 x = Convert.ToUInt16(args[0]);
                 z = Convert.ToUInt16(args[1]);
                 y = Convert.ToUInt16(args[2]);
                 b = Block.BlockList.STONE;
                 break;
             case 4:
                 b = Block.NameToBlock(args[0]);
                 x = Convert.ToUInt16(args[1]);
                 z = Convert.ToUInt16(args[2]);
                 y = Convert.ToUInt16(args[3]);
                 break;
             default:
                 p.SendMessage("Invalid parameters.");
                 return;
         }
     }
     catch
     {
         p.SendMessage("Invalid parameters.");
         return;
     }
     if (b == Block.BlockList.UNKNOWN) {
         p.SendMessage("Unknown block type");
         return;
     }
     if (!p.Group.CanBuild(b)) {
         p.SendMessage("You're not allowed to build this block!");
         return;
     }
     if (y >= p.Level.Size.y)
     {
         y = (ushort)(p.Level.Size.y - 1);
     }
     p.Level.BlockChange(x, z, y, b, p);
     p.SendMessage("An " + ((Block)b).Name + " block was placed at (" + x + ", " + z + ", " + y + ").");
 }
示例#30
0
 public void Use(Player p, string[] args)
 {
     p.SendMessage("VIPs are players who can join the server when it's full!");
     p.SendMessage("MCForge Developers are automatically VIPs!");
     string send = Colors.yellow + ServerSettings.GetSetting("ServerName") + " VIPs: ";
     foreach (string s in Server.VIPs)
         send += s + Colors.white + ", ";
     p.SendMessage(send.Remove(send.Length - 2, 2));
 }
示例#31
0
 public void Use(Player p, string[] args) {
     if (p.Group.Permission >= Permission) {
         p.SendMessage("Build as many blocks as you want for the portal entry, break a block to set the exit");
         p.OnPlayerBlockChange.Low += OnPlayerBlockChange_Low;
     }
     else {
         p.SendMessage("Your not allowed to create portals");
     }
 }
示例#32
0
        public void Use(MCForge.Entity.Player p, string[] args)
        {
            if (args.Length < 1 || args.Length > 3)
            {
                Help(p);
                return;
            }

            if (args[0].ToLower() == "off" && p.ExtraData.ContainsKey("BrushData"))
            {
                p.OnPlayerBlockChange.Normal -= BlockChange;
                p.ExtraData.Remove("BrushData");
                p.SendMessage("Brush turned off");
                return;
            }

            byte block     = 255;
            int  size      = 3;
            Type brushType = Server.ServerAssembly.GetType("MCForge.World.Drawing." + StringUtils.CapitolizeFirstChar(args[0]) + "Brush");

            if (brushType == null)
            {
                p.SendMessage("Invalid brush type");
                Help(p);
                return;
            }

            if (args.Length == 3)
            {
                block = Block.NameToBlock(args[2]);
                if (block == Block.BlockList.UNKNOWN)
                {
                    p.SendMessage("That is not a valid block");
                    return;
                }
            }

            if (args.Length >= 2)
            {
                try {
                    size = int.Parse(args[1]);
                }
                catch {
                    p.SendMessage("That is not a number");
                    Help(p);
                    return;
                }
            }

            p.SendMessage("Start brushing!!");
            p.ExtraData.ChangeOrCreate <object, object>("BrushData", new BrushData(brushType, block, size));
            p.OnPlayerBlockChange.Normal += BlockChange;
        }
示例#33
0
        public void Use(MCForge.Entity.Player p, string[] args)
        {
            if (p.GetType() == typeof(ConsolePlayer))
            {
                p.SendMessage("This can only be used in game");
                return;
            }

            if (args.Length < 1)
            {
                if (p.ExtraData.ContainsKey("FollowData"))
                {
                    p.ExtraData.Remove("FollowData");
                    p.SendMessage("Stopped Following");
                    p.IsHidden = !p.IsHidden;
                    if (!p.IsHidden)
                    {
                        p.SpawnThisPlayerToOtherPlayers();
                    }
                    return;
                }
                Help(p);
                return;
            }
            var who = Player.Find(args[0]);

            if (who == null || who.GetType() == typeof(ConsolePlayer))
            {
                p.SendMessage("The player you want to follow doesn't exist");
                return;
            }

            p.SendMessage("You are now following " + who.Color + who.Username);
            p.ExtraData.ChangeOrCreate <object, object>("FollowData", who.Username);
            p.GlobalDie();
            p.IsHidden = !p.IsHidden;
            if (!p.IsHidden)
            {
                p.SpawnThisPlayerToOtherPlayers();
            }
            who.OnPlayerMove.Normal += new MCForge.API.Events.Event <Player, MCForge.API.Events.MoveEventArgs> .EventHandler(OnPlayerMove);
        }
示例#34
0
 public void Use(MCForge.Entity.Player p, string[] args)
 {
     p.SendMessage("Break block to get info");
     p.OnPlayerBlockChange.Normal += OnBlockChange;
 }
示例#35
0
 public void Help(MCForge.Entity.Player p)
 {
     p.SendMessage("/follow <name> - follows a user, great if you have your suspicions");
     p.SendMessage("/follow - to stop following a player (if you are already following one)");
 }