Skip to content

Commit

Permalink
Add method AchievementTestHelper.getById
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed May 16, 2024
1 parent 411a25f commit 7ba7e74
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions tests/utilities/AchievementTestHelper.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright © 2020-2023 - Arianne *
* Copyright © 2020-2024 - Arianne *
***************************************************************************
***************************************************************************
* *
Expand Down Expand Up @@ -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
* <code>true</code> 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;
}

Expand Down

0 comments on commit 7ba7e74

Please sign in to comment.