mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -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) {
|
void HandleMapCommand(Player p, string message, string cmd, string value) {
|
||||||
bool mapOnly = cmd == "PHYSICS" || cmd == "MOTD" || cmd == "GUNS" || cmd == "CHAT" || cmd == "RESTORE" ||
|
bool mapOnly = !(cmd == "ADD" || cmd == "DELETE" || cmd == "SAVE");
|
||||||
cmd == "PERVISIT" || cmd == "TEXTURE" || cmd == "BUILDABLE" || cmd == "DELETEABLE";
|
|
||||||
if (mapOnly && !OwnsMap(p, p.level)) {
|
if (mapOnly && !OwnsMap(p, p.level)) {
|
||||||
Player.Message(p, "You may only perform that action on your own map."); return;
|
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();
|
return p.name.ToLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char[] splitChars = new [] { ',' };
|
||||||
static bool OwnsMap(Player p, Level lvl) {
|
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) {
|
public override void Help(Player p) {
|
||||||
|
@ -130,7 +130,7 @@ namespace MCGalaxy.Commands.World {
|
|||||||
case "realmowner":
|
case "realmowner":
|
||||||
lvl.RealmOwner = value;
|
lvl.RealmOwner = value;
|
||||||
if (value == "") Player.Message(p, "Removed realm owner for this level.");
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
Player.Message(p, "Could not find option entered."); return;
|
Player.Message(p, "Could not find option entered."); return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user