Removed old code

This commit is contained in:
Snaiker 2022-04-15 01:19:50 +01:00
parent 6e03fe294e
commit 9dad818fda
2 changed files with 4 additions and 18 deletions

View File

@ -5,6 +5,8 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboBadge;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager;
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
import com.eu.habbo.messages.outgoing.inventory.InventoryBadgesComposer;
import com.eu.habbo.messages.outgoing.users.UserBadgesComposer;
@ -46,7 +48,7 @@ public class TakeBadgeCommand extends Command {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_take_badge"), RoomChatMessageBubbles.ALERT);
BadgesComponent.deleteBadge(username, badge);
BadgesComponent.deleteBadge(habbo != null ? habbo.getHabboInfo().getId() : HabboManager.getOfflineHabboInfo(username).getId(), badge);
}
return true;

View File

@ -46,7 +46,7 @@ public class BadgesComponent {
}
if (delete) {
deleteBadge(habbo.getHabboInfo().getUsername(), badge.getCode());
deleteBadge(habbo.getHabboInfo().getId(), badge.getCode());
continue;
}
}
@ -94,22 +94,6 @@ public class BadgesComponent {
return badge;
}
@Deprecated
public static void deleteBadge(String username, HabboBadge badge) {
deleteBadge(username, badge.getCode());
}
@Deprecated
public static void deleteBadge(String username, String badge) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE users_badges FROM users_badges INNER JOIN users ON users_badges.user_id = users.id WHERE users.username LIKE ? AND badge_code LIKE ?")) {
statement.setString(1, username);
statement.setString(2, badge);
statement.execute();
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
}
}
public static void deleteBadge(int userId, String badge) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE users_badges FROM users_badges WHERE user_id = ? AND badge_code LIKE ?")) {
statement.setInt(1, userId);