mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Less hardcoding of level properties folder, fix /load from console.
This commit is contained in:
parent
f18397f976
commit
3484d19c47
@ -182,7 +182,7 @@ namespace MCGalaxy.Commands {
|
||||
this.Name = name;
|
||||
LvlFile.LoadDimensions(LevelInfo.LevelPath(name),
|
||||
out Width, out Height, out Length);
|
||||
string path = LevelInfo.GetPropertiesPath(name);
|
||||
string path = LevelInfo.FindPropertiesFile(name);
|
||||
if (path != null)
|
||||
PropertiesFile.Read(path, ParseProperty, '=');
|
||||
|
||||
|
@ -92,7 +92,7 @@ namespace MCGalaxy.Commands {
|
||||
loadOnGoto = true;
|
||||
Group grp;
|
||||
|
||||
string file = LevelInfo.GetPropertiesPath(level);
|
||||
string file = LevelInfo.FindPropertiesFile(level);
|
||||
if (file == null) return;
|
||||
SearchArgs args = new SearchArgs();
|
||||
PropertiesFile.Read(file, ref args, ProcessLine);
|
||||
|
@ -46,8 +46,8 @@ namespace MCGalaxy.Commands.World {
|
||||
|
||||
try {
|
||||
File.Copy(LevelInfo.LevelPath(src), LevelInfo.LevelPath(dst));
|
||||
if (File.Exists("levels/level properties/" + src + ".properties"))
|
||||
File.Copy("levels/level properties/" + src + ".properties", "levels/level properties/" + dst + ".properties", false);
|
||||
if (File.Exists(LevelInfo.PropertiesPath(src))
|
||||
File.Copy(LevelInfo.PropertiesPath(src), LevelInfo.PropertiesPath(dst), false);
|
||||
if (File.Exists("blockdefs/lvl_" + src + ".json"))
|
||||
File.Copy("blockdefs/lvl_" + src + ".json", "blockdefs/lvl_" + dst + ".json");
|
||||
} catch (System.IO.FileNotFoundException) {
|
||||
|
@ -370,6 +370,7 @@ namespace MCGalaxy
|
||||
}
|
||||
|
||||
public bool CanJoin(Player p) {
|
||||
if (p == null) return true;
|
||||
if (Player.BlacklistCheck(p.name, name) || VisitBlacklist.CaselessContains(p.name)) {
|
||||
Player.Message(p, "You are blacklisted from going to {0}.", name); return false;
|
||||
}
|
||||
@ -543,7 +544,7 @@ namespace MCGalaxy
|
||||
|
||||
public static void SaveSettings(Level lvl) {
|
||||
lock (lvl.savePropsLock)
|
||||
LvlProperties.Save(lvl, "levels/level properties/" + lvl.name);
|
||||
LvlProperties.Save(lvl, LevelInfo.PropertiesPath(lvl.name));
|
||||
}
|
||||
|
||||
// Returns true if ListCheck does not already have an check in the position.
|
||||
@ -741,7 +742,7 @@ namespace MCGalaxy
|
||||
}
|
||||
|
||||
try {
|
||||
string propsPath = LevelInfo.GetPropertiesPath(level.name);
|
||||
string propsPath = LevelInfo.FindPropertiesFile(level.name);
|
||||
if (propsPath != null)
|
||||
LvlProperties.Load(level, propsPath);
|
||||
else
|
||||
|
@ -47,7 +47,7 @@ namespace MCGalaxy {
|
||||
|
||||
public static Level FindMatches(Player pl, string name, out int matches) {
|
||||
return Extensions.FindMatches<Level>(pl, name, out matches, LevelInfo.Loaded.Items,
|
||||
l => true, l => l.name, "loaded levels");
|
||||
l => true, l => l.name, "loaded levels");
|
||||
}
|
||||
|
||||
public static string FindMapMatches(Player pl, string name) {
|
||||
@ -96,15 +96,18 @@ namespace MCGalaxy {
|
||||
return Server.backupLocation + "/" + name + "/" + backup + "/" + name + ".lvl";
|
||||
}
|
||||
|
||||
public static string GetPropertiesPath(string name) {
|
||||
public static string PropertiesPath(string name) {
|
||||
return "levels/level properties/" + name + ".properties";
|
||||
}
|
||||
|
||||
public static string FindPropertiesFile(string name) {
|
||||
string file = "levels/level properties/" + name + ".properties";
|
||||
if (!File.Exists(file)) file = "levels/level properties/" + name;
|
||||
if (!File.Exists(file)) return null;
|
||||
return file;
|
||||
return File.Exists(file) ? file : null;
|
||||
}
|
||||
|
||||
public static string FindOfflineProperty(string name, string propKey) {
|
||||
string file = GetPropertiesPath(name);
|
||||
string file = FindPropertiesFile(name);
|
||||
if (file == null) return null;
|
||||
|
||||
string[] lines = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user