From fedc19c726394a9c6800494a9402768ccf50cb7f Mon Sep 17 00:00:00 2001 From: Snaiker Date: Wed, 13 Apr 2022 05:45:02 +0100 Subject: [PATCH] Fix Achievements Badge --- .../habbohotel/achievements/AchievementManager.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java index 9de60de5..725ab2a1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java @@ -146,12 +146,17 @@ public class AchievementManager { } } + String newBadgCode = "ACH_" + achievement.name + newLevel.level; + + if (habbo.getInventory().getBadgesComponent().hasBadge(newBadgCode)) + return; + if (badge != null) { - badge.setCode("ACH_" + achievement.name + newLevel.level); + badge.setCode(newBadgCode); badge.needsInsert(false); badge.needsUpdate(true); } else { - badge = new HabboBadge(0, "ACH_" + achievement.name + newLevel.level, 0, habbo); + badge = new HabboBadge(0, newBadgCode, 0, habbo); habbo.getClient().sendResponse(new AddUserBadgeComposer(badge)); badge.needsInsert(true); badge.needsUpdate(true); @@ -359,6 +364,9 @@ public class AchievementManager { if (level.badges != null && level.badges.length > 0) { for (String badge : level.badges) { if (!badge.isEmpty()) { + if (habbo.getInventory().getBadgesComponent().hasBadge(badge)) + continue; + HabboBadge b = new HabboBadge(0, badge, 0, habbo); Emulator.getThreading().run(b); habbo.getInventory().getBadgesComponent().addBadge(b);