From 0ddae268f765c3d00e16ab196ae05e64ad1e8b4f Mon Sep 17 00:00:00 2001 From: tastybento Date: Tue, 6 Aug 2019 16:34:08 -0700 Subject: [PATCH] Fixes bug with where nether or end worlds with non-standard names https://github.com/BentoBoxWorld/BentoBox/issues/877 --- .../java/world/bentobox/bentobox/util/Util.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/util/Util.java b/src/main/java/world/bentobox/bentobox/util/Util.java index 83e1d7a2d..e9f2bc099 100644 --- a/src/main/java/world/bentobox/bentobox/util/Util.java +++ b/src/main/java/world/bentobox/bentobox/util/Util.java @@ -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 world2 - world * @return true if the same @@ -205,14 +205,13 @@ public class Util { } private static String stripName(World world) { - switch (world.getEnvironment()) { - case NETHER: + if (world.getName().endsWith(NETHER)) { 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(); } /**