Location void, possible?

Discussion in 'Plugin Development' started by bwfcwalshy, Aug 22, 2014.

Thread Status:
Not open for further replies.
  1. I am trying to make a location but it trys to make a return, I am not sure what exactly I am supposed to return.

    This is my current code:
    Code:java
    1. public static Location toZombieLocation(Player player){
    2. main.getConfig().getInt("Locations.Zombie.X");
    3. main.getConfig().getInt("Locations.Zombie.Y");
    4. main.getConfig().getInt("Locations.Zombie.Z");
    5. main.getConfig().getString("Locations.Zombie.World");
    6. }
     
  2. Offline

    Necrodoom

    You construct a Location and return it.
     
  3. Offline

    MCMatters

    Code:java
    1. public static Location getZombieLocation(){
    2. return new Location(Bukkit.getWorld(main.getConfig().getString("Locations.Zombie.World")), main.getConfig().getInt("Locations.Zombie.X"), main.getConfig().getInt("Locations.Zombie.Y"), main.getConfig().getInt("Locations.Zombie.Z"));
    3.  

    OR
    to teleport to
    Code:java
    1.  
    2. public static void toZombieLocation(Player player){
    3. Location loc = new Location(Bukkit.getWorld(main.getConfig().getString("Locations.Zombie.World")), main.getConfig().getInt("Locations.Zombie.X"), main.getConfig().getInt("Locations.Zombie.Y"), main.getConfig().getInt("Locations.Zombie.Z"));
    4. player.teleport(loc);
    5. }
    6. }
     
  4. Offline

    teej107

    It's because you have your method set to return a Location.
     
  5. Offline

    MCMatters

    bwfcwalshy
     
  6. Offline

    fireblast709

    Eew static
     
    jthort likes this.
Thread Status:
Not open for further replies.

Share This Page