Remove the test method from Utils, re-route checks to GroupManager
This commit is contained in:
parent
91376ae087
commit
b32058ac51
3 changed files with 3 additions and 25 deletions
|
|
@ -825,7 +825,7 @@ namespace TShockAPI
|
|||
{
|
||||
var group = TShock.Groups.GetGroupByName(account.Group);
|
||||
|
||||
if (!TShock.Utils.AssertGroupValid(args.Player, group, false))
|
||||
if (!TShock.Groups.AssertGroupValid(args.Player, group, false))
|
||||
{
|
||||
args.Player.SendErrorMessage("Login attempt failed - see the message above.");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -2452,7 +2452,7 @@ namespace TShockAPI
|
|||
|
||||
var group = TShock.Groups.GetGroupByName(account.Group);
|
||||
|
||||
if (!TShock.Utils.AssertGroupValid(args.Player, group, true))
|
||||
if (!TShock.Groups.AssertGroupValid(args.Player, group, true))
|
||||
return true;
|
||||
|
||||
args.Player.PlayerData = TShock.CharacterDB.GetPlayerData(args.Player, account.ID);
|
||||
|
|
@ -3023,7 +3023,7 @@ namespace TShockAPI
|
|||
|
||||
var group = TShock.Groups.GetGroupByName(account.Group);
|
||||
|
||||
if (!TShock.Utils.AssertGroupValid(args.Player, group, true))
|
||||
if (!TShock.Groups.AssertGroupValid(args.Player, group, true))
|
||||
return true;
|
||||
|
||||
args.Player.Group = group;
|
||||
|
|
|
|||
|
|
@ -212,28 +212,6 @@ namespace TShockAPI
|
|||
} while (TilePlacementValid(tileX, tileY) && TileSolid(tileX, tileY));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts that the group reference can be safely assigned to the player object.
|
||||
/// <para>If this assertion fails, and <paramref name="kick"/> is true, the player is disconnected. If <paramref name="kick"/> is false, the player will receive an error message.</para>
|
||||
/// </summary>
|
||||
/// <param name="player">The player in question</param>
|
||||
/// <param name="group">The group we want to assign them</param>
|
||||
/// <param name="kick">Whether or not failing this check disconnects the player.</param>
|
||||
/// <returns></returns>
|
||||
public bool AssertGroupValid(TSPlayer player, Group group, bool kick)
|
||||
{
|
||||
if (group == null)
|
||||
{
|
||||
if (kick)
|
||||
player.Disconnect("Your account's group could not be loaded. Please contact server administrators about this.");
|
||||
else
|
||||
player.SendErrorMessage("Your account's group could not be loaded. Please contact server administrators about this.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if a tile is valid.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue