[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
This commit is contained in:
snowleo 2011-04-16 05:52:58 +00:00
parent 76dda664d7
commit fc9a9c2b9f
2 changed files with 39 additions and 12 deletions

View File

@ -68,12 +68,29 @@ public class EssentialsPlayerListener extends PlayerListener
final World world = worlds.get(user.getWorld() == worlds.get(0) ? 1 : 0); final World world = worlds.get(user.getWorld() == worlds.get(0) ? 1 : 0);
double factor; 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) {
factor = 16.0; if (Essentials.getSettings().use1to1RatioInNether())
else if (user.getWorld().getEnvironment() != world.getEnvironment()) {
factor = 1.0 / 16.0; factor = 1.0;
else }
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; factor = 1.0;
}
int x = loc.getBlockX(); int x = loc.getBlockX();
int y = loc.getBlockY(); int y = loc.getBlockY();

View File

@ -50,19 +50,29 @@ public class Commandworld extends EssentialsCommand
} }
double factor; 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()) if (Essentials.getSettings().use1to1RatioInNether())
{ {
factor = 1; factor = 1.0;
} }
else else
{ {
factor = 16; factor = 16.0;
} }
else if (user.getWorld().getEnvironment() != world.getEnvironment()) }
factor = 1 / 16; else if (user.getWorld().getEnvironment() != world.getEnvironment()) {
else if (Essentials.getSettings().use1to1RatioInNether())
factor = 1; {
factor = 1.0;
}
else
{
factor = 1.0 / 16.0;
}
}
else {
factor = 1.0;
}
Location loc = user.getLocation(); Location loc = user.getLocation();
loc = new Location(world, loc.getBlockX() * factor + .5, loc.getBlockY(), loc.getBlockZ() * factor + .5); loc = new Location(world, loc.getBlockX() * factor + .5, loc.getBlockY(), loc.getBlockZ() * factor + .5);