Overriding/changing player respawn location?

So I need to teleport the player to spawn position
This is how config looks like:

{
  "x": 120.0,
  "y": 0.0,
  "z": -160.0
}

Here is the code:

void OnPlayerRespawn(BasePlayer player)
{
      player.Teleport(new Vector3(configData.x, configData.y, configData.z));
}
Does it work or not? What's your problem? OnPlayerRespawn is before player actually respawned, you should use OnPlayerRespawned OR return BasePlayer.SpawnPoint in OnPlayerRespawn - game will use this one instead of it's own.
No it doesnt work. How do I declare this return new BasePlayer.SpawnPoint() { 
Also a sidenote - y:0 is waterlevel, your player most likely to fall through the ground. Use TerrainHeightMap.GetHeight(Vector3)

Yes it is actually almost in the water, but thanks for the advice :)
I have error in Vector3

return new BasePlayer.SpawnPoint() { pos = Vector3(configData.x, configData.y, configData.z) };
new Vector3*
Now the return is error
void OnPlayerRespawned(BasePlayer player)
        {

            return new BasePlayer.SpawnPoint() { pos = new Vector3(configData.x, configData.y, configData.z) };
        }​
Because you need to change return type. Don't worry, it's ok, you just need a month or a few of them to understand C# better. Change void to BasePlayer.SpawnPoint so you say that this function returns spawn point. Or change it to object :)

Thanks for the help :) Changed it to bool

I have zero error now but it doesnt teleports me anywhere, maybe I save the position and read it wrong from config?

 private ConfigData configData;
        class ConfigData
        {
            [JsonProperty(PropertyName = "x")]
            public float x { get; set; }
            [JsonProperty(PropertyName = "y")]
            public float y { get; set; }
            [JsonProperty(PropertyName = "z")]
            public float z { get; set; }
        }
        private void LoadVariables()
        {
            LoadConfigVariables();
            SaveConfig();
        }
        protected override void LoadDefaultConfig()
        {
            var config = new ConfigData
            {
                x = 120,
                y = 0,
                z = -160
            };
            SaveConfig(config);
        }
        private void LoadConfigVariables() => configData = Config.ReadObject();
        void SaveConfig(ConfigData config) => Config.WriteObject(config, true);
Since you are using these variables instead of auto-called hook "protectedoverridevoidLoadConfig", you should manually call LoadVariables method in Init. Changed what to bool tho? 0.o

To get ground height you might find that useful: 

var vector = new Vector3(configData.x,0,configData.z);
vector.y = TerrainMeta.HeightMap.GetHeight(vector);

I meant object sorry :D

I do not have an init void

Create one then :)
void Init() => LoadVariables(); or with {}
I am still in different position
object OnPlayerRespawned(BasePlayer player)
        {
            var vector = new Vector3(configData.x, 0, configData.z);
            vector.y = TerrainMeta.HeightMap.GetHeight(vector);
            return new BasePlayer.SpawnPoint() { pos = (Vector3)vector};
        }​

But when I do this command it works

        [ChatCommand("Hey")]
        void HelloCommand(BasePlayer player)
        {
            player.Teleport(new Vector3(configData.x, configData.y, configData.z));
        }

This works for me...

        object OnPlayerRespawn(BasePlayer player)
        {
            BasePlayer.SpawnPoint spawnPoint = new BasePlayer.SpawnPoint();
            spawnPoint.pos = new Vector3(x, y, z);
            return spawnPoint;
        }