Why does not my "setRespawnLocation" Work?

Discussion in 'Plugin Development' started by ceoepts, Jul 22, 2013.

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

    ceoepts

    Problem:
    Im trying to make the player to respawn at a location defined in Config
    Code Snippets:PlayerRespawnEvent:
    Code:
        @EventHandler
        public void Respawn(PlayerRespawnEvent e){
            if(ingame.containsKey(e.getPlayer())){
                if(Red.contains(e.getPlayer())){
                    e.setRespawnLocation(GetRed());
                }else if(Blue.contains(e.getPlayer())){
                    e.setRespawnLocation(GetBlue());
                }
                ClearInv(e.getPlayer());
                GiveInv(e.getPlayer());
            }
        }
    
    GetRed:
    Code:
        public Location GetRed(){
            double X = getConfig().getDouble("red.X");
            double Y = getConfig().getDouble("red.Y");
            double Z = getConfig().getDouble("red.Z");
            Location l = new Location(getServer().getWorld(getConfig().getString("world")), X, Y, Z);
            return l;
        }
    GetBlue:

    Code:
        public Location GetBlue(){
     
            double X = getConfig().getDouble("blue.X");
     
            double Y = getConfig().getDouble("blue.Y");
     
            double Z = getConfig().getDouble("blue.Z");
     
            Location l = new Location(getServer().getWorld(getConfig().getString("world")), X, Y, Z);
     
            return l;
     
        }
    Please help me as fast as possible. And the e.setRespawnLocation works because i sended a message to the player when i debugged


     
  2. Offline

    Alex3543

    Any console errors? Registered events?
     
  3. Offline

    ceoepts

    All events are registered and no console error

    Changed Event Priority to highest now it works.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  4. Offline

    JPG2000

    ceoepts Maby try making them respawn at there bed location, and seting there bed loction and blue or red.
     
  5. Offline

    SnakeEyes

    Solved.
     
Thread Status:
Not open for further replies.

Share This Page