You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 15:06:19 +00:00
Merge pull request #266 from simoleo89/fix/room-items-picked-owner
fix(room-items): restore picked item owner
This commit is contained in:
@@ -877,7 +877,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
Habbo habbo = (picker != null && picker.getHabboInfo().getId() == item.getId() ? picker
|
||||
Habbo habbo = (picker != null && picker.getHabboInfo().getId() == item.getUserId() ? picker
|
||||
: Emulator.getGameServer().getGameClientManager().getHabbo(item.getUserId()));
|
||||
if (!trackedBuildersClubItem && habbo != null) {
|
||||
habbo.getInventory().getItemsComponent().addItem(item);
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.eu.habbo.habbohotel.rooms;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class RoomPickupOwnershipContractTest {
|
||||
@Test
|
||||
void pickupReturnsItemToPickerWhenPickerOwnsTheItem() throws Exception {
|
||||
String source = Files.readString(Path.of("src/main/java/com/eu/habbo/habbohotel/rooms/Room.java"));
|
||||
|
||||
assertTrue(source.contains("picker.getHabboInfo().getId() == item.getUserId()"),
|
||||
"Room.pickUpItem should compare the picker id against the item owner id");
|
||||
assertFalse(source.contains("picker.getHabboInfo().getId() == item.getId()"),
|
||||
"Room.pickUpItem must not compare user ids against furniture item ids");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user