Force Spawn in Specific Location

Discussion in 'Plugin Development' started by LRFLEW, Jun 13, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    LRFLEW

    I'm currently working on a chunk generator that produces a very broken-up world, and the area I can safely spawn someone is exactly one block big (and is under another block). When you first spawn, the player usually starts somewhere around the point I want to spawn at (which leads them to fall strait into the void) (they usually spawn right over the void). When they respawn, they go exactly where they should, but I'm wondering if there's a way to prevent the first fall. I understand it has something to do with the "spawn radius," but how do I change it (either in the code or as a server setting, but preferably in the code)?

    Thanks
     
  2. Offline

    CorrieKay

    teleport them to the location on player join.
     
  3. Offline

    LRFLEW

    wouldn't that teleport them EVERY time they joined the game? What about just first join?
     
  4. Offline

    CorrieKay

    yknow, you could always just change the maps spawn location.
     
  5. Offline

    LRFLEW

    that's what I'm doing when I define getFixedSpawnLocation(). When I respawn, it puts me right where I need to be, but first time spawning puts you near it :(
     
  6. Offline

    CorrieKay

    if you change the worlds spawn location with world.setSpawnLocation(loc.getX(),loc.getY(),loc.getZ()) it will spawn the player there whenever they join for the first time, respawn, etc.
     
  7. Offline

    LRFLEW

    It appears to spawn them NEAR that point on the first spawn (I tried it, it didn't work). Any other ideas?
     
  8. Offline

    LucasEmanuel

    When a player joins use the player.getFirstPlayed() and compare that value to the current date, if it is his/her first visit, teleport the player to a predefined location else, do nothing. :)
     
  9. Offline

    MonsieurApple

    I wonder if hasPlayedBefore() returns false in onPlayerJoin vs onPlayerLogin... would be interesting to test
     
  10. Offline

    LucasEmanuel

    Oh i must of missed that method :)
     
  11. Offline

    Jumla

    Well, Mr. Monsieur; I believe that hasPlayedBefore() simply checks for a player file in the map; therefor not working with multiworld/MultiInv. Not positive; just something for OP to keep in mind.
     
Thread Status:
Not open for further replies.

Share This Page