summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-21 11:48:07 +0000
committersnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-21 11:48:07 +0000
commit755938ca5f75f7ff5c22a8fcbb6fad5be37cc3fb (patch)
tree8f537844719d6adea147e61252dbd01d0078f872
parentf4a15da12b3850b037b906c9eb86cac213386c31 (diff)
downloadEssentials-755938ca5f75f7ff5c22a8fcbb6fad5be37cc3fb.tar
Essentials-755938ca5f75f7ff5c22a8fcbb6fad5be37cc3fb.tar.gz
Essentials-755938ca5f75f7ff5c22a8fcbb6fad5be37cc3fb.tar.lz
Essentials-755938ca5f75f7ff5c22a8fcbb6fad5be37cc3fb.tar.xz
Essentials-755938ca5f75f7ff5c22a8fcbb6fad5be37cc3fb.zip
Use the correct nether in case there are more worlds loaded.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1251 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java15
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandworld.java15
2 files changed, 28 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index a111a610c..d6a21d4ce 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -65,7 +65,20 @@ public class EssentialsPlayerListener extends PlayerListener
if (user.getJustPortaled()) return;
Location loc = event.getTo();
- final World world = worlds.get(user.getWorld() == worlds.get(0) ? 1 : 0);
+ World nether = server.getWorld(Essentials.getSettings().getNetherName());
+ if (nether == null) {
+ for (World world : worlds)
+ {
+ if (world.getEnvironment() == World.Environment.NETHER) {
+ nether = world;
+ break;
+ }
+ }
+ if (nether == null) {
+ return;
+ }
+ }
+ final World world = user.getWorld() == nether ? worlds.get(0) : nether;
double factor;
if (user.getWorld().getEnvironment() == World.Environment.NETHER && world.getEnvironment() == World.Environment.NORMAL) {
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
index f430b0904..31826a0aa 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
@@ -23,7 +23,20 @@ public class Commandworld extends EssentialsCommand
if (args.length < 1)
{
- world = worlds.get(user.getWorld() == worlds.get(0) && worlds.size() > 1 ? 1 : 0);
+ World nether = server.getWorld(Essentials.getSettings().getNetherName());
+ if (nether == null) {
+ for (World world2 : worlds)
+ {
+ if (world2.getEnvironment() == World.Environment.NETHER) {
+ nether = world2;
+ break;
+ }
+ }
+ if (nether == null) {
+ return;
+ }
+ }
+ world = user.getWorld() == nether ? worlds.get(0) : nether;
}
else
{