RuneHive-Game
Loading...
Searching...
No Matches
Package NpcEvent

Functions

override fun handle (player:Player)
val npc return handleNpc (player, npc) } fun handleNpc(player

Variables

val slot

Function Documentation

◆ handle()

override fun NpcEvent.handle ( player:Player )

Definition at line 19 of file ItemOnNpcEvent.kt.

19 : Player) {
20 val used = player.inventory[slot] ?: return
21 if (!used.matchesId(itemId)) return
22
23 val npc = World.getNpcBySlot(index).getOrNull() ?: return
24 if (!npc.isValid) return
25
26 val position = npc.position
27 val region = World.getRegions().getRegion(position)
28 if (!region.containsNpc(position.height, npc)) return
29
30 player.walkTo(npc) {
31 player.face(position)
32 if (!PluginManager.getDataBus().publish(player, ItemOnNpcEvent(npc, used, slot))) {
33 player.send(SendMessage("Nothing interesting happens."))
34 }
35 }
36 }

◆ handleNpc()

val npc return NpcEvent.handleNpc ( player ,
npc  )

Definition at line 27 of file NpcClickEvent.kt.

30 : Player, npc: Npc) {}

Variable Documentation

◆ slot

val NpcEvent.slot

Definition at line 14 of file NpcClickEvent.kt.