From 378077edd6376cf3fdf74bbab1d046feeb12b393 Mon Sep 17 00:00:00 2001 From: fullwall Date: Sun, 5 Aug 2012 13:19:16 +0800 Subject: [PATCH] Update for new YamlStorage constructor --- src/main/java/net/citizensnpcs/Citizens.java | 2 +- src/main/java/net/citizensnpcs/Settings.java | 2 +- src/main/java/net/citizensnpcs/util/Util.java | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/citizensnpcs/Citizens.java b/src/main/java/net/citizensnpcs/Citizens.java index eb5b016c7..8a5e04b0a 100644 --- a/src/main/java/net/citizensnpcs/Citizens.java +++ b/src/main/java/net/citizensnpcs/Citizens.java @@ -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()); diff --git a/src/main/java/net/citizensnpcs/Settings.java b/src/main/java/net/citizensnpcs/Settings.java index 524734903..c99044257 100644 --- a/src/main/java/net/citizensnpcs/Settings.java +++ b/src/main/java/net/citizensnpcs/Settings.java @@ -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(); diff --git a/src/main/java/net/citizensnpcs/util/Util.java b/src/main/java/net/citizensnpcs/util/Util.java index 24c8b95c0..5706bda0d 100644 --- a/src/main/java/net/citizensnpcs/util/Util.java +++ b/src/main/java/net/citizensnpcs/util/Util.java @@ -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;