Beispiel #1
0
        public override void Use(Player p, params string[] args)
        {
            //TODO: Add in checks so you can't kick people higher ranked than you
            if (args.Length == 0 || args[0].ToLower() == "help")
            {
                Help(p);
                return;
            }

            Player KickPlayer = Player.FindPlayer(args[0]);
            if (KickPlayer != null && KickPlayer != p)
            {
                if (args.Length >= 2)
                {
                    StringBuilder reason = new StringBuilder();
                    for (int i = 1; i < args.Length; i++)
                    {
                        reason.Append(args[i] + " ");
                    }
                    reason.Remove(reason.Length - 1, 1);

                    KickPlayer.Kick(reason.ToString());
                }
                else
                {
                    KickPlayer.Kick("You were kicked by " + p.username);
                }
            }
            else if (KickPlayer == p)
            {
                p.SendMessage(HelpBot + "Why are you trying to kick yourself??");
            }
            else if (KickPlayer == null)
                p.SendMessage(HelpBot + "Cannot find player: " + args[0]);
        }
 public override void Use(Player p, params string[] args)
 {
     if (args.Length == 0) { Help(p); return; }
     else if (args.Length == 1)
     {
         Random rand = new Random();
         int seed = new Random().Next();
         p.SendMessage("Creating world with seed: " + seed);
         double x = 0; double y = 127; double z = 0;
         World temp = new World(x, y, z, args[0], seed);
         //while (Chunk.GetChunk((int)x, (int)z, temp).GetBlock((int)x, (int)(y - 1), (int)z) == 0)
         //	y--;
         temp.SpawnY = y;
         World.worlds.Add(temp);
         p.SendMessage("World " + args[0] + " MADE!");
     }
     else if (args.Length == 2 || args.Length == 3)
     {
         int seed = Convert.ToInt32(args[1]);
         p.SendMessage("Creating world with seed: " + seed);
         double x = 0; double y = 127; double z = 0;
         World temp = new World(x, y, z, args[0], seed);
         if (args.Length == 3)
         {
             int limit = Convert.ToInt32(args[2]);
             if (limit > 2)
                 temp.ChunkLimit = limit;
             else { p.SendMessage("maxchunks cannot be less than 3. creating with maxchunks 3."); temp.ChunkLimit = 3; }
         }
         World.worlds.Add(temp);
         p.SendMessage("World " + args[0] + " MADE!");
     }
 }
Beispiel #3
0
        public override void Use(Player p, params string[] args)
        {
            World w = World.Find(p.level.name);

            if (args.Length == 1)
            {

                if (args[0] == "off")
                {
                    foreach (Player q in Player.players)
                    {
                        w.rain(false, q);
                    }
                    p.SendMessage(Color.Red + "Stopping rain..");
                    w.Israining = false;
                   // p.SendMessage("rain is: " + w.isRain().ToString());

                }
                if (args[0] == "on")
                {
                    foreach (Player q in Player.players)
                    {
                        w.SendLightning(1, 1, 100, 2, q);
                        w.rain(true, q);
                    }
                    w.Israining = true;
                  //  p.SendMessage("rain is: " + w.isRain().ToString());

                    p.SendMessage(Color.Green + "Starting rain...");
                }
                if (args[0] == "status") { p.SendMessage(Color.Purple + "Rain is: " + w.Israining); }

            }
            else { Help(p); return; }
        }
Beispiel #4
0
 public override void Use(Player p, params string[] args)
 {
     if (args.Length != 0 && args.Length != 1)
     {
         Help(p);
         return;
     }
     if (args.Length == 1)
     {
         int update = IntParseFast(args[0].ToLower());
         if (update > 0 & update < 10000)
         {
             p.FlyingUpdate = update;
             p.SendMessage("Flying update interval set to " + IntParseFast(args[0]));
         }
         else if (update == 61964 || update == 29964) Help(p);
         else p.SendMessage("Cant set interval to " + args[0]);
         return;
     }
     if (p.isFlying)
     {
         p.isFlying = false;
         p.SendMessage("Stopped flying");
         return;
     }
     p.SendMessage("You are now flying. &cJump!");
     p.isFlying = true;
     //Thread flyThread = new Thread(() =>
     //{
         //flyingcode(p);
     //}) { Name = "FlyThread-" + p.username };
     //flyThread.Start();
 }
Beispiel #5
0
        void Blockchange1(Player p, int x, int y, int z, short type)
        {
            p.ClearBlockChange();
            p.SendBlockChange(x, (byte)y, z, p.level.GetBlock(x, y, z), p.level.GetMeta(x, y, z));

            p.SendMessage("Position: " + x + "," + y + "," + z);
            p.SendMessage("Type: " + p.level.GetBlock(x, y, z));
            p.SendMessage("Meta: " + p.level.GetMeta(x, y, z));
        }
Beispiel #6
0
 public override void Use(Player p, params string[] args)
 {
     World.worlds.ForEach(delegate(World w)
     {
         p.SendMessage(w.name);
         p.SendMessage("Chunks: " + w.chunkData.Count);
         p.SendMessage("Physics: " + w.physics.CheckCount);
         p.SendMessage("Updates: " + w.physics.UpdateCount);
     });
 }
Beispiel #7
0
 public void SendItem(Player p, short item, byte count, short meta)
 {
     if (FindBlocks.ValidItem(item))
     {
         p.inventory.Add(item, count, meta);
         p.SendMessage(HelpBot + "Enjoy!");
     }
     else
     {
         p.SendMessage(HelpBot + "Invalid item ID.");
     }
 }
        public override void Use(Player p, params string[] args)
        {
            if (args.Length == 0)
            {
                Help(p);
                return;
            }

            if (args.Length == 1)
            {
                string name;
                Player pl = Player.FindPlayer(args[0].ToLower());

                if (pl != null)
                    name = pl.username.ToLower();
                else
                    name = args[0].ToLower();

                if(Server.WhiteList.Contains(name))
                {
                    Server.WhiteList.Remove(name);
                    p.SendMessage(HelpBot + name + " removed from whitelist.");
                }
                else
                {
                    Server.WhiteList.Add(name);
                    p.SendMessage(HelpBot + name + " added to whitelist.");
                }
            }
            else
            {
                foreach(string s in args)
                {
                    string name;
                    Player pl = Player.FindPlayer(s.ToLower());

                    if (pl != null)
                        name = pl.username.ToLower();
                    else
                        name = s.ToLower();

                    if(Server.WhiteList.Contains(name))
                    {
                        Server.WhiteList.Remove(name);
                    }
                    else
                    {
                        Server.WhiteList.Add(name);
                    }
                }
                p.SendMessage(HelpBot + "whitelist modified.");
            }
        }
 public override void Use(Player p, params string[] args)
 {
     switch (args.Length)
     {
         case 1:
             try { if (World.Find(args[0]) == null) { World.LoadLVL(args[0]); p.SendMessage("Loaded " + args[0]); } else p.SendMessage("Level already loaded."); }
             catch { p.SendMessage("Failed to Load " + args[0]); }
             break;
         default:
             Help(p);
             break;
     }
 }
        public override void Use(Player p, params string[] args)
        {
            int port = 25565;

            if (args.Length == 0)
            {
                checkport(25565, p);
            }
            else if (args.Length == 1)
            {
                try { port = Convert.ToInt16(args[0]); checkport(port, p); }
                catch (Exception e) { p.SendMessage("port must be a number"); p.SendMessage(e.Message); p.SendMessage(e.Source); }
            }
        }
Beispiel #11
0
        public override void Use(Player p, params string[] args)
        {
            if (args.Length == 0)
            {
                Help(p);
                return;
            }

            if (Server.BanList.Contains(args[0].ToLower()))
            {
                Server.BanList.Remove(args[0].ToLower());
                p.SendMessage(HelpBot + args[0] + " was unbanned.");
            }
            else p.SendMessage(HelpBot + "Couldn't find that banned player.");
        }
Beispiel #12
0
        //public void Add(Player p, byte level) { Add(p, (short)(((short)level) * 20)); }
        /// <summary>
        /// Adds a number to players experience
        /// </summary>
        /// <param name="p">Player, duh!</param>
        /// <param name="exp">The ammount of experience to add</param>
        public void Add(Player p, short exp)
        {
            byte oldlevel = _Level;
            for (int i = 0; i < exp; i++)
            {
                _TotalExp++;
                if (_TotalExp > 780) { _Experience = 0; _Level = 12; continue; }
                _Experience++;
                if (_Experience == ((_Level + 1) * 10)) { _Experience = 0; _Level++; }
            }
            if (oldlevel < _Level) { p.SendMessage("Congratulations! You are now level " + _Level); /*RewardItem(p);*/ } // The reward is annoying as hell!
            //if (_Experience > 127) { _Experience = 127; }

            /*switch (_TotalExp)
            {
                case 10: p.inventory.Add(277, 1, 0); break;
                case 30: p.inventory.Add(278, 1, 0); break;
                case 60: p.inventory.Add(345, 1, 0); break;
                case 100: p.inventory.Add(347, 1, 0); break;
                case 210: p.inventory.Add(358, 1, 0); break;
            }*/
            //_TotalExp += exp;
            //_Level = (byte)(_TotalExp / 10);
            //_Experience = (byte)(_TotalExp - (_Level * 10));

            //Server.Log(_Experience + " " + _Level + " " + _TotalExp);
            //Player.GlobalMessage("Bar= " + _Experience + " level = " + _Level + " totalexp = " + _TotalExp);
            SendExperience(p, _Experience, _Level, _TotalExp);
        }
        public override void Use(Player p, params string[] args)
        {
            if (args.Length < 2)
            {
                Help(p);
                return;
            }

            Player pr = Player.FindPlayer(args[0]);
            Group gr = Group.FindGroup(args[1]);

            if (pr == p)
            {
                p.SendMessage(HelpBot + "You can't change your own rank.");
                return;
            }

            if (!GroupUtils.IsHigherRank(p.group, gr))
            {
                p.SendMessage(HelpBot + "You can't rank someone higher than your own rank.");
                return;
            }
            if (gr != null && pr != null)
            {
                pr.group = gr;
                p.SendMessage("There have a nice day!");
                pr.SendMessage(HelpBot + p.username + " set your rank to " + gr.Name + ". Congratulations!");
            }
        }
Beispiel #14
0
 public override void Use(Player p, params string[] args)
 {
     if (args.Length != 1) { Help(p); return; }
     int radius;
     try
     {
         radius = Convert.ToInt32(args[0]);
     }
     catch
     {
         p.SendMessage("Invalid radius.");
         return;
     }
     if (radius > 15)
     {
         p.SendMessage("Radius too big");
         return;
     }
     if (radius < 3)
     {
         p.SendMessage("Radius too small");
         return;
     }
     p.viewdistance = radius;
 }
Beispiel #15
0
 public override void Use(Player p, params string[] args)
 {
     if (args.Length >= 2)
     {
         Help(p);
         return;
     }
     if (args.Length == 1)
     {
         Player who = Player.FindPlayer(args[0]); // cannot use a using here or players dissapear.
         if (who != null)
         {
             if (!who.IsOnFire)
             {
                 who.SetFire(true);
                 Player.GlobalMessage(String.Format("{0} was set on fire by {1}", who.username, p.username));
             }
             else
             {
                 who.SetFire(false);
                 Player.GlobalMessage(String.Format("{0} was extinguished by {1}", who.username, p.username));
             }
             return;
         }
         Help(p);
     }
     if (args.Length == 0)
     {
         p.SetFire(!p.IsOnFire ? true : false);
         p.SendMessage("You are on fire = " + p.IsOnFire);
         return;
     }
 }
Beispiel #16
0
        public override void Use(Player p, params string[] args)
        {
            if (args.Length > 0)
            {
                Help(p);
                return;
            }

            StringBuilder sb = new StringBuilder();
            /*lock (Player.GetPlayerLock())
            {
                if (Player.players.Count > 0)
                    for (int i = 0; i < Player.players.Count; i++)
                    {
                        sb.Append(Player.players[i].Username);

                        if (i != Player.players.Count - 1)
                            sb.Append(", ");
                    }
                else
                    p.SendMessage("No body is minecrafting right now.");

            }*/

            p.SendMessage("Currently Online: " + sb.ToString());
        }
        public override void Use(Player p, params string[] args)
        {
            SpheroidData cd; cd.x = 0; cd.y = 0; cd.z = 0;
            cd.type = -1; cd.vertical = false;

            if (args.Length >= 2)
            {
                try { cd.type = Convert.ToInt16(args[0]); }
                catch { cd.type = FindBlocks.FindBlock(args[0]); }
                if (!FindBlocks.ValidBlock(cd.type)) { p.SendMessage("There is no block \"" + args[0] + "\"."); return; }

                cd.vertical = (args[1].ToLower() == "vertical");
            }
            else if (args.Length >= 1)
            {
                cd.vertical = (args[0].ToLower() == "vertical");

                if (!cd.vertical)
                {
                    try { cd.type = Convert.ToInt16(args[0]); }
                    catch { cd.type = FindBlocks.FindBlock(args[0]); }
                    if (!FindBlocks.ValidBlock(cd.type)) { p.SendMessage("There is no block \"" + args[0] + "\"."); return; }
                }
            }

            p.ClearBlockChange();
            p.BlockChangeObject = cd;
            p.OnBlockChange += Blockchange1;
            p.SendMessage("Place/delete a block at 2 corners for the spheroid.");
        }
 public override void Use(Player p, params string[] args)
 {
     World.worlds.ForEach(delegate(World w)
     {
         p.SendMessage(w.name + ": " + w.chunkData.Count);
     });
 }
        public override void Use(Player p, params string[] args)
        {
            if (args.Length == 0)
            {
                Help(p);
                return;
            }

            Player pr = Player.FindPlayer(args[0]);
            if (pr == null)
            {
                p.SendMessage(HelpBot + "Could not find player.");
                return;
            }
            if (pr == p)
            {
                p.SendMessage(HelpBot + "You can't promote yourself.");
                return;
            }
            if (GroupUtils.PromotePlayer(pr))
            {
                p.SendMessage(HelpBot + "Player promoted.");
                pr.SendMessage(HelpBot + p.username + " promoted you. Congratulations!");
            }
            else
                p.SendMessage(HelpBot + "Could not promote player");
        }
Beispiel #20
0
        public override void Use(Player p, params string[] args)
        {
            if (args.Length == 0)
            {
                Help(p);
                return;
            }

            Player banplayer = Player.FindPlayer(args[0]);

            if (banplayer != null)
            {
                if (args.Length >= 2)
                {
                    banplayer.Kick("You were banned: " + String.Join(" ", args, 1, args.Length - 1));
                    Server.BanList.Add(banplayer.username.ToLower());
                }
                else
                {
                    banplayer.Kick("You were banned by " + p.username);
                    Server.BanList.Add(banplayer.username.ToLower());
                }
                Player.GlobalMessage(Color.Announce + banplayer.username + " has been banned!");

            }
            else
            {
                Server.BanList.Add(args[0]);
                p.SendMessage(HelpBot + args[0] + " has been banned");
            }

            foreach(string s in Server.BanList)
                Server.Log(s);
        }
Beispiel #21
0
 public override void Use(Player p, params string[] args)
 {
     if (args.Length == 0) { Help(p); return; }
     else if (args.Length == 1)
     {
         Random rand = new Random();
         long seed = new Random().Next();
         p.SendMessage("Creating world with seed: " + seed);
         double x = rand.Next(50); double y = 64; double z = rand.Next(50);
         World temp = new World(x, y, z, args[0]);
         //while (Chunk.GetChunk((int)x, (int)z, temp).GetBlock((int)x, (int)(y - 1), (int)z) == 0)
         //	y--;
         temp.SpawnY = y;
         World.worlds.Add(temp);
         p.SendMessage("World " + args[0] + " MADE!");
     }
 }
Beispiel #22
0
 public override void Use(Player p, params string[] args)
 {
     p.ClearBlockChange();
     p.BlockChangeObject = args.Length > 0 ? byte.Parse(args[0]) : (byte)0;
     p.OnBlockChange += Blockchange1;
     p.SendMessage("Place/delete a block where you want the tree.");
     //p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
 }
Beispiel #23
0
        public override void Use(Player p, params string[] args)
        {
            if (args.Length >= 1)
            {
                Help(p);
            }

            if (!p.DoNotDisturb)
            {
                p.DoNotDisturb = true;
                p.SendMessage("You will not be able to recieve or send any global chat. Type /dnd again to recieve chat again", WrapMethod.Chat);
            }
            else if (p.DoNotDisturb)
            {
                p.DoNotDisturb = false;
                p.SendMessage("You will now be able to recieve and send global chat again. I don't why you'd want to though.", WrapMethod.Chat);
            }
        }
Beispiel #24
0
        public override void Use(Player p, params string[] args)
        {
            if (args.Length < 1) { Help(p); return; }

            byte meta = 0;
            try { meta = byte.Parse(args[0]); }
            catch { p.SendMessage("Invalid input."); return; }

            if (meta < 0)
                meta = 0;
            else if (meta > 15)
                meta = 15;

            p.ClearBlockChange();
            p.BlockChangeObject = meta;
            p.OnBlockChange += Blockchange1;
            p.SendMessage("Place/delete a block to change it's meta data.");
        }
Beispiel #25
0
        public override void Use(Player p, params string[] args)
        {
            if (args.Length <= 1)
            {
                Help(p);
                return;
            }

            Player targetP = Player.FindPlayer(args[0]);
            if (targetP != null)
            {
                targetP.SendMessage(Color.DarkRed + "[" + p.username + ">>> Me]" + Color.White + MakeString(args, 1, args.Length));
                p.SendMessage(HelpBot + "Message Sent.");
            }
            else
            {
                p.SendMessage(HelpBot + "Could not find specified player.");
            }
        }
Beispiel #26
0
        public override void Use(Player p, params string[] args)
        {
            //maybe add a silent option
            if (args.Length >= 1)
            {
                Help(p);
            }

            p.SendMessage(Color.DarkTeal + "Currently doesn't do anything. :(");
            if (!p.GodMode)
            {
                p.GodMode = true;
                p.SendMessage("You are now invincible. Type /god again to be a mortal", WrapMethod.Chat);
                Player.GlobalMessage(p.username + " is now being cheap and immortal, kill them!");
            }
            else if (p.GodMode)
            {
                p.GodMode = false;
                p.SendMessage("You are no longer invincible.", WrapMethod.Chat);
                Player.GlobalMessage(p.username + " is no longer being a wuss, don't kill them.");
            }
        }
Beispiel #27
0
        public override void Use(Player p, params string[] args)
        {
            try
            {
                if (args[0] == "status") { p.SendMessage(Color.Purple + "Rain is: " + p.level.Israining); return; }
            }
            catch { }

            if (p.level.Israining)
            {
                p.SendMessage(Color.Red + "Stopping rain..");
                p.level.Rain(false);
                p.level.Israining = false;

            }
            else
            {
                p.SendMessage(Color.Red + "Starting rain..");
                p.level.Rain(true);
                p.level.Israining = true;
            }
        }
Beispiel #28
0
 public override void Use(Player p, params string[] args)
 {
     switch (args.Length)
     {
         case 1:
             try
             {
                     World w = World.Find(args[0]);
                 if (w == null) p.SendMessage("Level not found.");
                 else if (w == Server.mainlevel) p.SendMessage("Cannot unload main level.");
                 else
                 {
                     for (int i = 0; i < Player.players.Count; i++)
                     {
                         if (Player.players[i].level == w) Command.core.Find("goto").Use(Player.players[i], Server.mainlevel.name);
                     }
                     w.SaveLVL();
                     w.chunkData = null;
                     w.generator = null;
                     w.lightningTimer.Dispose();
                     w.timeupdate.Dispose();
                     w.ToGenerate.Clear();
                     w.weatherTimer.Dispose();
                     w.windows.Clear();
                     World.worlds.Remove(w);
                     GC.Collect();
                     GC.WaitForPendingFinalizers();
                     p.SendMessage("Unloaded " + args[0]);
                 }
             }
             catch { p.SendMessage("Failed to unload " + args[0]); }
             break;
         default:
             Help(p);
             break;
     }
 }
Beispiel #29
0
 public override void Use(Player p, params string[] args)
 {
     if (World.Find(args[0]) != null && p.level.name != args[0])
     {
         Player.players.ForEach(delegate(Player p1) { if (p1.level == p.level) p1.SendDespawn(p.id); p.SendDespawn(p1.id); });
         foreach (Chunk c in p.level.chunkData.Values) { p.SendPreChunk(c, 0); }
         p.level = World.Find(args[0]);
         p.Teleport_Player(p.level.SpawnX, p.level.SpawnY, p.level.SpawnZ);
         foreach (Chunk c in p.level.chunkData.Values) { p.SendPreChunk(c, 1); System.Threading.Thread.Sleep(10); p.SendChunk(c); c.RecalculateLight(); }
         p.VisibleChunks.Clear();
         p.UpdateChunks(true, true);
         return;
     }
     p.SendMessage("GOTO FAILED");
 }
Beispiel #30
0
 public override void Use(Player p, params string[] args)
 {
     if (World.Find(args[0]) != null && p.level.name != args[0])
     {
         Player.players.ForEach(delegate(Player p1) { if (p1.level == p.level) p1.SendDespawn(p.id); p.SendDespawn(p1.id); });
         p.level = World.Find(args[0]);
         p.pos[0] = p.level.SpawnX;
         p.pos[1] = p.level.SpawnY;
         p.pos[2] = p.level.SpawnZ;
         p.VisibleChunks.Clear();
         p.UpdateChunks(true, true);
         p.Teleport_Player(64, 64, 64);
         return;
     }
     p.SendMessage("GOTO FAILED");
 }