Skip to content

Commit

Permalink
Update hostname to host for GeoIP.
Browse files Browse the repository at this point in the history
Also simplify /replaceall a bit
  • Loading branch information
UnknownShadow200 committed Oct 22, 2017
1 parent b956ede commit 6ff0e68
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 32 deletions.
41 changes: 11 additions & 30 deletions fCraft/Commands/BuildingCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1296,11 +1296,8 @@ static void ReplaceHandlerInternal([NotNull] IBrushFactory factory, [NotNull] Pl
throw new ArgumentNullException("cmd");

CuboidDrawOperation op = new CuboidDrawOperation(player);

IBrush brush = factory.MakeBrush(player, cmd);
if (brush == null)
return;

if (brush == null) return;
op.Brush = brush;

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

static void ReplaceAllHandlerInternal([NotNull] IBrushFactory factory, [NotNull] Player player,
[NotNull] CommandReader cmd) {
CuboidDrawOperation op = new CuboidDrawOperation(player);
IBrush brush = factory.MakeBrush(player, cmd);
if (brush == null)
return;
op.Brush = brush;

player.SelectionStart(2, DrawOperationCallback, op, Permission.Draw);
Map map = player.WorldMap;
Vector3I coordsMin;
Vector3I coordsMax;
coordsMin.X = 0;
coordsMin.Y = 0;
coordsMin.Z = 0;
coordsMax.X = map.Width - 1;
coordsMax.Y = map.Length - 1;
coordsMax.Z = map.Height - 1;
player.SelectionResetMarks();
player.SelectionAddMark(coordsMin, false, false);
player.SelectionAddMark(coordsMax, true, true);
}


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

static void ReplaceAllHandler(Player player, CommandReader cmd) {
ReplaceAllHandlerInternal(ReplaceBrushFactory.Instance, player, cmd);
}
CuboidDrawOperation op = new CuboidDrawOperation(player);
IBrush brush = ReplaceBrushFactory.Instance.MakeBrush(player, cmd);
if (brush == null) return;
op.Brush = brush;

player.SelectionStart(2, DrawOperationCallback, op, Permission.Draw);
Map map = player.WorldMap;
player.SelectionResetMarks();
player.SelectionAddMark(map.Bounds.MinVertex, false, false);
player.SelectionAddMark(map.Bounds.MaxVertex, true, true);
}


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



static readonly CommandDescriptor CdReplaceBrush = new CommandDescriptor {
Name = "ReplaceBrush",
Aliases = new[] { "rb" },
Expand Down
4 changes: 2 additions & 2 deletions fCraft/Commands/InfoCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1842,7 +1842,7 @@ private static void IPNPInfoHandler(Player player, CommandReader cmd) {
player.Message(" Timezone: &f{0}", result.Get("timezone") ?? "N/A");
byte acc;
byte.TryParse(result.Get("accuracy"), out acc);
player.Message(" Hostname: &f{0}", result.Get("hostname") ?? "N/A");
player.Message(" Hostname: &f{0}", result.Get("host") ?? "N/A");
player.Message(" Accuracy: &f{0}", acc);
player.Message("Geoip information by: &9http://geoip.cf/");

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

Expand Down

0 comments on commit 6ff0e68

Please sign in to comment.