TShock/TShockAPI/Handlers/EmojiHandler.cs
Patrikkk f538ceb793 Adding EmojiHandler to handle an exploit. Adding sendemoji permission and checks.
I know, this is not something important, but I'm going through the new packets one by one and adding events developers can work with, patching exploits, and thought this could be a core permission.
2020-06-01 15:24:02 +02:00

31 lines
775 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TShockAPI.Handlers
{
/// <summary>
/// Handles an exploit and checks for permissions.
/// </summary>
public class EmojiHandler
{
public void OnEmoji(object sender, GetDataHandlers.EmojiEventArgs args)
{
if (args.PlayerIndex != args.Player.Index)
{
TShock.Log.ConsoleError($"EmojiHandler: Packet is spoofing to be player ID {args.PlayerIndex}! - From [{args.Player.Index}]{args.Player.Name}");
args.Handled = true;
return;
}
if (!args.Player.HasPermission(Permissions.sendemoji))
{
args.Player.SendErrorMessage("You have no permission to send emotes!");
args.Handled = true;
return;
}
}
}
}