mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
fix perbuild/pervisit max restrictions behaving improperly
This commit is contained in:
parent
e496de21f0
commit
b489ce7cea
@ -220,9 +220,8 @@ namespace MCGalaxy {
|
|||||||
len -= 4; i += 4;
|
len -= 4; i += 4;
|
||||||
|
|
||||||
// And then with "s://" or "://" ?
|
// And then with "s://" or "://" ?
|
||||||
if (len >= 4 && chars[i] == 's' && chars[i + 1] == ':' && chars[i + 2] == '/' && chars[i + 3] == '/') return true;
|
if (chars[i] == 's') { len--; i++; }
|
||||||
if (len >= 3 && chars[i] == ':' && chars[i + 1] == '/' && chars[i + 2] == '/') return true;
|
return len >= 3 && chars[i] == ':' && chars[i + 1] == '/' && chars[i + 2] == '/';
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Escape(char[] chars, int start, int end) {
|
static void Escape(char[] chars, int start, int end) {
|
||||||
|
@ -71,8 +71,8 @@ namespace MCGalaxy.Commands.World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
p.Message("%T/Museum [map] [restore]");
|
p.Message("%T/Museum [map] [backup]");
|
||||||
p.Message("%HAllows you to access a restore of the map entered. Works on unloaded maps");
|
p.Message("%HTeleports you to a backup of the given map.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ namespace MCGalaxy.Commands.Building {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
p.Message("%T/Sphere <brush args> <mode>");
|
p.Message("%T/Sphere <brush args>");
|
||||||
p.Message("%HCreates a sphere, with first point as centre, and second for radius");
|
p.Message("%HCreates a sphere, with first point as centre, and second for radius");
|
||||||
p.Message("%T/Sphere [mode] <brush args>");
|
p.Message("%T/Sphere [mode] <brush args>");
|
||||||
p.Message("%HModes: &fsolid/hollow/circle/hollowcircle");
|
p.Message("%HModes: &fsolid/hollow/circle/hollowcircle");
|
||||||
|
@ -45,20 +45,16 @@ namespace MCGalaxy.Generator {
|
|||||||
return simpleGens.ContainsKey(s.ToLower());
|
return simpleGens.ContainsKey(s.ToLower());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Outputs list of all map generator themes to the given player. </summary>
|
|
||||||
public static void PrintThemes(Player p) {
|
public static void PrintThemes(Player p) {
|
||||||
p.Message("Simple themes: " + simpleGens.Keys.Join(", "));
|
p.Message("Simple themes: " + simpleGens.Keys.Join(", "));
|
||||||
p.Message("Advanced themes: " + advGens.Keys.Join(", "));
|
p.Message("Advanced themes: " + advGens.Keys.Join(", "));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Retrieves the list of theme names of simple map generators. </summary>
|
|
||||||
public static IEnumerable<string> SimpleThemeNames { get { return simpleGens.Keys; } }
|
public static IEnumerable<string> SimpleThemeNames { get { return simpleGens.Keys; } }
|
||||||
|
|
||||||
/// <summary> Retrieves the list of theme names of advanced map generators. </summary>
|
|
||||||
public static IEnumerable<string> AdvancedThemeNames { get { return advGens.Keys; } }
|
public static IEnumerable<string> AdvancedThemeNames { get { return advGens.Keys; } }
|
||||||
|
|
||||||
|
|
||||||
/// <summary> Returns whether the given axis length is acceptable for map generation. </summary>
|
|
||||||
public static bool OkayAxis(int len) {
|
public static bool OkayAxis(int len) {
|
||||||
return len >= 16 && len <= 8192 && (len % 16) == 0;
|
return len >= 16 && len <= 8192 && (len % 16) == 0;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ namespace MCGalaxy {
|
|||||||
if (Whitelisted.CaselessContains(name)) return AccessResult.Whitelisted;
|
if (Whitelisted.CaselessContains(name)) return AccessResult.Whitelisted;
|
||||||
|
|
||||||
if (rank < Min) return AccessResult.BelowMinRank;
|
if (rank < Min) return AccessResult.BelowMinRank;
|
||||||
if (rank > Max && MaxCmd != null && CommandExtraPerms.Find(MaxCmd, 1).UsableBy(rank)) {
|
if (rank > Max && MaxCmd != null && !CommandExtraPerms.Find(MaxCmd, 1).UsableBy(rank)) {
|
||||||
return AccessResult.AboveMaxRank;
|
return AccessResult.AboveMaxRank;
|
||||||
}
|
}
|
||||||
return AccessResult.Allowed;
|
return AccessResult.Allowed;
|
||||||
|
@ -25,27 +25,20 @@ namespace MCGalaxy.Levels.IO {
|
|||||||
/// <summary> Reads/Loads block data (and potentially metadata) encoded in a particular format. </summary>
|
/// <summary> Reads/Loads block data (and potentially metadata) encoded in a particular format. </summary>
|
||||||
public abstract class IMapImporter {
|
public abstract class IMapImporter {
|
||||||
|
|
||||||
/// <summary> The file extension of this format. </summary>
|
|
||||||
public abstract string Extension { get; }
|
public abstract string Extension { get; }
|
||||||
|
|
||||||
/// <summary> Reads the data for a level from a file containing data encoded in this format. </summary>
|
|
||||||
/// <param name="metadata"> Whether metadata should be loaded. </param>
|
|
||||||
public Level Read(string path, string name, bool metadata) {
|
public Level Read(string path, string name, bool metadata) {
|
||||||
using (FileStream fs = File.OpenRead(path))
|
using (FileStream fs = File.OpenRead(path))
|
||||||
return Read(fs, name, metadata);
|
return Read(fs, name, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Reads the data for a level from a file containing data encoded in this format. </summary>
|
|
||||||
/// <param name="metadata"> Whether metadata should be loaded. </param>
|
|
||||||
public abstract Level Read(Stream src, string name, bool metadata);
|
public abstract Level Read(Stream src, string name, bool metadata);
|
||||||
|
|
||||||
/// <summary> Reads the dimensions for a level from a file containing data encoded in this format. </summary>
|
|
||||||
public Vec3U16 ReadDimensions(string path) {
|
public Vec3U16 ReadDimensions(string path) {
|
||||||
using (FileStream fs = File.OpenRead(path))
|
using (FileStream fs = File.OpenRead(path))
|
||||||
return ReadDimensions(fs);
|
return ReadDimensions(fs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Reads the dimensions for a level from a file containing data encoded in this format. </summary>
|
|
||||||
public abstract Vec3U16 ReadDimensions(Stream src);
|
public abstract Vec3U16 ReadDimensions(Stream src);
|
||||||
|
|
||||||
public static List<IMapImporter> Formats = new List<IMapImporter>() {
|
public static List<IMapImporter> Formats = new List<IMapImporter>() {
|
||||||
@ -70,17 +63,14 @@ namespace MCGalaxy.Levels.IO {
|
|||||||
/// <summary> Writes/Saves block data (and potentially metadata) encoded in a particular format. </summary>
|
/// <summary> Writes/Saves block data (and potentially metadata) encoded in a particular format. </summary>
|
||||||
public abstract class IMapExporter {
|
public abstract class IMapExporter {
|
||||||
|
|
||||||
/// <summary> The file extension of this format. </summary>
|
|
||||||
public abstract string Extension { get; }
|
public abstract string Extension { get; }
|
||||||
|
|
||||||
/// <summary> Saves the data encoded in this format for a level to a file. </summary>
|
|
||||||
public void Write(string path, Level lvl) {
|
public void Write(string path, Level lvl) {
|
||||||
using (FileStream fs = File.Create(path)) {
|
using (FileStream fs = File.Create(path)) {
|
||||||
Write(fs, lvl);
|
Write(fs, lvl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Saves the data encoded in this format for a level to a file. </summary>
|
|
||||||
public abstract void Write(Stream dst, Level lvl);
|
public abstract void Write(Stream dst, Level lvl);
|
||||||
|
|
||||||
public static List<IMapExporter> Formats = new List<IMapExporter>() {
|
public static List<IMapExporter> Formats = new List<IMapExporter>() {
|
||||||
|
@ -35,7 +35,6 @@ namespace MCGalaxy {
|
|||||||
public List<Warp> Items = new List<Warp>();
|
public List<Warp> Items = new List<Warp>();
|
||||||
public string Filename;
|
public string Filename;
|
||||||
|
|
||||||
/// <summary> Finds the warp whose name caselessly equals the given name. </summary>
|
|
||||||
public Warp Find(string name) {
|
public Warp Find(string name) {
|
||||||
foreach (Warp wp in Items) {
|
foreach (Warp wp in Items) {
|
||||||
if (wp.Name.CaselessEq(name)) return wp;
|
if (wp.Name.CaselessEq(name)) return wp;
|
||||||
@ -43,38 +42,31 @@ namespace MCGalaxy {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Returns whether a warp with the given name exists. </summary>
|
|
||||||
public bool Exists(string name) { return Find(name) != null; }
|
public bool Exists(string name) { return Find(name) != null; }
|
||||||
|
|
||||||
/// <summary> Creates a new warp with the given name, located at the
|
|
||||||
/// player's current position, orientation, and level. </summary>
|
|
||||||
public void Create(string name, Player p) {
|
public void Create(string name, Player p) {
|
||||||
Warp warp = new Warp();
|
Warp warp = new Warp();
|
||||||
InitWarp(warp, name, p);
|
Make(warp, name, p);
|
||||||
Items.Add(warp);
|
Items.Add(warp);
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitWarp(Warp warp, string name, Player p) {
|
void Make(Warp warp, string name, Player p) {
|
||||||
warp.Pos = p.Pos; warp.Name = name;
|
warp.Pos = p.Pos; warp.Name = name;
|
||||||
warp.Yaw = p.Rot.RotY; warp.Pitch = p.Rot.HeadX;
|
warp.Yaw = p.Rot.RotY; warp.Pitch = p.Rot.HeadX;
|
||||||
warp.Level = p.level.name;
|
warp.Level = p.level.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Moves the given warp to the target
|
|
||||||
/// player's position, orientation, and map. </summary>
|
|
||||||
public void Update(Warp warp, Player p) {
|
public void Update(Warp warp, Player p) {
|
||||||
InitWarp(warp, warp.Name, p);
|
Make(warp, warp.Name, p);
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Removes the given warp. </summary>
|
|
||||||
public void Remove(Warp warp, Player p) {
|
public void Remove(Warp warp, Player p) {
|
||||||
Items.Remove(warp);
|
Items.Remove(warp);
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Attempts to move the given player to the given warp. </summary>
|
|
||||||
public void Goto(Warp warp, Player p) {
|
public void Goto(Warp warp, Player p) {
|
||||||
if (!p.level.name.CaselessEq(warp.Level)) {
|
if (!p.level.name.CaselessEq(warp.Level)) {
|
||||||
PlayerActions.ChangeMap(p, warp.Level);
|
PlayerActions.ChangeMap(p, warp.Level);
|
||||||
@ -89,7 +81,6 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary> Loads the list of warps from the file located at Filename. </summary>
|
|
||||||
public void Load() {
|
public void Load() {
|
||||||
if (!File.Exists(Filename)) return;
|
if (!File.Exists(Filename)) return;
|
||||||
using (StreamReader r = new StreamReader(Filename)) {
|
using (StreamReader r = new StreamReader(Filename)) {
|
||||||
@ -116,7 +107,6 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Saves this list of warps to Filename. </summary>
|
|
||||||
public void Save() {
|
public void Save() {
|
||||||
using (StreamWriter w = new StreamWriter(Filename)) {
|
using (StreamWriter w = new StreamWriter(Filename)) {
|
||||||
foreach (Warp warp in Items) {
|
foreach (Warp warp in Items) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user