3636import java .util .ArrayList ;
3737import java .util .Arrays ;
3838import java .util .Collection ;
39+ import java .util .Collections ;
3940import java .util .HashMap ;
4041import java .util .HashSet ;
4142import java .util .Iterator ;
@@ -746,8 +747,7 @@ public void updateProfile(ProfileData profile, Player player) {
746747 @ Override
747748 public boolean updatePlayer (Player player , ProfileData profile ) {
748749 List <String > advancements = profile .get (ADVANCEMENTS );
749- Set <String > processedCriteria = new HashSet <>();
750- Set <String > completedCriteria = (advancements != null ) ? new HashSet <>(advancements ) : new HashSet <>();
750+ Set <String > completedCriteria = (advancements != null ) ? new HashSet <>(advancements ) : Collections .emptySet ();
751751
752752 // Advancements may cause the player to level up, which we don't want to happen
753753 int totalExperience = player .getTotalExperience ();
@@ -761,17 +761,13 @@ public boolean updatePlayer(Player player, ProfileData profile) {
761761 Bukkit .advancementIterator ().forEachRemaining (advancement -> {
762762 AdvancementProgress advancementProgress = player .getAdvancementProgress (advancement );
763763 for (String criteria : advancement .getCriteria ()) {
764- if (processedCriteria .contains (criteria )) {
765- continue ;
766- } else if (completedCriteria .contains (criteria )) {
764+ if (completedCriteria .contains (criteria )) {
767765 advancementProgress .awardCriteria (criteria );
768766 } else {
769767 advancementProgress .revokeCriteria (criteria );
770768 }
771- processedCriteria .add (criteria );
772769 }
773770 });
774-
775771 // Set back the level from before applying the advancements
776772 player .setExp (exp );
777773 player .setLevel (level );
0 commit comments