diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2018-11-14 00:11:09 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2018-11-14 00:11:09 -0500 |
commit | 90ecd377c88ba5a4c08a3c7e67618435358e5685 (patch) | |
tree | 4b792e5e7633286973d07c3ef857455cd4a76661 /src/SMAPI/Patches/LidgrenServerPatch.cs | |
parent | 1f578ed890da9f3266046cc253ac7a631ab7575f (diff) | |
download | SMAPI-90ecd377c88ba5a4c08a3c7e67618435358e5685.tar.gz SMAPI-90ecd377c88ba5a4c08a3c7e67618435358e5685.tar.bz2 SMAPI-90ecd377c88ba5a4c08a3c7e67618435358e5685.zip |
rework multiplayer code to allow for upcoming Galaxy server overrides (#480)
Diffstat (limited to 'src/SMAPI/Patches/LidgrenServerPatch.cs')
-rw-r--r-- | src/SMAPI/Patches/LidgrenServerPatch.cs | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/SMAPI/Patches/LidgrenServerPatch.cs b/src/SMAPI/Patches/LidgrenServerPatch.cs index 6f937665..47acd4c4 100644 --- a/src/SMAPI/Patches/LidgrenServerPatch.cs +++ b/src/SMAPI/Patches/LidgrenServerPatch.cs @@ -1,13 +1,9 @@ -using System; using System.Diagnostics.CodeAnalysis; -using System.IO; using System.Reflection; using Harmony; using Lidgren.Network; -using StardewModdingAPI.Framework; using StardewModdingAPI.Framework.Networking; using StardewModdingAPI.Framework.Patching; -using StardewValley; using StardewValley.Network; namespace StardewModdingAPI.Patches @@ -35,13 +31,6 @@ namespace StardewModdingAPI.Patches MethodInfo prefix = AccessTools.Method(this.GetType(), nameof(LidgrenServerPatch.Prefix_LidgrenServer_ParseDataMessageFromClient)); harmony.Patch(method, new HarmonyMethod(prefix), null); } - - // override sendMessage - { - MethodInfo method = typeof(LidgrenServer).GetMethod("sendMessage", BindingFlags.NonPublic | BindingFlags.Instance, null, new [] { typeof(NetConnection), typeof(OutgoingMessage) }, null); - MethodInfo prefix = AccessTools.Method(this.GetType(), nameof(LidgrenServerPatch.Prefix_LidgrenServer_SendMessage)); - harmony.Patch(method, new HarmonyMethod(prefix), null); - } } @@ -66,24 +55,5 @@ namespace StardewModdingAPI.Patches return true; } - - /// <summary>The method to call instead of the <see cref="LidgrenServer.sendMessage"/> method.</summary> - /// <param name="__instance">The instance being patched.</param> - /// <param name="connection">The connection to which to send the message.</param> - /// <param name="___peers">The private <c>peers</c> field on the <paramref name="__instance"/> instance.</param> - /// <param name="___gameServer">The private <c>gameServer</c> field on the <paramref name="__instance"/> instance.</param> - /// <returns>Returns whether to execute the original method.</returns> - /// <remarks>This method must be static for Harmony to work correctly. See the Harmony documentation before renaming arguments.</remarks> - [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Argument names are defined by Harmony.")] - private static bool Prefix_LidgrenServer_SendMessage(LidgrenServer __instance, NetConnection connection, OutgoingMessage message, Bimap<long, NetConnection> ___peers, IGameServer ___gameServer) - { - if (__instance is SLidgrenServer smapiServer) - { - smapiServer.SendMessage(connection, message); - return false; - } - - return true; - } } } |