🆙 Fix in habbomanager

The getCloneAccounts query had an operator-precedence bug:

WHERE ip_register = ? OR ip_current = ? AND id != ?
-- parsed as:
WHERE ip_register = ? OR (ip_current = ? AND id != ?)

So a user whose ip_register matched themselves would show up in their own clone list. Added parentheses:

WHERE (ip_register = ? OR ip_current = ?) AND id != ?

So please run the 006_HabboManager_fix before you run the update Emulator !
This commit is contained in:
duckietm
2026-04-07 09:20:15 +02:00
parent 65c777dbc8
commit 5e586d1093
2 changed files with 36 additions and 1 deletions
@@ -198,7 +198,7 @@ public class HabboManager {
public ArrayList<HabboInfo> getCloneAccounts(Habbo habbo, int limit) {
ArrayList<HabboInfo> habboInfo = new ArrayList<>();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM users WHERE ip_register = ? OR ip_current = ? AND id != ? ORDER BY id DESC LIMIT ?")) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM users WHERE (ip_register = ? OR ip_current = ?) AND id != ? ORDER BY id DESC LIMIT ?")) {
statement.setString(1, habbo.getHabboInfo().getIpRegister());
statement.setString(2, habbo.getHabboInfo().getIpLogin());
statement.setInt(3, habbo.getHabboInfo().getId());