how would i save a location in the config. like if somebody types /setlocation it will save that location in a .yml
When you would use the search you probably will already find about twenty threads about the exact same question.
Save it using this: Code: config.set("something.location.X" + player.getLocation.getX()); config.set("location.World" + player.getLocation.getWorld()); config.set("location.Y" + player.getLocation.getY()); config.set("location.Z" + player.getLocation.getZ()); config.set("location.Yaw" + player.getLocation.getYaw()); config.set("location.Pitch" + player.getLocation.getPitch()); and then to get it and store it as a location use this: Code: Location newloc = new Location(config.get("location.World"), config.getDouble("location.X"), config.getDouble("location.Y"), config.getDouble("location.Z"), config.getFloat("location.Yaw"), config.getPitch("location.Pitch")); I am doing that from memory so it may not be 100% correct.
Wow never realised how badly I messed up there, should be Code: config.set("location.World" + player.getLocation.getWorld()); config.set("location.X" + player.getLocation.getX()); config.set("location.Y" + player.getLocation.getY()); config.set("location.Z" + player.getLocation.getZ()); config.set("location.Yaw" + player.getLocation.getYaw()); config.set("location.Pitch" + player.getLocation.getPitch());
Close but you did something wrong, player.getLocation needs to be a Location. So instead do this Code: Location loc = player.getLocation(); config.set("location.World" + loc.getWorld()); config.set("location.X" + loc.getX()); config.set("location.Y" + loc.getY()); config.set("location.Z" + loc.getZ()); config.set("location.Yaw" + loc.getYaw()); config.set("location.Pitch" + .loc.getPitch()); Hope it helps
Nope! Code: Location loc = player.getLocation(); config.set("location.World" , loc.getWorld()); config.set("location.X" , loc.getX()); config.set("location.Y" , loc.getY()); config.set("location.Z" , loc.getZ()); config.set("location.Yaw" , loc.getYaw()); config.set("location.Pitch" , loc.getPitch());