RuneHive-Game
Loading...
Searching...
No Matches
CeillingCollapseTask.java
Go to the documentation of this file.
1package com.runehive.game.task.impl;
2
3import com.runehive.game.task.TickableTask;
4import com.runehive.game.world.entity.combat.hit.Hit;
5import com.runehive.game.world.entity.mob.player.Player;
6import com.runehive.game.world.position.Area;
7import com.runehive.net.packet.out.SendCameraReset;
8import com.runehive.net.packet.out.SendCameraShake;
9import com.runehive.util.Utility;
10
11public class CeillingCollapseTask extends TickableTask {
12 private final Player player;
13
15 super(false, 6);
16 this.player = player;
17 }
18
19 @Override
20 protected void onSchedule() {
21 player.send(new SendCameraShake(3, 2, 3, 2));
22 }
23
24 @Override
25 protected void onCancel(boolean logout) {
26 player.send(new SendCameraReset());
27 }
28
29 @Override
30 protected void tick() {
32 cancel();
33 return;
34 }
35 player.graphic(60);
36 player.speak("Ouch!");
37 player.damage(new Hit(Utility.random(5, 8)));
38 player.message("Some rocks fall from the ceiling and hit you.");
39 }
40}
synchronized final void cancel()
Cancels all subsequent executions.
Definition Task.java:113
TickableTask(boolean instant, int delay)
void onSchedule()
A function executed on registration.
void onCancel(boolean logout)
A function executed on cancellation.
A Hit object holds the damage amount and hitsplat data.
Definition Hit.java:10
This class represents a character controlled by a player.
Definition Player.java:125
Handles checking if mobs are in a certain area.
Definition Area.java:13
static boolean inBarrowsChamber(Interactable entity)
Definition Area.java:179
The OutgoingPacket resets the camera position for Player.
Handles miscellaneous methods.
Definition Utility.java:27
static int random(int bound)
Definition Utility.java:239