From 797b887a9892c0881edeb7ddfa8865be33b04466 Mon Sep 17 00:00:00 2001 From: Snaiker Date: Mon, 21 Mar 2022 18:37:24 +0000 Subject: [PATCH] Fix --- src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java | 3 +++ .../eu/habbo/habbohotel/users/inventory/BadgesComponent.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java index 5903cdc5..18176593 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java @@ -57,6 +57,9 @@ public class HabboBadge implements Runnable { public void run() { try { if (this.needsInsert) { + if (this.habbo.getInventory().getBadgesComponent().hasBadge(this.code)) + return; + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO users_badges (user_id, slot_id, badge_code) VALUES (?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) { statement.setInt(1, this.habbo.getHabboInfo().getId()); statement.setInt(2, this.slot); diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java index 02573ff4..845ba2cb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java @@ -160,7 +160,8 @@ public class BadgesComponent { public void addBadge(HabboBadge badge) { synchronized (this.badges) { - this.badges.add(badge); + if (!this.hasBadge(badge.getCode())) + this.badges.add(badge); } }