Skip to content

Commit 6ff0e68

Browse files
Update hostname to host for GeoIP.
Also simplify /replaceall a bit
1 parent b956ede commit 6ff0e68

File tree

2 files changed

+13
-32
lines changed

2 files changed

+13
-32
lines changed

fCraft/Commands/BuildingCommands.cs

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,11 +1296,8 @@ static void ReplaceHandlerInternal([NotNull] IBrushFactory factory, [NotNull] Pl
12961296
throw new ArgumentNullException("cmd");
12971297

12981298
CuboidDrawOperation op = new CuboidDrawOperation(player);
1299-
13001299
IBrush brush = factory.MakeBrush(player, cmd);
1301-
if (brush == null)
1302-
return;
1303-
1300+
if (brush == null) return;
13041301
op.Brush = brush;
13051302

13061303
player.SelectionStart(2, DrawOperationCallback, op, Permission.Draw);
@@ -1323,29 +1320,6 @@ static void ReplaceHandler( Player player, CommandReader cmd ) {
13231320
ReplaceHandlerInternal(ReplaceBrushFactory.Instance, player, cmd);
13241321
}
13251322

1326-
static void ReplaceAllHandlerInternal([NotNull] IBrushFactory factory, [NotNull] Player player,
1327-
[NotNull] CommandReader cmd) {
1328-
CuboidDrawOperation op = new CuboidDrawOperation(player);
1329-
IBrush brush = factory.MakeBrush(player, cmd);
1330-
if (brush == null)
1331-
return;
1332-
op.Brush = brush;
1333-
1334-
player.SelectionStart(2, DrawOperationCallback, op, Permission.Draw);
1335-
Map map = player.WorldMap;
1336-
Vector3I coordsMin;
1337-
Vector3I coordsMax;
1338-
coordsMin.X = 0;
1339-
coordsMin.Y = 0;
1340-
coordsMin.Z = 0;
1341-
coordsMax.X = map.Width - 1;
1342-
coordsMax.Y = map.Length - 1;
1343-
coordsMax.Z = map.Height - 1;
1344-
player.SelectionResetMarks();
1345-
player.SelectionAddMark(coordsMin, false, false);
1346-
player.SelectionAddMark(coordsMax, true, true);
1347-
}
1348-
13491323

13501324
static readonly CommandDescriptor CdReplaceAll = new CommandDescriptor {
13511325
Name = "ReplaceAll",
@@ -1359,9 +1333,17 @@ static void ReplaceAllHandlerInternal([NotNull] IBrushFactory factory, [NotNull]
13591333
};
13601334

13611335
static void ReplaceAllHandler(Player player, CommandReader cmd) {
1362-
ReplaceAllHandlerInternal(ReplaceBrushFactory.Instance, player, cmd);
1363-
}
1336+
CuboidDrawOperation op = new CuboidDrawOperation(player);
1337+
IBrush brush = ReplaceBrushFactory.Instance.MakeBrush(player, cmd);
1338+
if (brush == null) return;
1339+
op.Brush = brush;
13641340

1341+
player.SelectionStart(2, DrawOperationCallback, op, Permission.Draw);
1342+
Map map = player.WorldMap;
1343+
player.SelectionResetMarks();
1344+
player.SelectionAddMark(map.Bounds.MinVertex, false, false);
1345+
player.SelectionAddMark(map.Bounds.MaxVertex, true, true);
1346+
}
13651347

13661348

13671349
static readonly CommandDescriptor CdReplaceNot = new CommandDescriptor {
@@ -1380,7 +1362,6 @@ static void ReplaceNotHandler([NotNull] Player player, [NotNull] CommandReader c
13801362
}
13811363

13821364

1383-
13841365
static readonly CommandDescriptor CdReplaceBrush = new CommandDescriptor {
13851366
Name = "ReplaceBrush",
13861367
Aliases = new[] { "rb" },

fCraft/Commands/InfoCommands.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ private static void IPNPInfoHandler(Player player, CommandReader cmd) {
18421842
player.Message(" Timezone: &f{0}", result.Get("timezone") ?? "N/A");
18431843
byte acc;
18441844
byte.TryParse(result.Get("accuracy"), out acc);
1845-
player.Message(" Hostname: &f{0}", result.Get("hostname") ?? "N/A");
1845+
player.Message(" Hostname: &f{0}", result.Get("host") ?? "N/A");
18461846
player.Message(" Accuracy: &f{0}", acc);
18471847
player.Message("Geoip information by: &9http://geoip.cf/");
18481848

@@ -1873,7 +1873,7 @@ public static void GetGeoip(PlayerInfo info) {
18731873
info.Longitude = result.Get("longitude") ?? "N/A";
18741874
info.TimeZone = result.Get("timezone") ?? "N/A";
18751875
byte.TryParse(result.Get("accuracy"), out info.Accuracy);
1876-
info.Hostname = result.Get("hostname") ?? "N/A";
1876+
info.Hostname = result.Get("host") ?? "N/A";
18771877
info.GeoIP = result.Get("ip") ?? "N/A";
18781878
return;
18791879

0 commit comments

Comments
 (0)