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
Expand Up @@ -1296,11 +1296,8 @@ static void LavaHandler([NotNull] Player player, [NotNull] CommandReader cmd)
throw new ArgumentNullException("cmd"); throw new ArgumentNullException("cmd");


CuboidDrawOperation op = new CuboidDrawOperation(player); CuboidDrawOperation op = new CuboidDrawOperation(player);

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

op.Brush = brush; op.Brush = brush;


player.SelectionStart(2, DrawOperationCallback, op, Permission.Draw); player.SelectionStart(2, DrawOperationCallback, op, Permission.Draw);
Expand All @@ -1323,29 +1320,6 @@ static void LavaHandler([NotNull] Player player, [NotNull] CommandReader cmd)
ReplaceHandlerInternal(ReplaceBrushFactory.Instance, player, 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 { static readonly CommandDescriptor CdReplaceAll = new CommandDescriptor {
Name = "ReplaceAll", Name = "ReplaceAll",
Expand All @@ -1359,9 +1333,17 @@ static void LavaHandler([NotNull] Player player, [NotNull] CommandReader cmd)
}; };


static void ReplaceAllHandler(Player player, CommandReader cmd) { 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 { static readonly CommandDescriptor CdReplaceNot = new CommandDescriptor {
Expand All @@ -1380,7 +1362,6 @@ static void LavaHandler([NotNull] Player player, [NotNull] CommandReader cmd)
} }





static readonly CommandDescriptor CdReplaceBrush = new CommandDescriptor { static readonly CommandDescriptor CdReplaceBrush = new CommandDescriptor {
Name = "ReplaceBrush", Name = "ReplaceBrush",
Aliases = new[] { "rb" }, Aliases = new[] { "rb" },
Expand Down
4 changes: 2 additions & 2 deletions fCraft/Commands/InfoCommands.cs
Expand Up @@ -1842,7 +1842,7 @@ static void EmotesHandler(Player player, CommandReader cmd)
player.Message(" Timezone: &f{0}", result.Get("timezone") ?? "N/A"); player.Message(" Timezone: &f{0}", result.Get("timezone") ?? "N/A");
byte acc; byte acc;
byte.TryParse(result.Get("accuracy"), out 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(" Accuracy: &f{0}", acc);
player.Message("Geoip information by: &9http://geoip.cf/"); player.Message("Geoip information by: &9http://geoip.cf/");


Expand Down Expand Up @@ -1873,7 +1873,7 @@ static void EmotesHandler(Player player, CommandReader cmd)
info.Longitude = result.Get("longitude") ?? "N/A"; info.Longitude = result.Get("longitude") ?? "N/A";
info.TimeZone = result.Get("timezone") ?? "N/A"; info.TimeZone = result.Get("timezone") ?? "N/A";
byte.TryParse(result.Get("accuracy"), out info.Accuracy); 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"; info.GeoIP = result.Get("ip") ?? "N/A";
return; return;


Expand Down

0 comments on commit 6ff0e68

Please sign in to comment.