Merge pull request #2278 from bartico6/fix-reply-to-offline-players

Fix /r against offline players.
This commit is contained in:
Lucas Nicodemus 2021-04-17 02:55:06 -07:00 committed by GitHub
commit 61cd7f8ef0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -17,6 +17,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Added handling to the PlayerChat hook event. (@QuiCM - Thanks for the suggestion @Arthri)
* Changed the spawnboss command to support silent command specifiers. (@QuiCM, suggested by @nojomyth-dev)
* Updated /godmode to use Journey Mode's Godmode power instead of healing on damage. (requested by @tlworks, backported by @bartico6, implemented preemptive bugfix for creative powers mentioned by @Stealownz)
* Fixed /r attempting to send messages to players that have since disconnected. (@bartico6, reported by @Arthri)
## TShock 4.5.0.1
* Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle, @ATFGK)

View file

@ -5366,12 +5366,16 @@ namespace TShockAPI
{
args.Player.SendErrorMessage("You are muted.");
}
else if (args.Player.LastWhisper != null)
else if (args.Player.LastWhisper != null && args.Player.LastWhisper.Active)
{
var msg = string.Join(" ", args.Parameters);
args.Player.LastWhisper.SendMessage(String.Format("<From {0}> {1}", args.Player.Name, msg), Color.MediumPurple);
args.Player.SendMessage(String.Format("<To {0}> {1}", args.Player.LastWhisper.Name, msg), Color.MediumPurple);
}
else if (args.Player.LastWhisper != null)
{
args.Player.SendErrorMessage("The player you're attempting to reply to is no longer online.");
}
else
{
args.Player.SendErrorMessage("You haven't previously received any whispers. Please use {0}whisper to whisper to other people.", Specifier);