Search in sources :

Example 1 with InvokeEvent

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

the class EventChatReceived method onChat.

@InvokeEvent
public void onChat(ServerChatEvent event) {
    Config config = autotip.getConfig();
    if (!autotip.getSessionManager().isOnHypixel()) {
        return;
    }
    String msg = UniversalUtil.getUnformattedText(event);
    CommandLimbo limboCommand = autotip.getCommand(CommandLimbo.class);
    if (limboCommand.hasExecuted()) {
        if (msg.startsWith("A kick occurred in your connection")) {
            event.setCancelled(true);
        } else if (msg.startsWith("Illegal characters in chat")) {
            event.setCancelled(true);
            limboCommand.setExecuted(false);
        }
    }
    if (!config.isEnabled())
        return;
    GlobalSettings settings = autotip.getGlobalSettings();
    MessageOption option = config.getMessageOption();
    for (Message message : settings.getMessages()) {
        MessageMatcher matcher = message.getMatcherFor(msg);
        if (matcher.matches()) {
            event.setCancelled(message.shouldHide(option));
            return;
        }
    }
    String hover = UniversalUtil.getHoverText(event);
    settings.getStatsMessages().forEach(message -> {
        StatsMessageMatcher matcher = message.getMatcherFor(msg);
        if (!matcher.matches())
            return;
        StatsDaily stats = getStats();
        matcher.applyStats(stats);
        message.applyHoverStats(hover, stats);
        event.setCancelled(message.shouldHide(option));
    });
}
Also used : StatsMessageMatcher(me.semx11.autotip.message.StatsMessageMatcher) MessageMatcher(me.semx11.autotip.message.MessageMatcher) StatsMessageMatcher(me.semx11.autotip.message.StatsMessageMatcher) Message(me.semx11.autotip.message.Message) Config(me.semx11.autotip.config.Config) CommandLimbo(me.semx11.autotip.command.impl.CommandLimbo) MessageOption(me.semx11.autotip.chat.MessageOption) GlobalSettings(me.semx11.autotip.config.GlobalSettings) StatsDaily(me.semx11.autotip.stats.StatsDaily) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 2 with InvokeEvent

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

the class AbstractPostCopyAnglesAnimationHandler method onPostCopyPlayerModelAngles.

@InvokeEvent
public void onPostCopyPlayerModelAngles(PostCopyPlayerModelAnglesEvent event) {
    AbstractClientPlayer entity = event.getEntity();
    IMixinModelBiped player = event.getModel();
    modify(entity, player, false);
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) IMixinModelBiped(cc.hyperium.mixinsimp.client.model.IMixinModelBiped) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 3 with InvokeEvent

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

the class AnimatedDance method onPostCopyPlayerModelAngles.

// Added so we can do legs
@InvokeEvent
public void onPostCopyPlayerModelAngles(PostCopyPlayerModelAnglesEvent event) {
    AbstractClientPlayer entity = event.getEntity();
    IMixinModelBiped player = event.getModel();
    modify(entity, player, false);
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) IMixinModelBiped(cc.hyperium.mixinsimp.client.model.IMixinModelBiped) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 4 with InvokeEvent

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

the class HypixelDetector method serverJoinEvent.

@InvokeEvent
public void serverJoinEvent(ServerJoinEvent event) {
    hypixel = HYPIXEL_PATTERN.matcher(event.getServer()).find();
    Multithreading.runAsync(() -> {
        // Wait a while until the player isn't null, signifying the joining process is complete
        int tries = 0;
        while (Minecraft.getMinecraft().thePlayer == null) {
            tries++;
            if (tries > 20 * 10) {
                return;
            }
            try {
                Thread.sleep(50L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        if (hypixel) {
            // If player is online recognized Hypixel IP
            EventBus.INSTANCE.post(new JoinHypixelEvent(ServerVerificationMethod.IP));
        } else {
            // Double check the player isn't online Hypixel
            if (Minecraft.getMinecraft().getCurrentServerData() != null) {
                ServerData serverData = Minecraft.getMinecraft().getCurrentServerData();
                if (serverData != null && serverData.serverMOTD != null && serverData.serverMOTD.toLowerCase().contains("hypixel network")) {
                    // Check MOTD for Hypixel
                    hypixel = true;
                    EventBus.INSTANCE.post(new JoinHypixelEvent(ServerVerificationMethod.MOTD));
                }
            }
        }
    });
}
Also used : ServerData(net.minecraft.client.multiplayer.ServerData) JoinHypixelEvent(cc.hyperium.event.network.server.hypixel.JoinHypixelEvent) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 5 with InvokeEvent

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

the class HypixelDetector method join.

@InvokeEvent
public void join(JoinHypixelEvent event) {
    if (Settings.HYPIXEL_ZOO) {
        Hyperium.INSTANCE.getNotification().display("Welcome to the Hypixel Zoo.", "Click to visit https://hypixel.net/", 5f, null, () -> {
            try {
                Desktop.getDesktop().browse(new URI("https://hypixel.net/"));
            } catch (IOException | URISyntaxException e) {
                e.printStackTrace();
            }
        }, new Color(200, 150, 50));
        SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
        if (soundHandler == null || Minecraft.getMinecraft().theWorld == null)
            return;
        soundHandler.playSound(PositionedSoundRecord.create(new ResourceLocation("zoo"), (float) Minecraft.getMinecraft().thePlayer.posX, (float) Minecraft.getMinecraft().thePlayer.posY, (float) Minecraft.getMinecraft().thePlayer.posZ));
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) SoundHandler(net.minecraft.client.audio.SoundHandler) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) 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