From 3b6a9ffcc27afc073788155ede756df1f8466539 Mon Sep 17 00:00:00 2001
From: Chris <2648373+QuiCM@users.noreply.github.com>
Date: Tue, 2 Jun 2020 14:06:18 +0930
Subject: [PATCH] Add bestiary handler
---
.../Handlers/NetModules/BestiaryHandler.cs | 28 +++++++++++++++++++
.../NetModules/NetModulePacketHandler.cs | 5 ++++
TShockAPI/TShockAPI.csproj | 1 +
3 files changed, 34 insertions(+)
create mode 100644 TShockAPI/Handlers/NetModules/BestiaryHandler.cs
diff --git a/TShockAPI/Handlers/NetModules/BestiaryHandler.cs b/TShockAPI/Handlers/NetModules/BestiaryHandler.cs
new file mode 100644
index 00000000..372ce80f
--- /dev/null
+++ b/TShockAPI/Handlers/NetModules/BestiaryHandler.cs
@@ -0,0 +1,28 @@
+using System.IO;
+
+namespace TShockAPI.Handlers.NetModules
+{
+ ///
+ /// Rejects client->server bestiary net modules as the client should never send this to the server
+ ///
+ internal class BestiaryHandler : INetModuleHandler
+ {
+ ///
+ /// No deserialization needed. This should never be received by the server
+ ///
+ ///
+ public void Deserialize(MemoryStream data)
+ {
+ }
+
+ ///
+ /// This should never be received by the server
+ ///
+ ///
+ ///
+ public void HandlePacket(TSPlayer player, out bool rejectPacket)
+ {
+ rejectPacket = true;
+ }
+ }
+}
diff --git a/TShockAPI/Handlers/NetModules/NetModulePacketHandler.cs b/TShockAPI/Handlers/NetModules/NetModulePacketHandler.cs
index 820d2fe2..007c505b 100644
--- a/TShockAPI/Handlers/NetModules/NetModulePacketHandler.cs
+++ b/TShockAPI/Handlers/NetModules/NetModulePacketHandler.cs
@@ -52,6 +52,11 @@ namespace TShockAPI.Handlers.NetModules
handler = new LiquidHandler();
break;
}
+ case NetModulesTypes.Bestiary:
+ {
+ handler = new BestiaryHandler();
+ break;
+ }
default:
{
// As of 1.4.x.x, this is now used for more things:
diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj
index 2f4a406c..83c31374 100644
--- a/TShockAPI/TShockAPI.csproj
+++ b/TShockAPI/TShockAPI.csproj
@@ -89,6 +89,7 @@
+