Update for new YamlStorage constructor

This commit is contained in:
fullwall 2012-08-05 13:19:16 +08:00
parent e4ccfc10fe
commit 378077edd6
3 changed files with 7 additions and 6 deletions

View File

@ -313,7 +313,7 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
"Citizens NPC Storage");
}
if (saves == null) {
saves = new YamlStorage(getDataFolder() + File.separator + Setting.STORAGE_FILE.asString(),
saves = new YamlStorage(new File(getDataFolder(), Setting.STORAGE_FILE.asString()),
"Citizens NPC Storage");
}
Messaging.logF("Save method set to %s.", saves.toString());

View File

@ -16,7 +16,7 @@ public class Settings {
private final DataKey root;
public Settings(File folder) {
config = new YamlStorage(folder + File.separator + "config.yml", "Citizens Configuration");
config = new YamlStorage(new File(folder, "config.yml"), "Citizens Configuration");
root = config.getKey("");
config.load();

View File

@ -23,6 +23,7 @@ import org.bukkit.util.Vector;
import com.google.common.base.Splitter;
public class Util {
// Static class for small (emphasis small) utility methods
private Util() {
}
@ -42,20 +43,20 @@ public class Util {
if (from.getWorld() != at.getWorld())
return;
Location loc = from.getLocation();
double xDiff = at.getLocation().getX() - loc.getX();
double yDiff = at.getLocation().getY() - loc.getY();
double zDiff = at.getLocation().getZ() - loc.getZ();
double distanceXZ = Math.sqrt(xDiff * xDiff + zDiff * zDiff);
double distanceY = Math.sqrt(distanceXZ * distanceXZ + yDiff * yDiff);
double yaw = (Math.acos(xDiff / distanceXZ) * 180 / Math.PI);
double pitch = (Math.acos(yDiff / distanceY) * 180 / Math.PI) - 90;
if (zDiff < 0.0) {
yaw = yaw + (Math.abs(180 - yaw) * 2);
}
EntityLiving handle = ((CraftLivingEntity) from).getHandle();
handle.yaw = (float) yaw - 90;
handle.pitch = (float) pitch;