don't use a try catch in CmdExplode

This commit is contained in:
UnknownShadow200 2017-09-01 22:54:34 +10:00
parent 42739945ad
commit 7764c19eb4
5 changed files with 7 additions and 13 deletions

View File

@ -32,7 +32,7 @@ namespace MCGalaxy.Commands.Fun {
if (!(args.Length == 1 || args.Length == 3)) { Help(p); return; }
if (message.CaselessEq("me") && p != null) args[0] = p.name;
ushort x, y, z;
ushort x = 0, y = 0, z = 0;
if (args.Length == 1) {
Player who = PlayerInfo.FindMatches(p, args[0]);
if (who == null) return;
@ -43,17 +43,15 @@ namespace MCGalaxy.Commands.Fun {
if (DoExplode(p, who.level, x, y, z))
Player.Message(p, who.ColoredName + " %Shas been exploded!");
} else if (args.Length == 3) {
try {
x = ushort.Parse(args[0]);
y = ushort.Parse(args[1]);
z = ushort.Parse(args[2]);
} catch {
Player.Message(p, "Invalid parameters"); return;
}
if (!CommandParser.GetUShort(p, args[0], "X", ref x)) return;
if (!CommandParser.GetUShort(p, args[1], "Y", ref y)) return;
if (!CommandParser.GetUShort(p, args[2], "Z", ref z)) return;
if (y >= p.level.Height) y = (ushort)(p.level.Height - 1);
if (DoExplode(p, p.level, x, y, z))
Player.Message(p, "An explosion was made at {0}, {1}, {2}).", x, y, z);
} else {
Help(p);
}
}

View File

@ -17,9 +17,8 @@
*/
using System;
using System.Globalization;
using MCGalaxy.DB;
using MCGalaxy.SQL;
using MCGalaxy.Eco;
using MCGalaxy.SQL;
namespace MCGalaxy.Core {
internal static class EcoHandlers {

View File

@ -16,7 +16,6 @@
permissions and limitations under the Licenses.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;

View File

@ -17,7 +17,6 @@
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using MCGalaxy.Events.EconomyEvents;

View File

@ -17,7 +17,6 @@
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace MCGalaxy {