diff --git a/tests/utilities/AchievementTestHelper.java b/tests/utilities/AchievementTestHelper.java index ec393f94379..1fc5acc25ee 100644 --- a/tests/utilities/AchievementTestHelper.java +++ b/tests/utilities/AchievementTestHelper.java @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright © 2020-2023 - Arianne * + * Copyright © 2020-2024 - Arianne * *************************************************************************** *************************************************************************** * * @@ -67,19 +67,35 @@ public static void init(final Player player) { } /** - * Checks if an achievement is enabled. + * Retrieves an achievement. * * @param id - * Achievement string identifier. + * Achievement string identifier. * @return - * true if achievement is loaded & enabled. + * `games.stendhal.server.core.rp.achievement.Achievement` instance or `null`. */ - public static boolean achievementEnabled(final String id) { + public static Achievement getById(final String id) { for (final Achievement ac: an.getAchievements()) { if (id.equals(ac.getIdentifier())) { - return ac.isActive(); + return ac; } } + return null; + } + + /** + * Checks if an achievement is enabled. + * + * @param id + * Achievement string identifier. + * @return + * `true` if achievement is loaded & enabled. + */ + public static boolean achievementEnabled(final String id) { + final Achievement ac = AchievementTestHelper.getById(id); + if (ac != null) { + return ac.isActive(); + } return false; }