File posFile = WorldConfig.get(world).getPlayerData(player.getName());
if (!posFile.exists()) {
return null;
}
CommonTagCompound data = read(posFile, player);
CommonTagList posInfo = data.getValue(DATA_TAG_LASTPOS, CommonTagList.class);
if (posInfo != null && posInfo.size() == 3) {
// Apply position
Location location = new Location(world, posInfo.getValue(0, 0.0), posInfo.getValue(1, 0.0), posInfo.getValue(2, 0.0));
CommonTagList rotInfo = data.getValue(DATA_TAG_LASTROT, CommonTagList.class);
if (rotInfo != null && rotInfo.size() == 2) {
location.setYaw(rotInfo.getValue(0, 0.0f));
location.setPitch(rotInfo.getValue(1, 0.0f));
}
return location;
}
return null;
}