mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 01:50:50 +01:00
Merge branch 'fix-duplicated-badge' into 'dev'
Fix duplicated SQL entry for the badge & checks See merge request morningstar/Arcturus-Community!505
This commit is contained in:
commit
31c63e81ae
@ -57,6 +57,9 @@ public class HabboBadge implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
if (this.needsInsert) {
|
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)) {
|
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(1, this.habbo.getHabboInfo().getId());
|
||||||
statement.setInt(2, this.slot);
|
statement.setInt(2, this.slot);
|
||||||
|
@ -160,7 +160,8 @@ public class BadgesComponent {
|
|||||||
|
|
||||||
public void addBadge(HabboBadge badge) {
|
public void addBadge(HabboBadge badge) {
|
||||||
synchronized (this.badges) {
|
synchronized (this.badges) {
|
||||||
this.badges.add(badge);
|
if (!this.hasBadge(badge.getCode()))
|
||||||
|
this.badges.add(badge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user