RuneHive-Game
Loading...
Searching...
No Matches
LobbyNode.java
Go to the documentation of this file.
1package com.runehive.content.activity.lobby;
2
3import com.runehive.content.activity.Activity;
4import com.runehive.content.activity.GroupActivity;
5import com.runehive.game.world.entity.mob.player.Player;
6
7public abstract class LobbyNode extends GroupActivity {
8 protected final LobbyManager manager;
9 boolean lobby;
10
12 super(manager.getLobbyCooldown(), manager.getPlayerCapacity());
13 this.manager = manager;
14 }
15
16 @Override
17 protected final void start() {
18 if (manager.canStart(this)) {
19 super.start();
20 onStart();
21 lobby = false;
22 cooldown(manager.getGameCooldown());
23 }
24 }
25
26 protected void onStart() {
27 /* do nothing by default */
28 }
29
30 protected abstract Activity createActivity(Player player);
31
32 protected boolean finished() {
33 return getTicks() == FINISH || getActiveSize() == 0;
34 }
35
36 protected boolean contains(Player player) {
37 return activities.containsKey(player);
38 }
39
40 public boolean inLobby() {
41 return lobby;
42 }
43
44}
A Activity object constructs an in-game activity and sequences it through the start() and finish() me...
Definition Activity.java:31
final int cooldown
The sequencing cooldown.
Definition Activity.java:43
static final int FINISH
The 'finish' cooldown id.
Definition Activity.java:37
int getTicks()
Gets the current ticks.
final Map< Mob, Activity > activities
A map of activities that handles each mob individually.
int getActiveSize()
Gets the size of the activities in this group.
GroupActivity(int cooldown, int capacity)
Constructs a new GroupActivity object.
abstract Activity createActivity(Player player)
final void start()
Starts the next activity stage.
This class represents a character controlled by a player.
Definition Player.java:125