fix(rcon): bind offline respect counters correctly

GiveRespect inverted the offline SQL parameters for respects_given and respects_received. Online users received the intended counters, but offline users had the two persisted counters swapped. Bind respect_given to respects_given and respect_received to respects_received, with a contract test to keep the RCON offline path aligned.
This commit is contained in:
simoleo89
2026-06-13 15:24:11 +02:00
parent b94acdf719
commit d8260ec461
2 changed files with 27 additions and 3 deletions
@@ -0,0 +1,24 @@
package com.eu.habbo.messages.rcon;
import org.junit.jupiter.api.Test;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.junit.jupiter.api.Assertions.assertTrue;
class GiveRespectContractTest {
private static String giveRespectSource() throws Exception {
return Files.readString(Path.of("src/main/java/com/eu/habbo/messages/rcon/GiveRespect.java"));
}
@Test
void offlineRespectGrantBindsGivenAndReceivedToMatchingColumns() throws Exception {
String source = giveRespectSource();
assertTrue(source.contains("statement.setInt(1, object.respect_given);"),
"respects_given must be incremented with respect_given");
assertTrue(source.contains("statement.setInt(2, object.respect_received);"),
"respects_received must be incremented with respect_received");
}
}