Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
For maximum laziness, auto convert dropbox texture pack urls into the…
… appropriate form.
  • Loading branch information
UnknownShadow200 committed Jun 21, 2017
1 parent b52430c commit 2be686e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions fCraft/Commands/CpeCommands.cs
Expand Up @@ -879,6 +879,7 @@ static class CpeCommands {
case "tex":
case "terrain":
case "texture":
FilterURL(ref value);
if (value.CaselessEquals("default")) {
player.Message("Reset texture for {0}&S to {1}", world.ClassyName, Server.DefaultTerrain);
value = "Default";
Expand All @@ -891,6 +892,7 @@ static class CpeCommands {
} else {
player.Message("Set texture for {0}&S to {1}", world.ClassyName, value);
}

world.Texture = value;
foreach (Player p in world.Players) {
if (p.Supports(CpeExt.EnvMapAspect))
Expand Down Expand Up @@ -934,6 +936,17 @@ static class CpeCommands {
return;
}
WorldManager.SaveWorldList();
}

static void FilterURL(ref string url) {
// a lot of people try linking to the dropbox page instead of directly to file, so we auto correct them
if (url.StartsWith("http://www.dropbox")) {
url = "http://dl.dropbox" + url.Substring("http://www.dropbox".Length);
url = url.Replace("?dl=0", "");
} else if (url.StartsWith("https://www.dropbox")) {
url = "https://dl.dropbox" + url.Substring("https://www.dropbox".Length);
url = url.Replace("?dl=0", "");
}
}

static void ShowEnvSettings(Player player, World world) {
Expand Down

0 comments on commit 2be686e

Please sign in to comment.