RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
TeleblockTask.java
1package com.osroyale.game.task.impl;
2
3import com.osroyale.game.task.Task;
4import com.osroyale.net.packet.out.SendMessage;
5import com.osroyale.net.packet.out.SendWidget;
6import com.osroyale.game.world.entity.mob.player.Player;
7
35
36public class TeleblockTask extends Task {
37
38 private final Player player;
39
40 public TeleblockTask(Player player) {
41 super(false, 0);
42 this.player = player;
43 }
44
45 @Override
46 protected void execute() {
47 if (player == null || !player.isValid()) {
48 cancel();
49 return;
50 }
51
52 if (player.teleblockTimer.decrementAndGet() <= 0) {
53 cancel();
54 }
55 }
56
57 @Override
58 protected void onCancel(boolean logout) {
59 player.send(new SendWidget(SendWidget.WidgetType.TELEBLOCK, 0));
60 player.send(new SendMessage("You feel the effects of the tele-block spell go away."));
61 }
62
63}
synchronized final void cancel()
Definition Task.java:147
Task(boolean instant, int delay)
Definition Task.java:75