Fixed modgroup to actually update the local( ram ) copies of the groups. Also set it up to properly delete from a group.

This commit is contained in:
Zack Piispanen 2011-11-26 00:28:46 -05:00
parent bb711f8e1d
commit 56beeb446a
2 changed files with 15 additions and 3 deletions

View file

@ -154,8 +154,10 @@ namespace TShockAPI.DB
permissions.AddRange(group.permissions.Where(s => !permissions.Contains(s)));
if (database.Query("UPDATE GroupList SET Commands=@0 WHERE GroupName=@1", String.Join(",", permissions), name) != 0)
{
message = "Group " + name + " has been modified successfully.";
group.SetPermission( permissions );
}
return message;
}
@ -168,11 +170,13 @@ namespace TShockAPI.DB
var group = Tools.GetGroup(name);
//Only get permissions that exist in the group.
var newperms = permissions.Where(s => group.permissions.Contains(s));
var newperms = group.permissions.Except( permissions );
if (database.Query("UPDATE GroupList SET Commands=@0 WHERE GroupName=@1", String.Join(",", newperms), name) != 0)
{
message = "Group " + name + " has been modified successfully.";
group.SetPermission( newperms.ToList() );
}
return message;
}