Updated the SetUserGroup in the commands.
This commit is contained in:
parent
1e037748c1
commit
230d9b0945
2 changed files with 7 additions and 2 deletions
|
|
@ -1176,7 +1176,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TShock.UserAccounts.SetUserGroup(account, args.Parameters[2]);
|
TShock.UserAccounts.SetUserGroup(args.Player, account, args.Parameters[2]);
|
||||||
TShock.Log.ConsoleInfo(GetString("{0} changed account {1} to group {2}.", args.Player.Name, account.Name, args.Parameters[2]));
|
TShock.Log.ConsoleInfo(GetString("{0} changed account {1} to group {2}.", args.Player.Name, account.Name, args.Parameters[2]));
|
||||||
args.Player.SendSuccessMessage(GetString("Account {0} has been changed to group {1}.", account.Name, args.Parameters[2]));
|
args.Player.SendSuccessMessage(GetString("Account {0} has been changed to group {1}.", account.Name, args.Parameters[2]));
|
||||||
|
|
||||||
|
|
@ -1193,6 +1193,10 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
args.Player.SendErrorMessage(GetString($"User {account.Name} does not exist."));
|
args.Player.SendErrorMessage(GetString($"User {account.Name} does not exist."));
|
||||||
}
|
}
|
||||||
|
catch (UserGroupUpdateLockedException)
|
||||||
|
{
|
||||||
|
args.Player.SendErrorMessage(GetString("Hook blocked the attempt to change the user group."));
|
||||||
|
}
|
||||||
catch (UserAccountManagerException e)
|
catch (UserAccountManagerException e)
|
||||||
{
|
{
|
||||||
args.Player.SendErrorMessage(GetString($"User {account.Name} could not be added. Check console for details."));
|
args.Player.SendErrorMessage(GetString($"User {account.Name} could not be added. Check console for details."));
|
||||||
|
|
|
||||||
|
|
@ -555,7 +555,8 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TShock.UserAccounts.SetUserGroup(account, group);
|
TShock.UserAccounts.SetUserGroup(new TSRestPlayer(args.TokenData.Username, TShock.Groups.GetGroupByName(args.TokenData.UserGroupName)),
|
||||||
|
account, group);
|
||||||
response.Add("group-response", "Group updated successfully");
|
response.Add("group-response", "Group updated successfully");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue