mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Use X.Parse instead of Convert.Y in more places
This commit is contained in:
parent
87effa41d8
commit
eee95f7a10
@ -40,19 +40,19 @@ namespace MCGalaxy.Bots {
|
|||||||
switch (args[0].ToLower()) {
|
switch (args[0].ToLower()) {
|
||||||
case "walk":
|
case "walk":
|
||||||
case "teleport":
|
case "teleport":
|
||||||
newPos.x = Convert.ToUInt16(args[1]);
|
newPos.x = ushort.Parse(args[1]);
|
||||||
newPos.y = Convert.ToUInt16(args[2]);
|
newPos.y = ushort.Parse(args[2]);
|
||||||
newPos.z = Convert.ToUInt16(args[3]);
|
newPos.z = ushort.Parse(args[3]);
|
||||||
newPos.rotx = Convert.ToByte(args[4]);
|
newPos.rotx = byte.Parse(args[4]);
|
||||||
newPos.roty = Convert.ToByte(args[5]);
|
newPos.roty = byte.Parse(args[5]);
|
||||||
break;
|
break;
|
||||||
case "wait":
|
case "wait":
|
||||||
case "speed":
|
case "speed":
|
||||||
newPos.seconds = Convert.ToInt16(args[1]); break;
|
newPos.seconds = short.Parse(args[1]); break;
|
||||||
case "nod":
|
case "nod":
|
||||||
case "spin":
|
case "spin":
|
||||||
newPos.seconds = Convert.ToInt16(args[1]);
|
newPos.seconds = short.Parse(args[1]);
|
||||||
newPos.rotspeed = Convert.ToInt16(args[2]);
|
newPos.rotspeed = short.Parse(args[2]);
|
||||||
break;
|
break;
|
||||||
case "linkscript":
|
case "linkscript":
|
||||||
newPos.newscript = args[1]; break;
|
newPos.newscript = args[1]; break;
|
||||||
|
@ -42,10 +42,9 @@ namespace MCGalaxy.Commands {
|
|||||||
string newRankName = newRank == null ? parts[7] : newRank.ColoredName;
|
string newRankName = newRank == null ? parts[7] : newRank.ColoredName;
|
||||||
string oldRankName = oldRank == null ? parts[8] : oldRank.ColoredName;
|
string oldRankName = oldRank == null ? parts[8] : oldRank.ColoredName;
|
||||||
|
|
||||||
int minutes = Convert.ToInt32(parts[2]), hours = Convert.ToInt32(parts[3]);
|
int min = int.Parse(parts[2]), hour = int.Parse(parts[3]);
|
||||||
int days = Convert.ToInt32(parts[4]), months = Convert.ToInt32(parts[5]);
|
int day = int.Parse(parts[4]), month = int.Parse(parts[5]), year = int.Parse(parts[6]);
|
||||||
int years = Convert.ToInt32(parts[6]);
|
DateTime timeRanked = new DateTime(year, month, day, hour, min, 0);
|
||||||
DateTime timeRanked = new DateTime(years, months, days, hours, minutes, 0);
|
|
||||||
|
|
||||||
string reason = parts.Length <= 9 ? "(no reason given)" :
|
string reason = parts.Length <= 9 ? "(no reason given)" :
|
||||||
CP437Reader.ConvertToRaw(parts[9].Replace("%20", " "));
|
CP437Reader.ConvertToRaw(parts[9].Replace("%20", " "));
|
||||||
|
@ -45,9 +45,9 @@ namespace MCGalaxy.Commands {
|
|||||||
Player.Message(p, who.ColoredName + " %Shas been exploded!");
|
Player.Message(p, who.ColoredName + " %Shas been exploded!");
|
||||||
} else if (args.Length == 3) {
|
} else if (args.Length == 3) {
|
||||||
try {
|
try {
|
||||||
x = Convert.ToUInt16(args[0]);
|
x = ushort.Parse(args[0]);
|
||||||
y = Convert.ToUInt16(args[1]);
|
y = ushort.Parse(args[1]);
|
||||||
z = Convert.ToUInt16(args[2]);
|
z = ushort.Parse(args[2]);
|
||||||
} catch {
|
} catch {
|
||||||
Player.Message(p, "Invalid parameters"); return;
|
Player.Message(p, "Invalid parameters"); return;
|
||||||
}
|
}
|
||||||
|
@ -37,15 +37,15 @@ namespace MCGalaxy.Commands.Building {
|
|||||||
case 1: block = message == "" ? block :
|
case 1: block = message == "" ? block :
|
||||||
DrawCmd.GetBlock(p, parts[0], out extBlock); break;
|
DrawCmd.GetBlock(p, parts[0], out extBlock); break;
|
||||||
case 3:
|
case 3:
|
||||||
x = (ushort)(Convert.ToUInt16(parts[0]) * 32);
|
x = (ushort)(ushort.Parse(parts[0]) * 32);
|
||||||
y = (ushort)(Convert.ToUInt16(parts[1]) * 32);
|
y = (ushort)(ushort.Parse(parts[1]) * 32);
|
||||||
z = (ushort)(Convert.ToUInt16(parts[2]) * 32);
|
z = (ushort)(ushort.Parse(parts[2]) * 32);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
block = DrawCmd.GetBlock(p, parts[0], out extBlock);
|
block = DrawCmd.GetBlock(p, parts[0], out extBlock);
|
||||||
x = (ushort)(Convert.ToUInt16(parts[1]) * 32);
|
x = (ushort)(ushort.Parse(parts[1]) * 32);
|
||||||
y = (ushort)(Convert.ToUInt16(parts[2]) * 32);
|
y = (ushort)(ushort.Parse(parts[2]) * 32);
|
||||||
z = (ushort)(Convert.ToUInt16(parts[3]) * 32);
|
z = (ushort)(ushort.Parse(parts[3]) * 32);
|
||||||
break;
|
break;
|
||||||
default: Player.Message(p, "Invalid number of parameters"); return;
|
default: Player.Message(p, "Invalid number of parameters"); return;
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,12 @@ namespace MCGalaxy.Undo {
|
|||||||
if (!super && !p.level.name.CaselessEq(map)) continue;
|
if (!super && !p.level.name.CaselessEq(map)) continue;
|
||||||
pos.LevelName = map;
|
pos.LevelName = map;
|
||||||
|
|
||||||
pos.X = Convert.ToUInt16(lines[(i * items) - 6]);
|
pos.X = ushort.Parse(lines[(i * items) - 6]);
|
||||||
pos.Y = Convert.ToUInt16(lines[(i * items) - 5]);
|
pos.Y = ushort.Parse(lines[(i * items) - 5]);
|
||||||
pos.Z = Convert.ToUInt16(lines[(i * items) - 4]);
|
pos.Z = ushort.Parse(lines[(i * items) - 4]);
|
||||||
|
|
||||||
pos.Block = Convert.ToByte(lines[(i * items) - 2]);
|
pos.Block = byte.Parse(lines[(i * items) - 2]);
|
||||||
pos.NewBlock = Convert.ToByte(lines[(i * items) - 1]);
|
pos.NewBlock = byte.Parse(lines[(i * items) - 1]);
|
||||||
yield return pos;
|
yield return pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user