mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-22 15:00:52 +01:00
Merge branch 'fix-duplicated-badge' into 'dev'
Fix Achievements Badge See merge request morningstar/Arcturus-Community!541
This commit is contained in:
commit
d8e4fbe2da
@ -146,12 +146,17 @@ public class AchievementManager {
|
||||
}
|
||||
}
|
||||
|
||||
String newBadgCode = "ACH_" + achievement.name + newLevel.level;
|
||||
|
||||
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);
|
||||
if (habbo.getInventory().getBadgesComponent().hasBadge(newBadgCode))
|
||||
return;
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user