public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { var ownerRaw = arguments.ElementAtOrDefault(0); if (ownerRaw == null) { response = "Missing owner"; return(false); } var owner = CommandExtensions.MatchPlayers(ownerRaw, sender)[0]; var pet = UnityEngine.Object.Instantiate(LiteNetLib4MirrorNetworkManager.singleton.playerPrefab, owner.playerMovementSync.RealModelPosition, Quaternion.identity); var hub = ReferenceHub.GetHub(pet); foreach (var component in pet.GetComponents <Behaviour>()) { if (component is ReferenceHub || component is CharacterClassManager || component is PlayerMovementSync || component is PlayerPositionManager) { continue; } component.enabled = false; } var roleRaw = arguments.ElementAtOrDefault(1); if (roleRaw == null || !Enum.TryParse <RoleType>(roleRaw, true, out var role)) { response = $"Missing role ({Enum.GetNames(typeof(RoleType)).Join()})"; return(false); } hub.characterClassManager.NetworkCurClass = role; pet.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); Timing.CallDelayed(1f, () => { hub.nicknameSync.MyNick = $"{owner.nicknameSync.MyNick}'s pet"; NetworkServer.Spawn(pet); }); var pets = Pets[owner] = Pets.GetValueSafe(owner) ?? new List <ReferenceHub>(); pets.Add(hub); hub.characterClassManager.netIdentity.isLocalPlayer = true; hub.characterClassManager.netIdentity.connectionToClient = hub.characterClassManager.netIdentity.connectionToServer = NetworkServer.localConnection; hub.queryProcessor.PlayerId = -1 - Pets.Values.Sum(x => x.Count); hub.playerMovementSync._realModelPosition = owner.playerMovementSync.RealModelPosition; response = "Created pet"; return(false); }