RuneHive-Game
Loading...
Searching...
No Matches
JailActivity.java
Go to the documentation of this file.
1package com.runehive.content.activity.impl;
2
3import com.runehive.Config;
4import com.runehive.content.activity.Activity;
5import com.runehive.content.activity.ActivityType;
6import com.runehive.game.world.entity.mob.Mob;
7import com.runehive.game.world.entity.mob.player.Player;
8
9public class JailActivity extends Activity {
10 private final Player player;
11
13 super(30, Mob.DEFAULT_INSTANCE);
14 this.player = player;
15 }
16
20 activity.add(player);
21 activity.resetCooldown();
22 player.setVisible(true);
23 return activity;
24 }
25
26 @Override
27 protected void start() {
28 if (!player.punishment.isJailed()) {
29 finish();
30 }
31 }
32
33 @Override
34 public void onDeath(Mob mob) {
36 player.message("BAM! YOU'RE BACK!");
37 }
38
39 @Override
40 public boolean canTeleport(Player player) {
41 player.message("You are jailed you douche!");
42 return false;
43 }
44
45 @Override
48 }
49
50 @Override
51 public void finish() {
52 remove(player);
54 player.message("Time's up! You are free to go.");
55 }
56
57 @Override
58 public void cleanup() {
59
60 }
61
62 @Override
64 return ActivityType.JAIL;
65 }
66}
The class that contains setting-related constants for the server.
Definition Config.java:24
static final Position DEFAULT_POSITION
The default, i.e.
Definition Config.java:197
static final Position JAIL_ZONE
The Jail zone.
Definition Config.java:207
Activity(int cooldown, int instance)
Constructs a new SequencedMinigame object.
Definition Activity.java:55
void onDeath(Mob mob)
Called when the player die.
boolean canTeleport(Player player)
Called when the player attempts to teleport.
void start()
Starts the next activity stage.
void onRegionChange(Player player)
Called when the player changes region.
void cleanup()
Cleans up the activity when finished.
static JailActivity create(Player player)
Handles the mob class.
Definition Mob.java:66
This class represents a character controlled by a player.
Definition Player.java:125
Holds all activity types that are timed.