Solved Respawn

Discussion in 'Plugin Development' started by DogeDebugger, Mar 24, 2015.

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

    DogeDebugger

    This aint workin ;-;
    Code:
    public static Main plugin = Main.plugin;
      
        public int redx = plugin.getConfig().getInt("ZX");
        public int redy = plugin.getConfig().getInt("ZY");
        public int redz = plugin.getConfig().getInt("ZZ");
      
        public int bluex = plugin.getConfig().getInt("VX");
        public int bluey = plugin.getConfig().getInt("VY");
        public int bluez = plugin.getConfig().getInt("VZ");
      
    
        World w = Bukkit.getServer().getWorld("world");
        Location zombiespawn = new Location(w, redx, redy, redz);
        Location villagerspawn = new Location(w, bluex, bluey, bluez);
    @EventHandler
        public void respawn(PlayerRespawnEvent event) {
            Player p = event.getPlayer();
            if (TeamsManager.getTeamOfPlayer(p).equals(Team.VILLAGERS)) {
                event.setRespawnLocation(villagerspawn);
                p.sendMessage("respawned successfully");
            }
    The thing is a respawn at another set of coordinates(LX, LY, and LZ), which isn't even mentioned in the class.
    My config:
    Code:
    ZX: 54
    ZY: 77
    ZZ: -163
    VX: -17
    VY: 77
    VZ: -145
    ZX1: 78
    ZY1: 70
    ZZ1: -162
    VX1: -40
    VY1: 70
    VZ1: -146
    LX: 16
    LY: 128
    LZ: -155
    Halp

    oh, i am getting the respawn msg
     
    Last edited by a moderator: Mar 24, 2015
  2. Offline

    DogeDebugger

    It's not solved, I'm just getting the msg lol. Not respawning
     
  3. Offline

    nverdier

    @DogeDebugger Try debugging. Print out the coordinates for the locations you create, and compare them to what you have set in the config.
     
  4. Offline

    guitargun

    @DogeDebugger by any coincidence is the LZ etc. your current respawn point? also why do you have a static infront of your Main. why not parsing it through a constructor.
     
  5. Offline

    SuchSwegMuchWow

    @DogeDebugger Try to just teleport the player to the location instead
     
  6. Offline

    Konato_K

  7. Offline

    SuchSwegMuchWow

  8. Offline

    Konato_K

    @SuchSwegMuchWow There is no reason to make a tricky workaround when there is a method in the event
     
  9. Offline

    DogeDebugger

    When the method doesn't work? lol
     
  10. Offline

    Konato_K

    @DogeDebugger The method works, I have used it in all the minigame plugins I made, I'd go with there is another error in the code.
     
  11. Offline

    DogeDebugger

  12. Offline

    nverdier

    DogeDebugger and mine-care like this.
Thread Status:
Not open for further replies.

Share This Page