v0.7.2b: Allowed external classes to grab more badge-related info

This commit is contained in:
Evan Debenham 2019-04-02 20:09:25 -04:00
parent f7405c0a31
commit f8cd63a74a

View File

@ -179,9 +179,6 @@ public class Badges {
private static final HashSet<String> removedBadges = new HashSet<>(); private static final HashSet<String> removedBadges = new HashSet<>();
static{ static{
//removed in 0.6.1
removedBadges.add("NIGHT_HUNTER");
//removed in 0.6.5 //removed in 0.6.5
removedBadges.addAll(Arrays.asList("RARE_ALBINO", "RARE_BANDIT", "RARE_SHIELDED", removedBadges.addAll(Arrays.asList("RARE_ALBINO", "RARE_BANDIT", "RARE_SHIELDED",
"RARE_SENIOR", "RARE_ACIDIC", "RARE", "TUTORIAL_WARRIOR", "TUTORIAL_MAGE")); "RARE_SENIOR", "RARE_ACIDIC", "RARE", "TUTORIAL_WARRIOR", "TUTORIAL_MAGE"));
@ -193,8 +190,8 @@ public class Badges {
renamedBadges.put("CHAMPION", "CHAMPION_1"); renamedBadges.put("CHAMPION", "CHAMPION_1");
} }
private static HashSet<Badge> restore( Bundle bundle ) { public static HashSet<Badge> restore( Bundle bundle ) {
HashSet<Badge> badges = new HashSet<Badge>(); HashSet<Badge> badges = new HashSet<>();
if (bundle == null) return badges; if (bundle == null) return badges;
String[] names = bundle.getStringArray( BADGES ); String[] names = bundle.getStringArray( BADGES );
@ -214,7 +211,7 @@ public class Badges {
return badges; return badges;
} }
private static void store( Bundle bundle, HashSet<Badge> badges ) { public static void store( Bundle bundle, HashSet<Badge> badges ) {
int count = 0; int count = 0;
String names[] = new String[badges.size()]; String names[] = new String[badges.size()];
@ -841,6 +838,11 @@ public class Badges {
return global.contains( badge ); return global.contains( badge );
} }
public static HashSet<Badge> allUnlocked(){
loadGlobal();
return new HashSet<>(global);
}
public static void disown( Badge badge ) { public static void disown( Badge badge ) {
loadGlobal(); loadGlobal();
global.remove( badge ); global.remove( badge );