Fixes bug with where nether or end worlds with non-standard names

https://github.com/BentoBoxWorld/BentoBox/issues/877
This commit is contained in:
tastybento 2019-08-06 16:34:08 -07:00
parent e5986d7a72
commit 0ddae268f7

View File

@ -195,7 +195,7 @@ public class Util {
} }
/** /**
* Checks is world = world2 irrespective of the world type * Checks is world = world2 irrespective of the world type. Only strips _nether and _the_end from world name.
* @param world - world * @param world - world
* @param world2 - world * @param world2 - world
* @return true if the same * @return true if the same
@ -205,14 +205,13 @@ public class Util {
} }
private static String stripName(World world) { private static String stripName(World world) {
switch (world.getEnvironment()) { if (world.getName().endsWith(NETHER)) {
case NETHER:
return world.getName().substring(0, world.getName().length() - NETHER.length()); return world.getName().substring(0, world.getName().length() - NETHER.length());
case THE_END:
return world.getName().substring(0, world.getName().length() - THE_END.length());
default:
return world.getName();
} }
if (world.getName().endsWith(THE_END)) {
return world.getName().substring(0, world.getName().length() - THE_END.length());
}
return world.getName();
} }
/** /**