- Timestamp:
- Nov 22, 2014, 10:54:05 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/CustomCommands/TeleportPlayer.cs
r189 r203 2 2 using System; 3 3 using System.Collections.Generic; 4 using System.Reflection; 4 5 using UnityEngine; 5 6 … … 8 9 public class TeleportPlayer : ConsoleCommand 9 10 { 11 private MethodInfo NetConnection_SendPackage = null; 12 10 13 public TeleportPlayer (ConsoleSdtd cons) : base(cons) 11 14 { 15 Type typeClientInfo = Assembly.GetAssembly (typeof(ClientInfo)).GetType ("ClientInfo"); 16 Type typeNetConnection = typeClientInfo.GetField ("netConnection").FieldType.GetElementType (); 17 MethodInfo[] mis = typeNetConnection.GetMethods (); 18 foreach (MethodInfo mi in mis) { 19 ParameterInfo[] pis = mi.GetParameters (); 20 if (pis.Length == 1) { 21 if (typeof (Package).Equals (pis[0].ParameterType)) { 22 NetConnection_SendPackage = mi; 23 } 24 } 25 } 12 26 } 13 27 … … 72 86 NetPackage_EntityPosAndRot pkg = new NetPackage_EntityPosAndRot (p1.Entity); 73 87 74 p1.ClientInfo.netConnection [0].Send (pkg); 88 if (NetConnection_SendPackage != null) { 89 NetConnection_SendPackage.Invoke (p1.ClientInfo.netConnection [0], new object[] {pkg}); 90 } 75 91 } 76 92 } catch (Exception e) {
Note:
See TracChangeset
for help on using the changeset viewer.