Merge pull request #2522 from Terrarxxn/general-devel

Fix item dupe via /logout & NPC (#2495 issue)
This commit is contained in:
Chris 2022-02-23 20:52:58 +10:30 committed by GitHub
commit b8571d336c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -27,6 +27,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
## TShock 4.5.12
* Fixed the ability to spawn Zenith projectile with non-original items. (@AgaSpace)
* Fixed item dupe via /logout & NPC. (@Terrarxxn)
* Added hook `GetDataHandlers.OnNpcTalk` for NpcTalk and a handler for it that stops unregistered and logged out players from interacting with NPCs, preventing them from smuggling or duplicating items via NPC item slots. (@tru321)
* Fixed the ability to create custom messages with your death (or the death of another player) (@AgaSpace)
* Added the `OnSignRead` handler in `GetDataHandler`, and added the `SignRead` event. Added check to ensure the sign being read is within world bounds `(x >= 0 && y >= 0 && x < Main.maxTilesX && y < Main.maxTilesY)`. (@drunderscore)

View file

@ -911,6 +911,12 @@ namespace TShockAPI
return;
}
if (args.Player.TPlayer.talkNPC != -1)
{
args.Player.SendErrorMessage("Please close NPC windows before logging out.");
return;
}
args.Player.Logout();
args.Player.SendSuccessMessage("You have been successfully logged out of your account.");
if (Main.ServerSideCharacter)