/serverset - A command for hosted servers. v1

/serverset - A command for hosted servers. v1

Postby Leeizazombie » 09 Dec 2013, 19:17

As a person who has a server, I find it hard to keep asking my hoster to keep changing certain settings, so with this command I hope to eliminate the waiting process and just do it via commands. So far I only added two things, but it's only a version 1.

Code: Select all
//Server Settings V1 by LeeIzaZombie
using System;
using System.Threading;
using System.IO;

namespace MCDzienny
{
    public class CmdServerSet : Command
    {
        public override string name { get { return "serverset"; } }
        public override string shortcut { get { return "ss"; } }
        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 thirdarguement = message.Split(' ')[1];
            string secondarguement = message.Split(' ')[0];
            if (secondarguement == "name")
            {
                Server.name = thirdarguement;
                Command.all.Find("reveal").Use(p, "");
                Thread.Sleep(2000); //Waits for reveal text to show.
                Player.SendMessage(p, "%bYou've named the server to:%a " + message);
            }

            if (secondarguement == "motd")
            {
                Server.motd = thirdarguement;
                Command.all.Find("reveal").Use(p, "");
                Thread.Sleep(2000); //Waits for reveal text to show.
                Player.SendMessage(p, "%bYou've changed the server's motd to:%a " + message);
            }
        }
        public override void Help(Player p)
        {
            Player.SendMessage(p, "/%serverset [option] [setting]");
            Player.SendMessage(p, "Options:");
            Player.SendMessage(p, "Name [setting] - Sets the server's name.");
            Player.SendMessage(p, "motd [setting] - Sets the server's motd.");
        }
    }
}

I'd like to thank ismellike for broadening my knowledge with the use of "Splits".

Controls:
/serverset name [message] -- Changes you servers name to [message]
/serverset motd [message] -- Changes you servers motd to [message]
Enjoy!
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: /serverset - A command for hosted servers. v1

Postby Leeizazombie » 09 Dec 2013, 19:25

*Edit: As a person who has a "hosted" server
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: /serverset - A command for hosted servers. v1

Postby joppiesaus » 09 Dec 2013, 19:32

Nice! Good code. I am not so sure about the
Code: Select all
Thread.Sleep(2000);
thinggy, and I recommend message.Trim().Split() because it will filter all the useless spaces(if I put for example 4 spaces instead of 2)
But! Nice Code! <ok>
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: /serverset - A command for hosted servers. v1

Postby Leeizazombie » 09 Dec 2013, 19:34

I just tought that the Thread.Sleep would give time for the player to download the map and "then" show the player message so that they notice it.
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: /serverset - A command for hosted servers. v1

Postby joppiesaus » 09 Dec 2013, 20:29

Leeizazombie wrote:I just tought that the Thread.Sleep would give time for the player to download the map and "then" show the player message so that they notice it.

Good point. Didn't think of that.
joppiesaus
 
Posts: 379
Joined: 20 Aug 2012, 07:28
Location: in a obsedian house, with glass in it so i can see the lava!


Return to Custom Commands

Who is online

Users browsing this forum: No registered users and 2 guests

cron