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));
});
}
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);
}
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);
}
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));
}
}
}
});
}
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));
}
}
Aggregations