Search in sources :

Example 21 with InvokeEvent

use of cc.hyperium.event.InvokeEvent in project Hyperium by HyperiumClient.

the class ParticleAuraHandler method loadPurchaseEvent.

@InvokeEvent
public void loadPurchaseEvent(PurchaseLoadEvent purchaseLoadEvent) {
    HyperiumPurchase purchase = purchaseLoadEvent.getPurchase();
    auras.remove(purchase.getPlayerUUID());
    JsonHolder purchaseSettings = purchase.getPurchaseSettings();
    if (!purchaseSettings.has("particle"))
        return;
    JsonHolder data = purchaseSettings.optJSONObject("particle");
    String particle_animation1 = data.optString("particle_animation");
    AbstractAnimation particle_animation = animations.get(particle_animation1);
    EnumParticleType type = EnumParticleType.parse(data.optString("type"));
    if (particle_animation == null || type == null)
        return;
    if (!purchase.hasPurchased("PARTICLE_" + type.name()) || !purchase.hasPurchased("ANIMATION_" + (particle_animation1.toUpperCase().replace(" ", "_")))) {
        return;
    }
    boolean rgb = data.optBoolean("rgb");
    boolean chroma = data.optBoolean("chroma");
    ParticleAura max_age = new ParticleAura(renderEngines.get(type), particle_animation, data.optInt("max_age", 2), chroma, rgb);
    max_age.setRgb(data.optInt("red"), data.optInt("green"), data.optInt("blue"));
    auras.put(purchase.getPlayerUUID(), max_age);
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) HyperiumPurchase(cc.hyperium.purchases.HyperiumPurchase) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 22 with InvokeEvent

use of cc.hyperium.event.InvokeEvent in project Hyperium by HyperiumClient.

the class VanillaEnhancementsHud method onRenderArmor.

@InvokeEvent
public void onRenderArmor(GuiDrawScreenEvent e) {
    if ((Settings.ARMOR_PROT_POTENTIONAL || Settings.ARMOR_PROJ_POTENTIONAL) && (e.getScreen() instanceof GuiInventory || e.getScreen() instanceof GuiContainerCreative)) {
        ScaledResolution res = new ScaledResolution(mc);
        String message = getArmorString();
        mc.currentScreen.drawString(mc.fontRendererObj, message, 10, res.getScaledHeight() - 16, -1);
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) GuiInventory(net.minecraft.client.gui.inventory.GuiInventory) GuiContainerCreative(net.minecraft.client.gui.inventory.GuiContainerCreative) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 23 with InvokeEvent

use of cc.hyperium.event.InvokeEvent in project Hyperium by HyperiumClient.

the class EventClientConnection method playerLoggedOut.

@InvokeEvent
public void playerLoggedOut(ServerLeaveEvent event) {
    TaskManager taskManager = autotip.getTaskManager();
    SessionManager manager = autotip.getSessionManager();
    manager.setOnHypixel(false);
    taskManager.executeTask(TaskType.LOGOUT, manager::logout);
    resetHeader();
}
Also used : TaskManager(me.semx11.autotip.core.TaskManager) SessionManager(me.semx11.autotip.core.SessionManager) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 24 with InvokeEvent

use of cc.hyperium.event.InvokeEvent in project Hyperium by HyperiumClient.

the class HypixelFriendsGui method onRemove.

@InvokeEvent
public void onRemove(FriendRemoveEvent event) {
    JsonHolder friends = null;
    try {
        friends = Hyperium.INSTANCE.getHandlers().getDataHandler().getFriendsForCurrentUser().get().getData();
    } catch (InterruptedException | ExecutionException e) {
        e.printStackTrace();
    }
    String key = null;
    for (Map.Entry<String, JsonElement> stringJsonElementEntry : friends.getObject().entrySet()) {
        if (!(stringJsonElementEntry.getValue() instanceof JsonObject))
            continue;
        String display = stringJsonElementEntry.getValue().getAsJsonObject().get("display").getAsString();
        if (EnumChatFormatting.getTextWithoutFormattingCodes(display).contains(event.getFullName()))
            key = stringJsonElementEntry.getKey();
    }
    if (key != null) {
        friends.remove(key);
    }
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject) ExecutionException(java.util.concurrent.ExecutionException) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 25 with InvokeEvent

use of cc.hyperium.event.InvokeEvent in project Hyperium by HyperiumClient.

the class BroadcastEvents method checkForEvents.

// Raw: "a>>   Achievement Unlocked: Rambo   <<a"
@InvokeEvent
public void checkForEvents(ServerChatEvent event) {
    String raw = EnumChatFormatting.getTextWithoutFormattingCodes(event.getChat().getUnformattedText());
    Matcher achMatcher = ACHIEVEMENT_PATTERN.matcher(raw);
    if (achMatcher.matches()) {
        String ach = achMatcher.group("achievement");
        // Check to stop spamming of gchat if achievement is broken and you get it many times.
        if (!achievementsGotten.contains(ach)) {
            EventBus.INSTANCE.post(new AchievementGetEvent(ach));
            achievementsGotten.add(ach);
        }
    }
}
Also used : Matcher(java.util.regex.Matcher) AchievementGetEvent(cc.hyperium.event.network.server.hypixel.AchievementGetEvent) InvokeEvent(cc.hyperium.event.InvokeEvent)

Aggregations

InvokeEvent (cc.hyperium.event.InvokeEvent)44 HyperiumPurchase (cc.hyperium.purchases.HyperiumPurchase)7 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)6 UUID (java.util.UUID)4 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)4 ScaledResolution (net.minecraft.client.gui.ScaledResolution)4 RenderManager (net.minecraft.client.renderer.entity.RenderManager)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 IMixinModelBiped (cc.hyperium.mixinsimp.client.model.IMixinModelBiped)3 ChatComponentText (net.minecraft.util.ChatComponentText)3 EventBus (cc.hyperium.event.EventBus)2 AutoGG (cc.hyperium.mods.autogg.AutoGG)2 ChatColor (cc.hyperium.utils.ChatColor)2 IOException (java.io.IOException)2 Field (java.lang.reflect.Field)2 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 Map (java.util.Map)2 Matcher (java.util.regex.Matcher)2 Minecraft (net.minecraft.client.Minecraft)2