using System;
namespace MCDzienny
{
public class CmdSphere : Command
{
public override string name { get { return "sphere"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return "build"; } }
public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
public override void Use(Player p, string message)
{
string radius = "";
string block = "";
if (message == "") { Help(p); return; }
else if (message.Split(' ')[0] == "h")
{
try
{
radius = message.Split(' ')[1];
Convert.ToUInt16(radius);
}
catch
{
Player.SendMessage(p, "Please specify the radius of your sphere.");
return;
}
try
{
block = message.Split(' ')[2];
}
catch
{
Player.SendMessage(p, "Please specify the block.");
return;
}
Command.all.Find("ellipsoid").Use(p, block);
int x = (ushort)(p.pos[0] / 32 + Convert.ToUInt16(radius)), y = (ushort)(p.pos[1] / 32 + Convert.ToUInt16(radius)), z = (ushort)(p.pos[2] / 32 + Convert.ToUInt16(radius));
Command.all.Find("click").Use(p, String.Format(x + " " + y + " " + z));
x = (ushort)(p.pos[0] / 32 - Convert.ToUInt16(radius)); y = (ushort)(p.pos[1] / 32 - Convert.ToUInt16(radius)); z = (ushort)(p.pos[2] / 32 - Convert.ToUInt16(radius));
Command.all.Find("click").Use(p, String.Format(x + " " + y + " " + z));
}
else
{
try
{
radius = message.Split(' ')[0];
Convert.ToUInt16(radius);
}
catch
{
Player.SendMessage(p, "Please specify the radius of your sphere.");
return;
}
try
{
block = message.Split(' ')[1];
}
catch
{
Player.SendMessage(p, "Please specify the block.");
return;
}
Command.all.Find("spheroid").Use(p, block);
int x = (ushort)(p.pos[0] / 32 + Convert.ToUInt16(radius)), y = (ushort)(p.pos[1] / 32 + Convert.ToUInt16(radius)), z = (ushort)(p.pos[2] / 32 + Convert.ToUInt16(radius));
Player.SendMessage(p, String.Format(x + " " + y + " " + z));
Command.all.Find("click").Use(p, String.Format(x + " " + y + " " + z));
x = (ushort)(p.pos[0] / 32 - Convert.ToUInt16(radius)); y = (ushort)(p.pos[1] / 32 - Convert.ToUInt16(radius)); z = (ushort)(p.pos[2] / 32 - Convert.ToUInt16(radius));
Command.all.Find("click").Use(p, String.Format(x + " " + y + " " + z));
}
}
public override void Help(Player p)
{
Player.SendMessage(p, "/sphere <h> [radius] [block] -- creates a <hollow> sphere with your position as the center");
}
}
}
Return to Freebuild Suggestions
Users browsing this forum: No registered users and 5 guests