-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eebbc9c
commit e10b829
Showing
7 changed files
with
250 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/AntiGG.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Hytils Reborn - Hypixel focused Quality of Life mod. | ||
* Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.polyfrost.hytils.handlers.chat.modules.blockers; | ||
|
||
import cc.polyfrost.oneconfig.utils.hypixel.LocrawUtil; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.util.EnumChatFormatting; | ||
import net.minecraftforge.client.event.ClientChatReceivedEvent; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.polyfrost.hytils.config.HytilsConfig; | ||
import org.polyfrost.hytils.handlers.chat.ChatReceiveModule; | ||
|
||
public class AntiGG implements ChatReceiveModule { | ||
@Override | ||
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { | ||
String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText().toLowerCase()); | ||
if ((message.startsWith("-") && message.endsWith("-")) || (message.startsWith("▬") && message.endsWith("▬")) || (message.startsWith("≡") && message.endsWith("≡")) || (!message.contains(": ")) || (message.contains(Minecraft.getMinecraft().getSession().getUsername().toLowerCase())) || (LocrawUtil.INSTANCE.getLocrawInfo() != null && !LocrawUtil.INSTANCE.isInGame())) return; | ||
if (getLanguage().cancelGgMessagesRegex.matcher(message).matches()) { | ||
event.setCanceled(true); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isEnabled() { | ||
return HytilsConfig.antiGG; | ||
} | ||
|
||
@Override | ||
public int getPriority() { | ||
return -3; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/KarmaRemover.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Hytils Reborn - Hypixel focused Quality of Life mod. | ||
* Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.polyfrost.hytils.handlers.chat.modules.blockers; | ||
|
||
import net.minecraft.util.EnumChatFormatting; | ||
import net.minecraftforge.client.event.ClientChatReceivedEvent; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.polyfrost.hytils.config.HytilsConfig; | ||
import org.polyfrost.hytils.handlers.chat.ChatReceiveModule; | ||
|
||
public class KarmaRemover implements ChatReceiveModule { | ||
@Override | ||
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { | ||
String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()); | ||
if (getLanguage().cancelKarmaMessagesRegex.matcher(message).matches()) { | ||
event.setCanceled(true); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isEnabled() { | ||
return HytilsConfig.hideKarmaMessages; | ||
} | ||
|
||
@Override | ||
public int getPriority() { | ||
return -1; | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Hytils Reborn - Hypixel focused Quality of Life mod. | ||
* Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.polyfrost.hytils.handlers.chat.modules.triggers; | ||
|
||
import cc.polyfrost.oneconfig.libs.universal.UChat; | ||
import cc.polyfrost.oneconfig.utils.Multithreading; | ||
import net.minecraft.util.EnumChatFormatting; | ||
import net.minecraftforge.client.event.ClientChatReceivedEvent; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.polyfrost.hytils.config.HytilsConfig; | ||
import org.polyfrost.hytils.handlers.cache.PatternHandler; | ||
import org.polyfrost.hytils.handlers.chat.ChatReceiveModule; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
import java.util.regex.Pattern; | ||
|
||
public class AutoGG implements ChatReceiveModule { | ||
private static final String[] ggMessagesOne = {"gg", "GG", "gf", "Good Game", "Good Fight", "Good Round! :D"}; | ||
private static final String[] ggMessagesTwo = {"Have a good day!", "<3", "AutoGG By Hytils!", "gf", "Good Fight", "Good Round", ":D", "Well played!", "wp"}; | ||
|
||
private static String getGGMessageOne() { | ||
return ggMessagesOne[HytilsConfig.autoGGMessage]; | ||
} | ||
private static String getGGMessageTwo() { | ||
return ggMessagesTwo[HytilsConfig.autoGGMessage2]; | ||
} | ||
|
||
@Override | ||
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { | ||
String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()).trim(); | ||
if (!hasGameEnded(message)) return; | ||
Multithreading.schedule(() -> UChat.say("/ac " + getGGMessageOne()), HytilsConfig.autoGGFirstPhraseDelay, TimeUnit.SECONDS); | ||
if (HytilsConfig.autoGGSecondMessage) | ||
Multithreading.schedule(() -> UChat.say("/ac " + getGGMessageTwo()), HytilsConfig.autoGGSecondPhraseDelay, TimeUnit.SECONDS); | ||
} | ||
|
||
private boolean hasGameEnded(String message) { | ||
if (!PatternHandler.INSTANCE.gameEnd.isEmpty()) { | ||
for (Pattern triggers : PatternHandler.INSTANCE.gameEnd) { | ||
if (triggers.matcher(message).matches()) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isEnabled() { | ||
return HytilsConfig.autoGG; | ||
} | ||
|
||
@Override | ||
public int getPriority() { | ||
return 3; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters