Example #1
0
        public override bool doProcess(string[] args)
        {
            if (!hasPermission())
            {
                permissionError(); return(false);
            }

            if (args.Length == 1)
            {
                string[] coords = args[0].Split(':');
                if (coords.Length == 6)
                {
                    string sector = coords[0].ToLower().Trim();
                    if (sector == "alpha" || sector == "beta" || sector == "gamma" || sector == "delta" || sector == "sectorx")
                    {
                        int sysX     = int.Parse(coords[1]);
                        int sysY     = int.Parse(coords[2]);
                        int sysZ     = int.Parse(coords[3]);
                        int planet   = int.Parse(coords[4]);
                        int satelite = int.Parse(coords[5]);
                        if (planet >= 0 && satelite >= 0)
                        {
                            Extensions.WorldCoordinate newHome = new Extensions.WorldCoordinate(sector, sysX, sysY, sysZ, planet, satelite);
                            if (!newHome.Equals(this.client.playerData.home))
                            {
                                this.client.playerData.home = newHome;
                                this.client.sendCommandMessage("Your home is now set to " + newHome.ToString());
                                return(true);
                            }
                            else
                            {
                                this.client.sendCommandMessage("Your home is already set to this location.");
                                return(false);
                            }
                        }
                        else
                        {
                            this.client.sendCommandMessage("Invalid planet/satellite. Must be positive or 0.");
                            return(false);
                        }
                    }
                    else
                    {
                        this.client.sendCommandMessage("Invalid sector name. Must be either alpha, beta, gamma, delta or sectorx");
                        return(false);
                    }
                }
                else
                {
                    this.client.sendCommandMessage("Invalid syntax. Coords must be in this format: sector:x:y:z:planet:satellite");
                    return(false);
                }
            }
            else
            {
                this.client.sendCommandMessage("Invalid syntax. Use: /sethome <coords>");
                this.client.sendCommandMessage("You can find the coords of the current world using /find.");
                return(false);
            }
        }
Example #2
0
        public override bool doProcess(string[] args)
        {
            if (!hasPermission()) { permissionError(); return false; }

            if (args.Length == 1)
            {
                string[] coords = args[0].Split(':');
                if (coords.Length == 6)
                {
                    string sector = coords[0].ToLower().Trim();
                    if (sector == "alpha" || sector == "beta" || sector == "gamma" || sector == "delta" || sector == "sectorx")
                    {
                        int sysX = int.Parse(coords[1]);
                        int sysY = int.Parse(coords[2]);
                        int sysZ = int.Parse(coords[3]);
                        int planet = int.Parse(coords[4]);
                        int satelite = int.Parse(coords[5]);
                        if (planet >= 0 && satelite >= 0)
                        {
                            Extensions.WorldCoordinate newHome = new Extensions.WorldCoordinate(sector, sysX, sysY, sysZ, planet, satelite);
                            if (!newHome.Equals(this.client.playerData.home))
                            {
                                this.client.playerData.home = newHome;
                                this.client.sendCommandMessage("Your home is now set to " + newHome.ToString());
                                return true;
                            }
                            else
                            {
                                this.client.sendCommandMessage("Your home is already set to this location.");
                                return false;
                            }
                        }
                        else
                        {
                            this.client.sendCommandMessage("Invalid planet/satellite. Must be positive or 0.");
                            return false;
                        }
                    }
                    else
                    {
                        this.client.sendCommandMessage("Invalid sector name. Must be either alpha, beta, gamma, delta or sectorx");
                        return false;
                    }
                }
                else
                {
                    this.client.sendCommandMessage("Invalid syntax. Coords must be in this format: sector:x:y:z:planet:satellite");
                    return false;
                }
            }
            else
            {
                this.client.sendCommandMessage("Invalid syntax. Use: /sethome <coords>");
                this.client.sendCommandMessage("You can find the coords of the current world using /find.");
                return false;
            }
        }