RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
SuperAntipoisonTask.java
1package com.osroyale.game.task.impl;
2
3import com.osroyale.game.task.Task;
4import com.osroyale.game.world.entity.mob.player.Player;
5import com.osroyale.net.packet.out.SendMessage;
6
28
29public class SuperAntipoisonTask extends Task {
30 private final Player player;
31
32 public SuperAntipoisonTask(Player player) {
33 super(false, 50);
34 this.player = player;
35 }
36
37 @Override
38 public void execute() {
39 if (player.getPoisonImmunity().get() <= 0)
40 this.cancel();
41
42 if (player.getPoisonImmunity().decrementAndGet(50) <= 50)
43 player.send(new SendMessage("Your resistance to poison is about to wear off!"));
44
45 if (player.getPoisonImmunity().get() <= 0)
46 cancel();
47 }
48
49 @Override
50 protected void onCancel(boolean logout) {
51 player.send(new SendMessage("Your resistance to poison has worn off!"));
52 player.getPoisonImmunity().set(0);
53 }
54
55}
synchronized final void cancel()
Definition Task.java:147
Task(boolean instant, int delay)
Definition Task.java:75