Now /zone add and /os zone add perform name matching.

This commit is contained in:
UnknownShadow200 2016-09-01 22:10:13 +10:00
parent b1faf7c502
commit a96ce73e4d
2 changed files with 13 additions and 6 deletions

View File

@ -112,8 +112,8 @@ namespace MCGalaxy.Commands {
byte mapNum = 0;
if (cmd == "ADD") {
string level = NextLevel(p);
if (level == null) 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;
@ -225,6 +225,8 @@ namespace MCGalaxy.Commands {
if (value == "") {
Player.Message(p, "You did not specify a name to allow building on your map."); return;
}
value = CmdZone.FindZoneOwner(p, value);
if (value == null) return;
CmdZone.ZoneAll(p.level, value);
Player.Message(p, "Added zone for &b" + value);

View File

@ -95,11 +95,10 @@ namespace MCGalaxy.Commands {
bool CheckAdd(Player p, string[] args) {
if (!CheckExtraPerm(p, 3)) { MessageNeedExtra(p, "create zones.", 3); return false; }
if (args.Length == 1) { Help(p); return false; }
if (!ValidName(p, args[1], "player or rank")) return false;
if (Group.Find(args[1]) != null)
args[1] = "grp" + Group.Find(args[1]).name;
if (!ValidName(p, args[1], "player or rank")) return false;
return true;
args[1] = FindZoneOwner(p, args[1]);
return args[1] != null;
}
bool CheckZone(Player p, Vec3S32[] marks, object state, byte type, byte extType) {
@ -153,6 +152,12 @@ namespace MCGalaxy.Commands {
return false;
}
internal static string FindZoneOwner(Player p, string message) {
if (Group.Find(message) != null)
return Group.Find(message).name;
return PlayerInfo.FindMatchesPreferOnline(p, message);
}
public override void Help(Player p) {
Player.Message(p, "%T/zone add [name] %H- Creates a zone only [name] can build in");
Player.Message(p, "%T/zone add [rank] %H- Creates a zone only [rank]+ can build in");