mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-10-01 17:45:57 -04:00
Don't check volume for /buy level
This commit is contained in:
parent
fd9676456d
commit
6a03bffebe
@ -20,6 +20,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using MCGalaxy.Commands.CPE;
|
using MCGalaxy.Commands.CPE;
|
||||||
using MCGalaxy.Commands.Moderation;
|
using MCGalaxy.Commands.Moderation;
|
||||||
|
using MCGalaxy.Generator;
|
||||||
|
|
||||||
namespace MCGalaxy.Commands.World {
|
namespace MCGalaxy.Commands.World {
|
||||||
public sealed partial class CmdOverseer : Command2 {
|
public sealed partial class CmdOverseer : Command2 {
|
||||||
@ -159,7 +160,7 @@ namespace MCGalaxy.Commands.World {
|
|||||||
Level lvl = newLvl.GenerateMap(p, args, p.DefaultCmdData);
|
Level lvl = newLvl.GenerateMap(p, args, p.DefaultCmdData);
|
||||||
if (lvl == null) return;
|
if (lvl == null) return;
|
||||||
|
|
||||||
SetPerms(p, lvl);
|
MapGen.SetRealmPerms(p, lvl);
|
||||||
p.Message("Use %T/os zone add [name] %Sto allow other players to build in the map.");
|
p.Message("Use %T/os zone add [name] %Sto allow other players to build in the map.");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -170,18 +171,6 @@ namespace MCGalaxy.Commands.World {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void SetPerms(Player p, Level lvl) {
|
|
||||||
lvl.Config.RealmOwner = p.name;
|
|
||||||
const LevelPermission rank = LevelPermission.Nobody;
|
|
||||||
lvl.BuildAccess.Whitelist(Player.Console, rank, lvl, p.name);
|
|
||||||
lvl.VisitAccess.Whitelist(Player.Console, rank, lvl, p.name);
|
|
||||||
|
|
||||||
Group grp = Group.Find(Server.Config.OSPerbuildDefault);
|
|
||||||
if (grp == null) return;
|
|
||||||
|
|
||||||
lvl.BuildAccess.SetMin(Player.Console, rank, lvl, grp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DeleteMap(Player p, string value) {
|
static void DeleteMap(Player p, string value) {
|
||||||
if (value.Length > 0) {
|
if (value.Length > 0) {
|
||||||
p.Message("To delete your current map, type %T/os map delete");
|
p.Message("To delete your current map, type %T/os map delete");
|
||||||
|
@ -96,15 +96,13 @@ namespace MCGalaxy.Eco {
|
|||||||
|
|
||||||
ushort x = 0, y = 0, z = 0;
|
ushort x = 0, y = 0, z = 0;
|
||||||
string[] xyz = { preset.x, preset.y, preset.z };
|
string[] xyz = { preset.x, preset.y, preset.z };
|
||||||
if (!MapGen.GetDimensions(p, xyz, 0, ref x, ref y, ref z)) return;
|
if (!MapGen.GetDimensions(p, xyz, 0, ref x, ref y, ref z, false)) return;
|
||||||
|
|
||||||
MapGen gen = MapGen.Find(preset.type);
|
MapGen gen = MapGen.Find(preset.type);
|
||||||
Level lvl = MapGen.Generate(p, gen, name, x, y, z, "");
|
Level lvl = MapGen.Generate(p, gen, name, x, y, z, "");
|
||||||
if (lvl == null) return;
|
if (lvl == null) return;
|
||||||
|
|
||||||
CmdOverseer.SetPerms(p, lvl);
|
MapGen.SetRealmPerms(p, lvl);
|
||||||
lvl.SaveSettings();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
lvl.Save(true);
|
lvl.Save(true);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -118,21 +118,21 @@ namespace MCGalaxy.Generator {
|
|||||||
}
|
}
|
||||||
return lvl;
|
return lvl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool GetDimensions(Player p, string[] args, int i,
|
public static bool GetDimensions(Player p, string[] args, int i,
|
||||||
ref ushort x, ref ushort y, ref ushort z) {
|
ref ushort x, ref ushort y, ref ushort z, bool checkVolume = true) {
|
||||||
return
|
return
|
||||||
CheckMapAxis(p, args[i ], "Width", ref x) &&
|
CheckMapAxis(p, args[i ], "Width", ref x) &&
|
||||||
CheckMapAxis(p, args[i + 1], "Height", ref y) &&
|
CheckMapAxis(p, args[i + 1], "Height", ref y) &&
|
||||||
CheckMapAxis(p, args[i + 2], "Length", ref z) &&
|
CheckMapAxis(p, args[i + 2], "Length", ref z) &&
|
||||||
CheckMapVolume(p, x, y, z);
|
(!checkVolume || CheckMapVolume(p, x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool CheckMapAxis(Player p, string input, string type, ref ushort len) {
|
static bool CheckMapAxis(Player p, string input, string type, ref ushort len) {
|
||||||
return CommandParser.GetUShort(p, input, type, ref len, 1, 16384);
|
return CommandParser.GetUShort(p, input, type, ref len, 1, 16384);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool CheckMapVolume(Player p, int x, int y, int z) {
|
static bool CheckMapVolume(Player p, int x, int y, int z) {
|
||||||
if (p.IsConsole) return true;
|
if (p.IsConsole) return true;
|
||||||
int limit = p.group.GenVolume;
|
int limit = p.group.GenVolume;
|
||||||
if ((long)x * y * z <= limit) return true;
|
if ((long)x * y * z <= limit) return true;
|
||||||
@ -143,6 +143,19 @@ namespace MCGalaxy.Generator {
|
|||||||
else text += limit + " blocks";
|
else text += limit + " blocks";
|
||||||
p.Message(text);
|
p.Message(text);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> Sets default permissions for a newly generated realm map. </summary>
|
||||||
|
internal static void SetRealmPerms(Player p, Level lvl) {
|
||||||
|
lvl.Config.RealmOwner = p.name;
|
||||||
|
const LevelPermission rank = LevelPermission.Nobody;
|
||||||
|
lvl.BuildAccess.Whitelist(Player.Console, rank, lvl, p.name);
|
||||||
|
lvl.VisitAccess.Whitelist(Player.Console, rank, lvl, p.name);
|
||||||
|
|
||||||
|
Group grp = Group.Find(Server.Config.OSPerbuildDefault);
|
||||||
|
if (grp == null) return;
|
||||||
|
|
||||||
|
lvl.BuildAccess.SetMin(Player.Console, rank, lvl, grp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user