1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved SETTING SPAWN

Discussion in 'Development' started by AlexSima, Jul 16, 2020.

  1. AlexSima

    AlexSima Spider Jockey

    Messages:
    38
    GitHub:
    AlexSima003
    This bug is really anoying, anyone know how to fix it please?
    I'm setting the spawn for my server and it's spawning me next to the place where i setted the spawn, but in the middle of 4 blocks
    How can i set the spawn in the middle of 1 block?
    Also, i've heard that MSpawns plugin might fix the bug, but it isnt working, the plugin is full of errors and bugs..
     
  2. dadodasyra

    dadodasyra Witch

    Messages:
    68
    GitHub:
    dadodasyra
    Developing your own plugin is a classic, you save the coordinates in a config and teleport the player to the exact coordinates
     
  3. AlexSima

    AlexSima Spider Jockey

    Messages:
    38
    GitHub:
    AlexSima003
    I can make a plugin but what about the code for setting spawn
     
    Last edited: Jul 16, 2020
  4. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    the corner of the block you are on is the coordinate you set. The middle of the block you are on is the coordinate you set plus .5 x and z
     
  5. AlexSima

    AlexSima Spider Jockey

    Messages:
    38
    GitHub:
    AlexSima003
    Yes, i tried /setworldspawn 0.5 60 3 and it keeps spawning me to the old place
    Also when i do /setworldspawn 0.5 60 3 the succesful message its like "Setting world spawn to 0 60 3 succesfully" So i think .5 doesnt work with setworldspawn but im not sure since it keeps spawning me to the old place even after i did /setworldspawn again
     
  6. AlexSima

    AlexSima Spider Jockey

    Messages:
    38
    GitHub:
    AlexSima003
    PHP:
    public function onLogin(PlayerJoinEvent $event){
       
    $player $event->getPlayer();
       
    $player->teleport(new Vector3(XYZ));
       }

    }
    If anyone is looking, check the code above.

    Okay so now this is fixed but...how can i make the player look to North or South and how i can specify where exactly to look
     
    Last edited: Jul 16, 2020
  7. Primus

    Primus Zombie Pigman

    Messages:
    749
    Use Location class.

    This code could help you getting necessary parameters
    PHP:
    public function onMove(PlayerMoveEvent $event) {
           
    $player $event->getPlayer();

           
    $player->sendTip("X: ".$player->getFloorX(). " Y: ".$player->getFloorY()." Z: " $player->getFloorZ()." Y n P: ".$player->getYaw().", ".$player->getPitch());
       }
     
  8. AlexSima

    AlexSima Spider Jockey

    Messages:
    38
    GitHub:
    AlexSima003
    I didnt ask for that, im using a plugin that does that
     
  9. AlexSima

    AlexSima Spider Jockey

    Messages:
    38
    GitHub:
    AlexSima003
  10. AlexSima

    AlexSima Spider Jockey

    Messages:
    38
    GitHub:
    AlexSima003
    Fixed!

    public function onLogin(PlayerJoinEvent $event){
    $player = $event->getPlayer();
    $player->teleport(new Vector3(X, Y, Z), 1.6076975332031);
    }

    }
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.