Skip to content

Commit

Permalink
Add a version of BlockDefinition.Save that takes a path string, so it…
Browse files Browse the repository at this point in the history
… can be used by plugins (Thanks 123DMWM)
  • Loading branch information
UnknownShadow200 committed Sep 7, 2020
1 parent 0ec32e0 commit 0655e80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion MCGalaxy/Blocks/BlockDefinitions.cs
Expand Up @@ -127,9 +127,13 @@ public sealed class BlockDefinition {
}

public static void Save(bool global, Level lvl) {
if (elems == null) elems = ConfigElement.GetAll(typeof(BlockDefinition));
string path = global ? GlobalPath : Paths.MapBlockDefs(lvl.MapName);
BlockDefinition[] defs = global ? GlobalDefs : lvl.CustomBlockDefs;
Save(global, defs, path);
}

public static void Save(bool global, BlockDefinition[] defs, string path) {
if (elems == null) elems = ConfigElement.GetAll(typeof(BlockDefinition));

using (StreamWriter w = new StreamWriter(path)) {
w.WriteLine("[");
Expand Down
3 changes: 3 additions & 0 deletions MCGalaxy/Commands/World/CmdOverseer.SubCommands.cs
Expand Up @@ -115,8 +115,11 @@ public sealed partial class CmdOverseer : Command2 {
if (!access.Whitelisted.CaselessContains(p.name)) {
access.Whitelist(Player.Console, LevelPermission.Nobody, p.level, p.name);
}

if (value.Length > 0) value = p.level.name + " " + value;
UseCommand(p, "PerVisit", value);
} else if (cmd == "PERBUILD") {
if (value.Length > 0) value = p.level.name + " " + value;
UseCommand(p, "PerBuild", value);
} else if (cmd == "TEXTURE" || cmd == "TEXTUREZIP" || cmd == "TEXTUREPACK") {
if (value.Length == 0) value = "normal";
Expand Down

0 comments on commit 0655e80

Please sign in to comment.