Skip to content

Commit

Permalink
remove autochatreportconfirm and fix double autogg (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
MicrocontrollersDev committed Jul 28, 2024
1 parent b41e365 commit 2bea25e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 58 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/polyfrost/hytils/HytilsReborn.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.polyfrost.hytils.handlers.chat.ChatHandler;
import org.polyfrost.hytils.handlers.chat.modules.events.AchievementEvent;
import org.polyfrost.hytils.handlers.chat.modules.events.LevelupEvent;
import org.polyfrost.hytils.handlers.chat.modules.triggers.AutoGG;
import org.polyfrost.hytils.handlers.chat.modules.triggers.AutoQueue;
import org.polyfrost.hytils.handlers.chat.modules.triggers.SilentRemoval;
import org.polyfrost.hytils.handlers.game.dropper.DropperHurtSound;
Expand Down Expand Up @@ -172,6 +173,7 @@ private void registerHandlers() {
eventBus.register(hardcoreStatus);
eventBus.register(new AchievementEvent());
eventBus.register(new LevelupEvent());
EventManager.INSTANCE.register(AutoGG.INSTANCE);

// lobby
eventBus.register(new ArmorStandHider());
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,6 @@ public class HytilsConfig extends Config {
)
public static boolean autoFriend;

@Switch(
name = "Auto Chat Report Confirm",
description = "Automatically confirms chat reports.",
category = "Chat", subcategory = "Automatic"
)
public static boolean autoChatReportConfirm;

@Switch(
name = "Auto Party Warp Confirm",
description = "Automatically confirms party warps.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ public ChatHandler() {
this.registerModule(new WhitePrivateMessages());

// Triggers
this.registerModule(new AutoChatReportConfirm());
this.registerModule(new AutoChatReportConfirm());
this.registerModule(new AutoChatSwapper());
this.registerModule(new AutoFriend());
this.registerModule(new AutoGG());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package org.polyfrost.hytils.handlers.chat.modules.triggers;

import cc.polyfrost.oneconfig.events.event.WorldLoadEvent;
import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
import cc.polyfrost.oneconfig.libs.universal.UChat;
import cc.polyfrost.oneconfig.utils.Multithreading;
import net.minecraft.util.EnumChatFormatting;
Expand All @@ -32,6 +34,9 @@
import java.util.regex.Pattern;

public class AutoGG implements ChatReceiveModule {
public static AutoGG INSTANCE = new AutoGG();
private boolean matchFound = false;

@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText());
Expand All @@ -42,9 +47,10 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
}

private boolean hasGameEnded(String message) {
if (!PatternHandler.INSTANCE.gameEnd.isEmpty()) {
if (!matchFound && !PatternHandler.INSTANCE.gameEnd.isEmpty()) {
for (Pattern triggers : PatternHandler.INSTANCE.gameEnd) {
if (triggers.matcher(message).matches()) {
matchFound = true;
return true;
}
}
Expand All @@ -54,6 +60,11 @@ private boolean hasGameEnded(String message) {
return getLanguage().casualGameEndRegex.matcher(message).matches();
}

@Subscribe
public void onWorldLoad(WorldLoadEvent event) {
matchFound = false;
}

@Override
public boolean isEnabled() {
return HytilsConfig.autoGG && (!HytilsReborn.INSTANCE.isSk1erAutoGG || !club.sk1er.mods.autogg.AutoGG.INSTANCE.getAutoGGConfig().isModEnabled()); // If Sk1er's AutoGG is enabled, we don't want to interfere with it.
Expand Down

0 comments on commit 2bea25e

Please sign in to comment.