Converted Warriors Guild shot put hand dusting to kotlin
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
package content.global.handlers.item;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to dust your hands.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class DustHandPlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ItemDefinition.forId(8865).getHandlers().put("option:dust-hands", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
switch (option) {
|
||||
case "dust-hands":
|
||||
if (player.getInventory().remove((Item) node)) {
|
||||
player.getPacketDispatch().sendMessage("You dust your hands with the finely ground ash.");
|
||||
player.setAttribute("hand_dust", true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWalk() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package content.region.asgarnia.burthorpe.handlers.wguild.shot
|
||||
|
||||
import core.api.MapArea
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.node.item.Item
|
||||
import core.game.world.map.Location
|
||||
import org.rs09.consts.Items
|
||||
|
||||
/** For ShotPutRoom */
|
||||
class DustHandListeners : InteractionListener {
|
||||
override fun defineListeners() {
|
||||
on(Items.GROUND_ASHES_8865, IntType.ITEM, "dust-hands") { player, node ->
|
||||
// Check that player is in the shotput throwing areas.
|
||||
if (!(player.location.withinDistance(Location(2861, 3553, 1), 1) ||
|
||||
player.location.withinDistance(Location(2861, 3547, 1), 1))) {
|
||||
player.packetDispatch.sendMessage("You may only dust your hands while in the shotput throwing areas.")
|
||||
return@on true
|
||||
}
|
||||
if (player.inventory.remove(node as Item)) {
|
||||
player.packetDispatch.sendMessage("You dust your hands with the finely ground ash.")
|
||||
player.setAttribute("hand_dust", true)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user