/DownloadCommand

/DownloadCommand

Postby Leeizazombie » 16 Dec 2013, 21:25

Please note I take no credit for this full command, this was originated by qpqpqp123's Download Level command, and I have altered it do allow people to download commands that are uploaded to a website (dropbox does not work!)

Here is an example on how to use it: /dlc test www.test.com/test.cs
That will download the test.cs and put in in the commands folder named "Cmdtest.cs" to be ready to be compiled.

Code: Select all
using System;
using System.Net;
namespace MCDzienny
{
    public class CmdDownloadCommand : Command
    {
        public override string name { get { return "downloadcommand"; } }
        public override string shortcut { get { return "dlc"; } }
        public override string type { get { return "mod"; } }
        public override bool museumUsable { get { return false; } }
        public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
        public override void Use(Player p, string message)
        {
            string[] a = message.Split(' ');
            if (a.Length != 2)
            {
                Help(p);
                return;
            }
            string name = "Cmd" + a[0] + ".cs";
            try
            {

                using (WebClient web = new WebClient())
                {
                    if (a[0].Substring(0, 4) != "http")
                    {
                        message = "http://" + a[1];
                    }


                    if (System.IO.File.Exists("extra/commands/source/" + name))
                    {
                        Player.SendMessage(p, "You already have a command with that name, please choose another name.");
                        return;
                    }
                    Player.SendMessage(p, "Downloading file from: &f" + a[0] + Server.DefaultColor + ", please wait.");

                    web.DownloadFile(a[1], "extra/commands/source/" + name);
                }
                Player.SendMessage(p, "Download complete. Command name :%3" + name);

            }
            catch
            {
                Player.SendMessage(p, "%cDownload failed.");
            }
        }

        public override void Help(Player p)
        {
            Player.SendMessage(p, "/DownloadCommand (name for command) (URl)- Dowload Command.");
        }
    }
}
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: /DownloadCommand

Postby lordmaker1234 » 16 Dec 2013, 23:28

Nice Command And Is Gonna Be Very Very helpful :mrgreen: :mrgreen: :mrgreen:
lordmaker1234
 
Posts: 9
Joined: 15 Dec 2013, 18:25

Re: /DownloadCommand

Postby Leeizazombie » 16 Dec 2013, 23:33

lordmaker1234 wrote:Nice Command And Is Gonna Be Very Very helpful :mrgreen: :mrgreen: :mrgreen:

Thanks, Hope you enjoy it! <ok>
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: /DownloadCommand

Postby lucasds12 » 17 Dec 2013, 02:21

Not bad, might be used in many ways, I think this will make server owners have less time making commands.
-Lucas
There is only one thing I do in life, that's contributing here.
lucasds12
 
Posts: 334
Joined: 17 Apr 2013, 16:17
Location: In the deep caves.

Re: /DownloadCommand

Postby HelloWorldCool » 17 Dec 2013, 03:34

very intriguing, but does this mean everyone will need to upload the .cs file now?
unfortunately the forum cannot convert [c o d e] to .cs eh? :ugeek:

well anyway, still a great command <ok>
Download fCraft maps! - viewtopic.php?f=25&t=3012!



Note: The Developer(s) of MCDzienny have resigned and the software is no longer supported.
Errors are bound to occur and Mojang has not attempted to resolve them.
User avatar
HelloWorldCool
 
Posts: 867
Joined: 18 Oct 2011, 00:19
Location: MCDzienny Forums, HelloWorldCool Forums

Re: /DownloadCommand

Postby Leeizazombie » 17 Dec 2013, 03:44

The reason I made this is because my server is hosted by someone else, and while they're too busy, I can upload my .cs to a website and use the download command and have it without bothering my hoster.
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: /DownloadCommand

Postby joppiesaus » 17 Dec 2013, 17:04

Awesome! If you have a website, you can just upload a command and everyone can download it!
joppiesaus
 
Posts: 379
Joined: 20 Aug 2012, 07:28
Location: in a obsedian house, with glass in it so i can see the lava!

Re: /DownloadCommand

Postby Leeizazombie » 17 Dec 2013, 17:34

The only thing this code needs now is to add the command's name to the cmdautoload.txt file!
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.


Return to Custom Commands

Who is online

Users browsing this forum: No registered users and 2 guests

cron