mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Fix /os map buildable and /os map deletable giving 'Only X+ can set map options' when trying to use them. (Thanks A0)
This commit is contained in:
parent
4f8b279c63
commit
4fefcf14e0
@ -112,20 +112,8 @@ namespace MCGalaxy.Commands {
|
||||
byte mapNum = 0;
|
||||
|
||||
if (cmd == "ADD") {
|
||||
string level = p.name.ToLower();
|
||||
if (LevelInfo.ExistsOffline(level) || LevelInfo.ExistsOffline(level + "00")) {
|
||||
for (int i = 2; i < p.group.OverseerMaps + 2; i++) {
|
||||
if (LevelInfo.ExistsOffline(p.name.ToLower() + i)) continue;
|
||||
if(i > p.group.OverseerMaps) {
|
||||
p.SendMessage("You have reached the limit for your overseer maps."); return;
|
||||
}
|
||||
level = p.name.ToLower() + i;
|
||||
break;
|
||||
}
|
||||
if (level == p.name.ToLower()) {
|
||||
p.SendMessage("You have reached the limit for your overseer maps."); return;
|
||||
}
|
||||
}
|
||||
string level = NextLevel(p);
|
||||
if (level == null) return;
|
||||
|
||||
if (value == "") value = "128 64 128 flat";
|
||||
else if (value.IndexOf(' ') == -1) value = "128 64 128 " + value;
|
||||
@ -139,19 +127,19 @@ namespace MCGalaxy.Commands {
|
||||
// Set default perbuild permissions
|
||||
Command.all.Find("load").Use(p, level);
|
||||
Level lvl = LevelInfo.FindExact(level);
|
||||
if (lvl != null) {
|
||||
LevelPermission osPerm = Server.osPerbuildDefault;
|
||||
if (osPerm == LevelPermission.Nobody)
|
||||
osPerm = GrpCommands.MinPerm(this);
|
||||
if (lvl == null) return;
|
||||
|
||||
CmdZone.ZoneAll(lvl, p.name);
|
||||
Group grp = Group.findPerm(osPerm);
|
||||
if (grp != null) {
|
||||
Command.all.Find("perbuild").Use(null, lvl.name + " " + grp.name);
|
||||
Player.Message(p, "Use %T/os zone add [name] %Sto allow " +
|
||||
"players ranked below " + grp.ColoredName + " %Sto build in the map.");
|
||||
}
|
||||
}
|
||||
LevelPermission osPerm = Server.osPerbuildDefault;
|
||||
if (osPerm == LevelPermission.Nobody)
|
||||
osPerm = GrpCommands.MinPerm(this);
|
||||
|
||||
CmdZone.ZoneAll(lvl, p.name);
|
||||
Group grp = Group.findPerm(osPerm);
|
||||
if (grp == null) return;
|
||||
|
||||
Command.all.Find("perbuild").Use(null, lvl.name + " " + grp.name);
|
||||
Player.Message(p, "Use %T/os zone add [name] %Sto allow " +
|
||||
"players ranked below " + grp.ColoredName + " %Sto build in the map.");
|
||||
} else if (cmd == "PHYSICS") {
|
||||
if (value == "0" || value == "1" || value == "2" || value == "3" || value == "4" || value == "5")
|
||||
CmdPhysics.SetPhysics(p.level, int.Parse(value));
|
||||
@ -210,8 +198,7 @@ namespace MCGalaxy.Commands {
|
||||
} else if (cmd == "GUNS") {
|
||||
Command.all.Find("allowguns").Use(p, "");
|
||||
} else if (cmd == "CHAT") {
|
||||
CmdMap.SetBool(p, p.level, ref p.level.worldChat, "Roleplay (level only) chat: ", true);
|
||||
Level.SaveSettings(p.level);
|
||||
CmdMap.SetMapOption(p, p.level, "chat", "");
|
||||
} else if (cmd == "RESTORE") {
|
||||
Command.all.Find("restore").Use(p, value);
|
||||
} else if (cmd == "PERVISIT") {
|
||||
@ -233,9 +220,9 @@ namespace MCGalaxy.Commands {
|
||||
Command.all.Find("texture").Use(p, "levelzip " + value);
|
||||
}
|
||||
} else if (cmd == "BUILDABLE") {
|
||||
Command.all.Find("map").Use(p, "buildable");
|
||||
CmdMap.SetMapOption(p, p.level, "buildable", "");
|
||||
} else if (cmd == "DELETABLE") {
|
||||
Command.all.Find("map").Use(p, "deletable");
|
||||
CmdMap.SetMapOption(p, p.level, "deleteable", "");
|
||||
} else {
|
||||
Player.MessageLines(p, mapHelp);
|
||||
}
|
||||
@ -331,6 +318,23 @@ namespace MCGalaxy.Commands {
|
||||
File.Create(path).Dispose();
|
||||
}
|
||||
|
||||
static string NextLevel(Player p) {
|
||||
string level = p.name.ToLower();
|
||||
if (LevelInfo.ExistsOffline(level) || LevelInfo.ExistsOffline(level + "00")) {
|
||||
for (int i = 2; i < p.group.OverseerMaps + 2; i++) {
|
||||
if (LevelInfo.ExistsOffline(p.name.ToLower() + i)) continue;
|
||||
if(i > p.group.OverseerMaps) {
|
||||
p.SendMessage("You have reached the limit for your overseer maps."); return null;
|
||||
}
|
||||
return p.name.ToLower() + i;
|
||||
}
|
||||
if (level == p.name.ToLower()) {
|
||||
p.SendMessage("You have reached the limit for your overseer maps."); return null;
|
||||
}
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
||||
static string FirstMapName(Player p) {
|
||||
/* Returns the proper name of the User Level. By default the User Level will be named
|
||||
* "UserName" but was earlier named "UserName00". Therefore the Script checks if the old
|
||||
@ -391,7 +395,7 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
static string[] zoneHelp = {
|
||||
"%T/os zone add [player/rank] %H- Adds a zone for a player or a rank, " +
|
||||
"allowing them to always build in your map.",
|
||||
"allowing them to always build in your map.",
|
||||
"%T/os zone del all %H- Deletes all zones in your map.",
|
||||
"%T/os zone list %H- Shows zones affecting a particular block.",
|
||||
"%T/os zone block [name] %H- Prevents them from joining your map.",
|
||||
|
@ -55,6 +55,9 @@ namespace MCGalaxy.Commands.World {
|
||||
}
|
||||
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "set map options."); return; }
|
||||
if (opt.CaselessEq("realmowner") && !CheckExtraPerm(p, 2)) {
|
||||
MessageNeedExtra(p, "set personal realm owners.", 2); return;
|
||||
}
|
||||
SetMapOption(p, lvl, opt, value);
|
||||
}
|
||||
|
||||
@ -71,7 +74,7 @@ namespace MCGalaxy.Commands.World {
|
||||
return args.Length == (optHasArg ? 2 : 1);
|
||||
}
|
||||
|
||||
void SetMapOption(Player p, Level lvl, string opt, string value) {
|
||||
internal static void SetMapOption(Player p, Level lvl, string opt, string value) {
|
||||
switch (opt.ToLower()) {
|
||||
case "theme":
|
||||
lvl.theme = value;
|
||||
@ -124,7 +127,6 @@ namespace MCGalaxy.Commands.World {
|
||||
SetBool(p, lvl, ref lvl.Deletable, "Deletable: ");
|
||||
lvl.UpdateBlockPermissions(); break;
|
||||
case "realmowner":
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, "set personal realm owners.", 2); return; }
|
||||
lvl.RealmOwner = value;
|
||||
if (value == "") Player.Message(p, "Removed realm owner for this level.");
|
||||
else Player.Message(p, "Set realm owner of this level to {0}.", value);
|
||||
|
@ -112,7 +112,7 @@ namespace MCGalaxy.Util {
|
||||
if (highlight) {
|
||||
DoHighlight(s, format, args);
|
||||
} else {
|
||||
if (!format.UndoEntry(p, path, marks, ref temp, start)) break;
|
||||
// TODO: fixy fix if (!format.UndoEntry(p, path, marks, ref temp, start)) break;
|
||||
}
|
||||
if (args.Stop) break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user