mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-21 19:42:37 -04:00
Allow multiple realm owners for a map.
This commit is contained in:
parent
b75360efae
commit
ae2806bed2
@ -104,8 +104,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
void HandleMapCommand(Player p, string message, string cmd, string value) {
|
||||
bool mapOnly = cmd == "PHYSICS" || cmd == "MOTD" || cmd == "GUNS" || cmd == "CHAT" || cmd == "RESTORE" ||
|
||||
cmd == "PERVISIT" || cmd == "TEXTURE" || cmd == "BUILDABLE" || cmd == "DELETEABLE";
|
||||
bool mapOnly = !(cmd == "ADD" || cmd == "DELETE" || cmd == "SAVE");
|
||||
if (mapOnly && !OwnsMap(p, p.level)) {
|
||||
Player.Message(p, "You may only perform that action on your own map."); return;
|
||||
}
|
||||
@ -339,8 +338,15 @@ namespace MCGalaxy.Commands {
|
||||
return p.name.ToLower();
|
||||
}
|
||||
|
||||
static char[] splitChars = new [] { ',' };
|
||||
static bool OwnsMap(Player p, Level lvl) {
|
||||
return lvl.RealmOwner.CaselessEq(p.name) || p.level.name.CaselessStarts(p.name);
|
||||
if (lvl.name.CaselessStarts(p.name)) return true;
|
||||
string[] owners = lvl.RealmOwner.Replace(" ", "").Split(splitChars);
|
||||
|
||||
foreach (string owner in owners) {
|
||||
if (owner.CaselessEq(p.name)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
|
@ -130,7 +130,7 @@ namespace MCGalaxy.Commands.World {
|
||||
case "realmowner":
|
||||
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);
|
||||
else Player.Message(p, "Set realm owner/owners of this level to {0}.", value);
|
||||
break;
|
||||
default:
|
||||
Player.Message(p, "Could not find option entered."); return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user