diff --git a/src/main/java/world/bentobox/bentobox/managers/PlayersManager.java b/src/main/java/world/bentobox/bentobox/managers/PlayersManager.java index 0137c8ee5..3b5ab228f 100644 --- a/src/main/java/world/bentobox/bentobox/managers/PlayersManager.java +++ b/src/main/java/world/bentobox/bentobox/managers/PlayersManager.java @@ -158,7 +158,7 @@ public class PlayersManager { return ""; } return names.loadObjects().stream().filter(n -> n.getUuid().equals(playerUUID)).findFirst() - .map(Names::getUniqueId).orElse(null); + .map(Names::getUniqueId).orElse(""); } /** diff --git a/src/test/java/world/bentobox/bentobox/managers/PlayersManagerTest.java b/src/test/java/world/bentobox/bentobox/managers/PlayersManagerTest.java index 8037ad671..105264fed 100644 --- a/src/test/java/world/bentobox/bentobox/managers/PlayersManagerTest.java +++ b/src/test/java/world/bentobox/bentobox/managers/PlayersManagerTest.java @@ -389,6 +389,7 @@ public class PlayersManagerTest { assertTrue(pm.getName(null).isEmpty()); String name = pm.getName(uuid); assertEquals("tastybento", name); + assertEquals("", pm.getName(UUID.randomUUID())); } /**