summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-16 05:52:58 +0000
committersnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-16 05:52:58 +0000
commitfc9a9c2b9f8809d014d9cd462391dcd28dd3cb47 (patch)
tree409ee2d0b1a091c501a640b8532461fabb904dfa
parent76dda664d79c8151bca0f4f6f016a78801339cdc (diff)
downloadEssentials-fc9a9c2b9f8809d014d9cd462391dcd28dd3cb47.tar
Essentials-fc9a9c2b9f8809d014d9cd462391dcd28dd3cb47.tar.gz
Essentials-fc9a9c2b9f8809d014d9cd462391dcd28dd3cb47.tar.lz
Essentials-fc9a9c2b9f8809d014d9cd462391dcd28dd3cb47.tar.xz
Essentials-fc9a9c2b9f8809d014d9cd462391dcd28dd3cb47.zip
[trunk] 1 to 1 ratio in Nether: The code is in two places. Also fixes 1/16=0 error using /world command.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1207 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java27
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandworld.java24
2 files changed, 39 insertions, 12 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index 25bc02871..ead427b82 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -68,12 +68,29 @@ public class EssentialsPlayerListener extends PlayerListener
final World world = worlds.get(user.getWorld() == worlds.get(0) ? 1 : 0);
double factor;
- if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL)
- factor = 16.0;
- else if (user.getWorld().getEnvironment() != world.getEnvironment())
- factor = 1.0 / 16.0;
- else
+ if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL) {
+ if (Essentials.getSettings().use1to1RatioInNether())
+ {
+ factor = 1.0;
+ }
+ else
+ {
+ factor = 16.0;
+ }
+ }
+ else if (user.getWorld().getEnvironment() != world.getEnvironment()) {
+ if (Essentials.getSettings().use1to1RatioInNether())
+ {
+ factor = 1.0;
+ }
+ else
+ {
+ factor = 1.0 / 16.0;
+ }
+ }
+ else {
factor = 1.0;
+ }
int x = loc.getBlockX();
int y = loc.getBlockY();
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
index 93e452fd3..f430b0904 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
@@ -50,19 +50,29 @@ public class Commandworld extends EssentialsCommand
}
double factor;
- if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL)
+ if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL) {
if (Essentials.getSettings().use1to1RatioInNether())
{
- factor = 1;
+ factor = 1.0;
}
else
{
- factor = 16;
+ factor = 16.0;
}
- else if (user.getWorld().getEnvironment() != world.getEnvironment())
- factor = 1 / 16;
- else
- factor = 1;
+ }
+ else if (user.getWorld().getEnvironment() != world.getEnvironment()) {
+ if (Essentials.getSettings().use1to1RatioInNether())
+ {
+ factor = 1.0;
+ }
+ else
+ {
+ factor = 1.0 / 16.0;
+ }
+ }
+ else {
+ factor = 1.0;
+ }
Location loc = user.getLocation();
loc = new Location(world, loc.getBlockX() * factor + .5, loc.getBlockY(), loc.getBlockZ() * factor + .5);