Search in sources :

Example 1 with JoinMinigameEvent

use of cc.hyperium.event.network.server.hypixel.JoinMinigameEvent in project Hyperium by HyperiumClient.

the class MinigameListener method onTick.

@InvokeEvent
public void onTick(TickEvent event) {
    if (Minecraft.getMinecraft().theWorld != null && Hyperium.INSTANCE.getHandlers().getHypixelDetector().isHypixel() && Minecraft.getMinecraft().theWorld.getScoreboard() != null) {
        if (cooldown <= 0) {
            cooldown = 3 * 20;
            String minigameName = getScoreboardTitle();
            Arrays.stream(Minigame.values()).filter(m -> minigameName.equalsIgnoreCase(m.scoreName) && !minigameName.equalsIgnoreCase(currentMinigameName)).forEach(m -> {
                currentMinigameName = minigameName;
                EventBus.INSTANCE.post(new JoinMinigameEvent(m));
            });
        } else {
            cooldown--;
        }
    }
}
Also used : InvokeEvent(cc.hyperium.event.InvokeEvent) Arrays(java.util.Arrays) JoinMinigameEvent(cc.hyperium.event.network.server.hypixel.JoinMinigameEvent) Minecraft(net.minecraft.client.Minecraft) EventBus(cc.hyperium.event.EventBus) ChatColor(cc.hyperium.utils.ChatColor) TickEvent(cc.hyperium.event.client.TickEvent) Hyperium(cc.hyperium.Hyperium) JoinMinigameEvent(cc.hyperium.event.network.server.hypixel.JoinMinigameEvent) InvokeEvent(cc.hyperium.event.InvokeEvent)

Aggregations

Hyperium (cc.hyperium.Hyperium)1 EventBus (cc.hyperium.event.EventBus)1 InvokeEvent (cc.hyperium.event.InvokeEvent)1 TickEvent (cc.hyperium.event.client.TickEvent)1 JoinMinigameEvent (cc.hyperium.event.network.server.hypixel.JoinMinigameEvent)1 ChatColor (cc.hyperium.utils.ChatColor)1 Arrays (java.util.Arrays)1 Minecraft (net.minecraft.client.Minecraft)1