Skip to content

Commit d88d70f

Browse files
Engrish
1 parent 21f482f commit d88d70f

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

fCraft/Commands/CommandReader.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,10 @@ public bool NextOnOff(out bool param) {
303303
param = false;
304304
if (token == null) return false;
305305

306-
if (token.CaselessEquals("on") || token == "1") {
306+
if (token.CaselessEquals("on") || token.CaselessEquals("yes") || token == "1") {
307307
param = true; return true;
308-
} else if (token.CaselessEquals("off") || token == "0") {
308+
}
309+
if (token.CaselessEquals("off") || token.CaselessEquals("no") || token == "0") {
309310
return true;
310311
}
311312
return false;

fCraft/Commands/CpeCommands.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,7 +2379,6 @@ private static void zshowHandler(Player player, CommandReader cmd) {
23792379
string zonea = cmd.Next();
23802380
string color = cmd.Next();
23812381
string alp = cmd.Next();
2382-
string bol = cmd.Next();
23832382
short alpha;
23842383
Zone zone = player.World.Map.Zones.Find(zonea);
23852384
if (zone == null) {
@@ -2396,18 +2395,19 @@ private static void zshowHandler(Player player, CommandReader cmd) {
23962395
if (color.StartsWith("#")) {
23972396
color = color.ToUpper().Remove(0, 1);
23982397
}
2398+
23992399
if (!IsValidHex(color)) {
24002400
if (color.CaselessEquals("on") || color.CaselessEquals("true") || color.CaselessEquals("yes")) {
24012401
zone.ShowZone = true;
24022402
if (zone.Color != null) {
2403-
player.Message("Zone ({0}&S) will now show its bounderies", zone.ClassyName);
2403+
player.Message("Zone ({0}&S) will now show its boundaries", zone.ClassyName);
24042404
player.World.Players.Where(p => p.Supports(CpeExt.SelectionCuboid)).Send(Packet.MakeMakeSelection(zone.ZoneID, zone.Name, zone.Bounds,
24052405
zone.Color, zone.Alpha, player.HasCP437));
24062406
}
24072407
return;
24082408
} else if (color.CaselessEquals("off") || color.CaselessEquals("false") || color.CaselessEquals("no")) {
24092409
zone.ShowZone = false;
2410-
player.Message("Zone ({0}&S) will no longer show its bounderies", zone.ClassyName);
2410+
player.Message("Zone ({0}&S) will no longer show its boundaries", zone.ClassyName);
24112411
player.World.Players.Where(p => p.Supports(CpeExt.SelectionCuboid)).Send(Packet.MakeRemoveSelection(zone.ZoneID));
24122412
return;
24132413
} else {
@@ -2429,24 +2429,24 @@ private static void zshowHandler(Player player, CommandReader cmd) {
24292429
} else {
24302430
zone.Alpha = alpha;
24312431
}
2432-
if (bol != null) {
2433-
if (!bol.CaselessEquals("on") && !bol.CaselessEquals("off") && !bol.CaselessEquals("true") &&
2434-
!bol.CaselessEquals("false") && !bol.CaselessEquals("0") && !bol.CaselessEquals("1") &&
2435-
!bol.CaselessEquals("yes") && !bol.CaselessEquals("no")) {
2436-
zone.ShowZone = false;
2437-
player.Message("({0}) is not a valid bool statement", bol);
2438-
} else if (bol.CaselessEquals("on") || bol.CaselessEquals("true") || bol.CaselessEquals("1") ||
2439-
bol.CaselessEquals("yes")) {
2440-
zone.ShowZone = true;
2441-
player.Message("Zone ({0}&S) color set! Bounderies: ON", zone.ClassyName);
2442-
} else if (bol.CaselessEquals("off") || bol.CaselessEquals("false") || bol.CaselessEquals("0") ||
2443-
bol.CaselessEquals("no")) {
2444-
zone.ShowZone = false;
2445-
player.Message("Zone ({0}&S) color set! Bounderies: OFF", zone.ClassyName);
2432+
2433+
if (cmd.HasNext) {
2434+
bool show;
2435+
if (!cmd.NextOnOff(out show)) {
2436+
player.Message("\"Show\" state must be 'on' or 'off'");
2437+
return;
2438+
}
2439+
2440+
zone.ShowZone = show;
2441+
if (show) {
2442+
player.Message("Zone ({0}&S) color set! Boundaries: ON", zone.ClassyName);
2443+
} else {
2444+
player.Message("Zone ({0}&S) color set! Boundaries: OFF", zone.ClassyName);
24462445
}
24472446
} else {
24482447
player.Message("Zone ({0}&S) color set!", zone.ClassyName);
24492448
}
2449+
24502450
if (zone != null) {
24512451
foreach (Player p in player.World.Players) {
24522452
if (p.Supports(CpeExt.SelectionCuboid) && zone.ShowZone) {

0 commit comments

Comments
 (0)