From 048aaf6f0c3b503c921cdc73bc4e524eaa107274 Mon Sep 17 00:00:00 2001
From: quake1337 <3310937+bartico6@users.noreply.github.com>
Date: Tue, 13 Jul 2021 21:47:27 +0200
Subject: [PATCH] /login kick -> error, add XML doc to Utils method.
---
TShockAPI/Commands.cs | 5 ++++-
TShockAPI/Utils.cs | 6 ++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs
index 80e710ad..d0c3b48a 100644
--- a/TShockAPI/Commands.cs
+++ b/TShockAPI/Commands.cs
@@ -825,8 +825,11 @@ namespace TShockAPI
{
var group = TShock.Groups.GetGroupByName(account.Group);
- if (!TShock.Utils.AssertGroupValid(args.Player, group))
+ if (group == null)
+ {
+ args.Player.SendErrorMessage("Login failed: The account references a group that doesn't exist.");
return;
+ }
args.Player.PlayerData = TShock.CharacterDB.GetPlayerData(args.Player, account.ID);
diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs
index 36a6d348..be3722df 100644
--- a/TShockAPI/Utils.cs
+++ b/TShockAPI/Utils.cs
@@ -212,6 +212,12 @@ namespace TShockAPI
} while (TilePlacementValid(tileX, tileY) && TileSolid(tileX, tileY));
}
+ ///
+ /// Asserts that the group reference can be safely assigned to the player object.
+ ///
+ ///
+ ///
+ ///
public bool AssertGroupValid(TSPlayer player, Group group)
{
if (group == null)