Skip to content

Commit

Permalink
misc: removed mystery box features and added ticket machine message r…
Browse files Browse the repository at this point in the history
…emover
  • Loading branch information
xthe-dev committed Dec 17, 2023
1 parent 64dfaa9 commit e624f48
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 137 deletions.
2 changes: 0 additions & 2 deletions src/main/java/org/polyfrost/hytils/HytilsReborn.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import org.polyfrost.hytils.handlers.lobby.limbo.LimboLimiter;
import org.polyfrost.hytils.handlers.lobby.limbo.LimboPmDing;
import org.polyfrost.hytils.handlers.lobby.limbo.LimboTitle;
import org.polyfrost.hytils.handlers.lobby.mysterybox.MysteryBoxStar;
import org.polyfrost.hytils.handlers.lobby.npc.NPCHandler;
import org.polyfrost.hytils.handlers.lobby.sound.SilentLobby;
import org.polyfrost.hytils.handlers.render.ChestHighlighter;
Expand Down Expand Up @@ -182,7 +181,6 @@ private void registerHandlers() {
eventBus.register(new LimboLimiter());
eventBus.register(new LimboTitle());
eventBus.register(new LimboPmDing());
eventBus.register(new MysteryBoxStar());
eventBus.register(new SilentLobby());

// specific games
Expand Down
13 changes: 3 additions & 10 deletions src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ public class HytilsConfig extends Config {
public static boolean lobbyStatus;

@Switch(
name = "Remove Mystery Box Rewards",
description = "Remove mystery box messages from chat and only show your own.\n§eExample: §b[MVP§c+§b] Steve §ffound a §6Legendary Hype Train Gadget§f!",
name = "Remove Ticket Machine Rewards",
description = "Remove ticket machine messages from chat and only show your own.\n§eExample: Steve has found a COMMON Figurine",
category = "Chat", subcategory = "Toggles"
)
public static boolean mysteryBoxAnnouncer;
public static boolean ticketMachineAnnouncer;

@Switch(
name = "Remove Soul Well Announcements",
Expand Down Expand Up @@ -1001,13 +1001,6 @@ public class HytilsConfig extends Config {
)
public static boolean lobbyBossbar = true;

@Switch(
name = "Mystery Box Star",
description = "Shows what star a mystery box is in the Mystery Box Vault, Orange stars are special boxes.",
category = "Lobby", subcategory = "GUI"
)
public static boolean mysteryBoxStar = true;

@Switch(
name = "Silent Lobby",
description = "Prevent all sounds from playing when you are in a lobby.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public ChatHandler() {
this.registerModule(new LobbyFishingAnnouncementRemover());
this.registerModule(new LobbyStatusRemover());
this.registerModule(new MvpEmotesRemover());
this.registerModule(new MysteryBoxRemover());
this.registerModule(new NonCooldownBlocker());
this.registerModule(new OnlineStatusRemover());
this.registerModule(new QuestBlocker());
Expand All @@ -79,6 +78,7 @@ public ChatHandler() {
this.registerModule(new SkyblockWelcomeRemover());
this.registerModule(new SoulWellAnnouncerRemover());
this.registerModule(new StatsMessageRemover());
this.registerModule(new TicketMachineRemover());
this.registerModule(new TipMessageRemover());

// Events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,28 @@

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

import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawUtil;
import org.polyfrost.hytils.config.HytilsConfig;
import org.polyfrost.hytils.handlers.chat.ChatReceiveModule;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import org.jetbrains.annotations.NotNull;

public class MysteryBoxRemover implements ChatReceiveModule {
public class TicketMachineRemover implements ChatReceiveModule {
@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
LocrawInfo locrawInformation = getLocraw();
String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText());
if (getLanguage().chatCleanerMysteryBoxFindRegex.matcher(message).matches()) {
if (locrawInformation != null && locrawInformation.getGameType() == LocrawInfo.GameType.BEDWARS && !LocrawUtil.INSTANCE.isInGame()
&& getLanguage().chatCleanerTicketAnnouncerRegex.matcher(message).matches()) {
event.setCanceled(true);
}
}

@Override
public boolean isEnabled() {
return HytilsConfig.mysteryBoxAnnouncer;
return HytilsConfig.ticketMachineAnnouncer;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class LanguageData {
private String autoFriendPattern = "Friend request from (?<name>.+)\\[ACCEPT] - \\[DENY] - \\[IGNORE].*";

private String chatCleanerJoin = "(?:sled into|slid into|joined|spooked into) the lobby";
private String chatCleanerMysteryBoxFind = "^.+ (?<player>(?!You )\\w{1,16} )found (?:a|an) (?:.{5} Mystery Box!|.+ in a .+!)$";
private String chatCleanerTicketAnnouncer = "^(?<player>(?!You )\\w{1,16} )has found an? .+$";
private String chatCleanerSoulWellFind = "^.+ has found .+ in the Soul Well!$";
private String chatCleanerGameAnnouncement = "^\u27a4 A .+ game is (?:available to join|starting in .+ seconds)! CLICK HERE to join!$";
private String chatCleanerBedwarsPartyAdvertisement = "(?!.+: )(([1-8]/[1-8]|[1-8]v[1-8]|[2-8]s)|(any|rbw|ranked))";
Expand Down Expand Up @@ -116,7 +116,7 @@ public class LanguageData {
public Pattern autoFriendPatternRegex;

public Pattern chatCleanerJoinRegex;
public Pattern chatCleanerMysteryBoxFindRegex;
public Pattern chatCleanerTicketAnnouncerRegex;
public Pattern chatCleanerSoulWellFindRegex;
public Pattern chatCleanerGameAnnouncementRegex;
public Pattern chatCleanerBedwarsPartyAdvertisementRegex;
Expand Down Expand Up @@ -178,7 +178,7 @@ public void initialize() {
autoFriendPatternRegex = Pattern.compile(autoFriendPattern);

chatCleanerJoinRegex = Pattern.compile(chatCleanerJoin);
chatCleanerMysteryBoxFindRegex = Pattern.compile(chatCleanerMysteryBoxFind);
chatCleanerTicketAnnouncerRegex = Pattern.compile(chatCleanerTicketAnnouncer);
chatCleanerSoulWellFindRegex = Pattern.compile(chatCleanerSoulWellFind);
chatCleanerGameAnnouncementRegex = Pattern.compile(chatCleanerGameAnnouncement);
chatCleanerBedwarsPartyAdvertisementRegex = Pattern.compile(chatCleanerBedwarsPartyAdvertisement);
Expand Down

This file was deleted.

0 comments on commit e624f48

Please sign in to comment.