Add handling for liquid net module

This commit is contained in:
Chris 2020-06-02 13:34:26 +09:30
parent 48d610d33f
commit 1c0a649a0c
3 changed files with 36 additions and 2 deletions

View file

@ -0,0 +1,29 @@
using System.IO;
namespace TShockAPI.Handlers.NetModules
{
/// <summary>
/// Handles the NetLiquidModule. Rejects all incoming net liquid requests, as clients should never send them
/// </summary>
public class LiquidHandler : INetModuleHandler
{
/// <summary>
/// Does nothing. We should not deserialize this data
/// </summary>
/// <param name="data"></param>
public void Deserialize(MemoryStream data)
{
// No need to deserialize
}
/// <summary>
/// Rejects the packet. Clients should not send this to us
/// </summary>
/// <param name="player"></param>
/// <param name="rejectPacket"></param>
public void HandlePacket(TSPlayer player, out bool rejectPacket)
{
rejectPacket = true;
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using Terraria;
using Terraria;
using static TShockAPI.GetDataHandlers;
namespace TShockAPI.Handlers.NetModules
@ -48,6 +47,11 @@ namespace TShockAPI.Handlers.NetModules
handler = new PylonHandler();
break;
}
case NetModulesTypes.Liquid:
{
handler = new LiquidHandler();
break;
}
default:
{
// As of 1.4.x.x, this is now used for more things: