Updated GWDEntranceRopeUsage plugin to listener (Note: this handles only the case where a rope is used directly on the hole; using the tie-rope option is handled by a separate plugin)
This commit is contained in:
@@ -1,35 +0,0 @@
|
|||||||
package core.game.interaction.item.withobject;
|
|
||||||
|
|
||||||
import core.game.interaction.NodeUsageEvent;
|
|
||||||
import core.game.interaction.UseWithHandler;
|
|
||||||
import core.game.node.scenery.Scenery;
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles using a rope on the God wars entrance.
|
|
||||||
* @author Emperor
|
|
||||||
*/
|
|
||||||
@Initializable
|
|
||||||
public final class GWDEntranceRopeUsage extends UseWithHandler {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@code GWDEntranceRopeUsage} {@code Object}.
|
|
||||||
*/
|
|
||||||
public GWDEntranceRopeUsage() {
|
|
||||||
super(954);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
|
||||||
addHandler(26340, OBJECT_TYPE, this);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(NodeUsageEvent event) {
|
|
||||||
Scenery object = (Scenery) event.getUsedWith();
|
|
||||||
return object.getInteraction().get(0).getHandler().handle(event.getPlayer(), object, "tie-rope");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package rs09.game.interaction.item.withobject
|
||||||
|
|
||||||
|
import api.removeItem
|
||||||
|
import api.setVarbit
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
import org.rs09.consts.Scenery
|
||||||
|
import rs09.game.interaction.IntType
|
||||||
|
import rs09.game.interaction.InteractionListener
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener for using a rope directly on the GWD entrance hole
|
||||||
|
* @author Byte
|
||||||
|
*/
|
||||||
|
@Suppress("unused")
|
||||||
|
class GWDEntranceRopeListener : InteractionListener {
|
||||||
|
|
||||||
|
override fun defineListeners() {
|
||||||
|
onUseWith(IntType.SCENERY, Items.ROPE_954, Scenery.HOLE_26340) { player, used, _ ->
|
||||||
|
if (!removeItem(player, used)) {
|
||||||
|
return@onUseWith false
|
||||||
|
}
|
||||||
|
|
||||||
|
setVarbit(player,1048,0,1,true)
|
||||||
|
|
||||||
|
return@onUseWith true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user