Skip to content
Permalink
Browse files

Update hostname to host for GeoIP.

Also simplify /replaceall a bit
  • Loading branch information...
UnknownShadow200 committed Oct 22, 2017
1 parent b956ede commit 6ff0e6835a37d7109406cfc014f2659233507d59
Showing with 13 additions and 32 deletions.
  1. +11 −30 fCraft/Commands/BuildingCommands.cs
  2. +2 −2 fCraft/Commands/InfoCommands.cs
@@ -1296,11 +1296,8 @@ static void LavaHandler([NotNull] Player player, [NotNull] CommandReader cmd)
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);
@@ -1323,29 +1320,6 @@ static void LavaHandler([NotNull] Player player, [NotNull] 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",
@@ -1359,9 +1333,17 @@ static void LavaHandler([NotNull] Player player, [NotNull] 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 {
@@ -1380,7 +1362,6 @@ static void LavaHandler([NotNull] Player player, [NotNull] CommandReader cmd)
}



static readonly CommandDescriptor CdReplaceBrush = new CommandDescriptor {
Name = "ReplaceBrush",
Aliases = new[] { "rb" },
@@ -1842,7 +1842,7 @@ static void EmotesHandler(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/");

@@ -1873,7 +1873,7 @@ static void EmotesHandler(Player player, CommandReader cmd)
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;

0 comments on commit 6ff0e68

Please sign in to comment.
You can’t perform that action at this time.