Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove autochatreportconfirm and fix double autogg #104

Merged
merged 2 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading