All GroupManager.RenameGroup() database calls are now done in a transaction
As pointed out by @hakusaro, in order to prevent any damage during the process all database calls need to be done in a transaction. Transactions allow us to rollback from a pending state in case something goes wrong.
This commit is contained in:
parent
02806a2429
commit
08e182f59e
2 changed files with 94 additions and 48 deletions
|
|
@ -3077,25 +3077,25 @@ namespace TShockAPI
|
|||
return;
|
||||
case "rename":
|
||||
#region Rename group
|
||||
{
|
||||
if (args.Parameters.Count != 3)
|
||||
{
|
||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}group rename <group> <new name>", Specifier);
|
||||
return;
|
||||
}
|
||||
if (args.Parameters.Count != 3)
|
||||
{
|
||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}group rename <group> <new name>", Specifier);
|
||||
return;
|
||||
}
|
||||
|
||||
string group = args.Parameters[1];
|
||||
string newName = args.Parameters[2];
|
||||
try
|
||||
{
|
||||
string response = TShock.Groups.RenameGroup(group, newName);
|
||||
args.Player.SendSuccessMessage(response);
|
||||
string group = args.Parameters[1];
|
||||
string newName = args.Parameters[2];
|
||||
try
|
||||
{
|
||||
string response = TShock.Groups.RenameGroup(group, newName);
|
||||
args.Player.SendSuccessMessage(response);
|
||||
}
|
||||
catch (GroupManagerException ex)
|
||||
{
|
||||
args.Player.SendErrorMessage(ex.Message);
|
||||
}
|
||||
}
|
||||
catch (GroupManagerException ex)
|
||||
{
|
||||
args.Player.SendErrorMessage(ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
return;
|
||||
case "del":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue