24 : Player) {
25 val used = player.inventory[
slot] ?:
return
26 if (!used.matchesId(itemId)) return
27
28 val position = Position(x, y, player.height)
29
30 var id = objectId
31
32 for (playerBirdHouseData in player.birdHouseData) {
33 if (playerBirdHouseData.birdhousePosition == position) {
34 id = playerBirdHouseData.oldObjectId
35 break
36 }
37 }
38
39 val region = World.getRegions().getRegion(position)
40 val obj = region.getGameObject(id, position) ?: return
41
42 player.walkTo(obj) {
43 if (interfaceType == InterfaceConstants.INVENTORY_INTERFACE) {
44 player.face(obj)
45 if (EventDispatcher.execute(player, ItemOnObjectInteractionEvent(used, obj))) return@walkTo
46 if (!PluginManager.getDataBus().publish(player, ItemOnObjectEvent(used,
slot, obj))) {
47 player.send(SendMessage("Nothing interesting happens."))
48 }
49 }
50 }
51 }