mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-11 17:10:21 -07:00
Converted Seamen plugin to listener
This commit is contained in:
parent
b6fa73d94c
commit
f1e2083506
2 changed files with 15 additions and 31 deletions
|
|
@ -0,0 +1,15 @@
|
||||||
|
package content.region.asgarnia.portsarim.handlers
|
||||||
|
|
||||||
|
import core.game.interaction.IntType
|
||||||
|
import core.game.interaction.InteractionListener
|
||||||
|
import core.game.node.entity.npc.NPC
|
||||||
|
|
||||||
|
class SeamanListener : InteractionListener {
|
||||||
|
override fun defineListeners() {
|
||||||
|
on(IntType.NPC, "pay-fare") { player, node ->
|
||||||
|
val npc = node as NPC
|
||||||
|
player.dialogueInterpreter.open(npc.id, npc, true)
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
package content.region.asgarnia.portsarim.handlers;
|
|
||||||
|
|
||||||
import core.cache.def.impl.NPCDefinition;
|
|
||||||
import core.game.interaction.OptionHandler;
|
|
||||||
import core.game.node.Node;
|
|
||||||
import core.game.node.entity.npc.NPC;
|
|
||||||
import core.game.node.entity.player.Player;
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a plugin used to handle the pay fare option.
|
|
||||||
* @author 'Vexia
|
|
||||||
*/
|
|
||||||
@Initializable
|
|
||||||
public class SeamanPlugin extends OptionHandler {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
|
||||||
NPCDefinition.setOptionHandler("pay-fare", this);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(Player player, Node node, String option) {
|
|
||||||
final NPC npc = ((NPC) node);
|
|
||||||
player.getDialogueInterpreter().open(npc.getId(), npc, true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue