blob: 934261437cceec881968bd38e313149f8eaf48fc (
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
61
62
|
package de.hysky.skyblocker.events;
import de.hysky.skyblocker.utils.Location;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
@Environment(EnvType.CLIENT)
public final class SkyblockEvents {
public static final Event<SkyblockEvents.SkyblockJoin> JOIN = EventFactory.createArrayBacked(SkyblockEvents.SkyblockJoin.class, callbacks -> () -> {
for (SkyblockEvents.SkyblockJoin callback : callbacks) {
callback.onSkyblockJoin();
}
});
public static final Event<SkyblockEvents.SkyblockLeave> LEAVE = EventFactory.createArrayBacked(SkyblockEvents.SkyblockLeave.class, callbacks -> () -> {
for (SkyblockEvents.SkyblockLeave callback : callbacks) {
callback.onSkyblockLeave();
}
});
public static final Event<SkyblockEvents.SkyblockLocationChange> LOCATION_CHANGE = EventFactory.createArrayBacked(SkyblockEvents.SkyblockLocationChange.class, callbacks -> location -> {
for (SkyblockEvents.SkyblockLocationChange callback : callbacks) {
callback.onSkyblockLocationChange(location);
}
});
/**
* Called when the player's Skyblock profile changes.
* @implNote This is called upon receiving the chat message for the profile change rather than the exact moment of profile change, so it may be delayed by a few seconds.
*/
public static final Event<ProfileChange> PROFILE_CHANGE = EventFactory.createArrayBacked(ProfileChange.class, callbacks -> (prev, profile) -> {
for (ProfileChange callback : callbacks) {
callback.onSkyblockProfileChange(prev, profile);
}
});
@Environment(EnvType.CLIENT)
@FunctionalInterface
public interface SkyblockJoin {
void onSkyblockJoin();
}
@Environment(EnvType.CLIENT)
@FunctionalInterface
public interface SkyblockLeave {
void onSkyblockLeave();
}
@Environment(EnvType.CLIENT)
@FunctionalInterface
public interface SkyblockLocationChange {
void onSkyblockLocationChange(Location location);
}
@Environment(EnvType.CLIENT)
@FunctionalInterface
public interface ProfileChange {
void onSkyblockProfileChange(String prevProfileId, String profileId);
}
}
|