Пример #1
0
        public string Execute(string[] bits, Blob blob, ClientServerConnection connection, ICommandsApi api, out object[] responseParams)
        {
            responseParams = new object[0];
            string player = connection.Credentials.Username;

            if (bits.Length != 2)
            {
                return("Usage: /tp2 player");
            }

            EntityId playerEntityId1 = api.FindPlayerEntityId(player);
            EntityId playerEntityId2 = api.FindPlayerEntityId(bits[1]);
            Entity   entity1;
            Entity   entity2;

            if (!api.TryGetEntity(playerEntityId1, out entity1) || !api.TryGetEntity(playerEntityId2, out entity2))
            {
                return("commands.playerEntityNotFound");
            }
            StaxelEssentialsHolder.SetBack(entity1.Physics.Position);
            if (!entity1.Physics.Teleport(entity2.Physics.Position))
            {
                return("commands.teleport.distance");
            }
            return("commands.teleport.success");
        }
Пример #2
0
        public string Execute(string[] bits, Blob blob, ClientServerConnection connection, ICommandsApi api, out object[] responseParams)
        {
            Vector3D storeLast;

            responseParams = new object[0];
            string   player             = connection.Credentials.Username;
            EntityId connectionEntityId = api.FindPlayerEntityId(player);
            Entity   entity;

            if (!api.TryGetEntity(connectionEntityId, out entity))
            {
                return("commands.playerEntityNotFound");
            }
            if (StaxelEssentialsHolder.GetBack() == null)
            {
                return("You don't have a place to go back to!");
            }
            storeLast = entity.Physics.Position;
            if (entity.Physics.Teleport(StaxelEssentialsHolder.GetBack()))
            {
                StaxelEssentialsHolder.SetBack(storeLast);
                return("commands.teleport.success");
            }
            return("commands.teleport.distance");
        }
Пример #3
0
        public string Execute(string[] bits, Blob blob, ClientServerConnection connection, ICommandsApi api, out object[] responseParams)
        {
            responseParams = new object[0];
            string   player             = connection.Credentials.Username;
            EntityId connectionEntityId = api.FindPlayerEntityId(player);
            Entity   entity;

            if (!api.TryGetEntity(connectionEntityId, out entity))
            {
                return("commands.playerEntityNotFound");
            }
            StaxelEssentialsHolder.SetBack(entity.Physics.Position);
            if (entity.Physics.Teleport(entity.PlayerEntityLogic.GetHome()))
            {
                return("commands.teleport.success");
            }
            return("commands.teleport.distance");
        }