blob: b8448ac35b34bc12a12c7a063a87e90964ce9841 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package de.hysky.skyblocker.events;
import de.hysky.skyblocker.skyblock.dungeon.secrets.Room;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
public class DungeonEvents {
/**
* Called when the player loads into a dungeon after the location is sent to the scoreboard.
*/
public static final Event<DungeonLoaded> DUNGEON_LOADED = EventFactory.createArrayBacked(DungeonLoaded.class, callbacks -> () -> {
for (DungeonLoaded callback : callbacks) {
callback.onDungeonLoaded();
}
});
/**
* Called after the dungeons starts and after the tab has changed to include additional information about the run such as each player's class.
*/
public static final Event<DungeonStarted> DUNGEON_STARTED = EventFactory.createArrayBacked(DungeonStarted.class, callbacks -> () -> {
for (DungeonStarted callback : callbacks) {
callback.onDungeonStarted();
}
});
public static final Event<RoomMatched> PUZZLE_MATCHED = EventFactory.createArrayBacked(RoomMatched.class, callbacks -> room -> {
for (RoomMatched callback : callbacks) {
callback.onRoomMatched(room);
}
});
public static final Event<RoomMatched> ROOM_MATCHED = EventFactory.createArrayBacked(RoomMatched.class, callbacks -> room -> {
for (RoomMatched callback : callbacks) {
callback.onRoomMatched(room);
}
if (room.getType() == Room.Type.PUZZLE) {
PUZZLE_MATCHED.invoker().onRoomMatched(room);
}
});
@Environment(EnvType.CLIENT)
@FunctionalInterface
public interface DungeonLoaded {
void onDungeonLoaded();
}
@Environment(EnvType.CLIENT)
@FunctionalInterface
public interface DungeonStarted {
void onDungeonStarted();
}
@Environment(EnvType.CLIENT)
@FunctionalInterface
public interface RoomMatched {
void onRoomMatched(Room room);
}
}
|