Skip to content
Permalink
Browse files

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 2be686e131f4f9ba414ef54c83b7005383b19bd5
Showing with 13 additions and 0 deletions.
  1. +13 −0 fCraft/Commands/CpeCommands.cs
@@ -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";
@@ -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))
@@ -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) {

0 comments on commit 2be686e

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