Teleporting people on PlayerRespawn?

Discussion in 'Plugin Development' started by joehot2000, Apr 22, 2013.

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

    joehot2000

    Hi, this peice of code does not seem to work.

    Code:
    @EventHandler(priority = EventPriority.MONITOR)
    public void onPlayerRespawnEvent(PlayerRespawnEvent event){
    if (on == false) return;
    Player p = event.getPlayer();
    if (red.contains(p)){
    p.teleport(redloc);
    GiveItems(p);
    }else if (blue.contains(p)){
    p.teleport(redloc);
    GiveItems(p);
    }
    }
    
    It gives the items, but does not teleport the player!
    Any help?
     
  2. Offline

    Tirelessly

    Store their names in the set/lists, not their object.
     
  3. Offline

    stuntguy3000

    use event.setrespawnlocation
     
  4. Offline

    joehot2000

    Thank you :)
     
  5. Offline

    nitrousspark

    when you do something to a player right as they respawn, they act as an OfflinePlayer, so to use them as an actual player you need to run a timer for like 5 ticks
     
Thread Status:
Not open for further replies.

Share This Page