RuneHive-Game
Loading...
Searching...
No Matches
DuelNotificationTask.java
Go to the documentation of this file.
1package com.runehive.game.task.impl;
2
3import com.runehive.game.task.Task;
4import com.runehive.game.world.entity.mob.player.Player;
5import com.runehive.game.world.entity.mob.player.exchange.ExchangeSession;
6import com.runehive.game.world.entity.mob.player.exchange.ExchangeSessionType;
7import com.runehive.net.packet.out.SendConfig;
8
9public class DuelNotificationTask extends Task {
10
11 private final Player player;
12 private int time = 20;
13
15 super(true, 0);
16 this.player = player;
17 }
18
19 @Override
20 public void execute() {
22 cancel();
23 return;
24 }
25
26 if (time <= 0) {
27 cancel();
28 return;
29 }
30
31 time--;
32
33 if (time % 2 == 0) {
34 player.send(new SendConfig(655, 1));
35 } else {
36 player.send(new SendConfig(655, 0));
37 }
38
39 }
40
41 @Override
42 protected void onCancel(boolean logout) {
43 player.send(new SendConfig(655, 0));
44 }
45
46}
synchronized final void cancel()
Cancels all subsequent executions.
Definition Task.java:113
Task(boolean instant, int delay)
Creates a new Task.
Definition Task.java:41
void execute()
A function representing the unit of work that will be carried out.
void onCancel(boolean logout)
A function executed on cancellation.
This class represents a character controlled by a player.
Definition Player.java:125
static boolean inSession(Player player, Player other, ExchangeSessionType type)
Determines if the player is a session with other which matches the type.
The OutgoingPacket responsible for changing settings on a client.