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

add lobbysounds #90

Merged
merged 2 commits into from
Jun 19, 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
127 changes: 127 additions & 0 deletions src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,125 @@ public class HytilsConfig extends Config {
)
public static boolean silentLobby;

@Switch(
name = "Disable Stepping Sounds",
description = "Remove sounds created by stepping.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableSteppingSounds;

@Switch(
name = "Disable Slime Sounds",
description = "Remove sounds created by slimes.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableSlimeSounds;

@Switch(
name = "Disable Dragon Sounds",
description = "Remove sounds created by dragons.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableDragonSounds;

@Switch(
name = "Disable Wither Sounds",
description = "Remove sounds created by withers & wither skeletons.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableWitherSounds;

@Switch(
name = "Disable Item Pickup Sounds",
description = "Remove sounds created by picking up an item.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableItemPickupSounds;

@Switch(
name = "Disable Experience Orb Sounds",
description = "Remove sounds created by experience orbs.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableExperienceOrbSounds;

@Switch(
name = "Disable Primed TNT Sounds",
description = "Remove sounds created by primed TNT.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisablePrimedTntSounds;

@Switch(
name = "Disable Explosion Sounds",
description = "Remove sounds created by explosions.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableExplosionSounds;

@Switch(
name = "Disable Delivery Man Sounds",
description = "Remove sounds created by delivery man events.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableDeliveryManSounds;

@Switch(
name = "Disable Mystery Box Sounds",
description = "Remove sounds created by mystery boxes.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableMysteryBoxSounds;

@Switch(
name = "Disable Firework Sounds",
description = "Remove sounds created by fireworks.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableFireworkSounds;

@Switch(
name = "Disable Levelup Sounds",
description = "Remove sounds created by someone leveling up.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableLevelupSounds;

@Switch(
name = "Disable Arrow Sounds",
description = "Remove sounds created by arrows.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableArrowSounds;

@Switch(
name = "Disable Bat Sounds",
description = "Remove sounds created by bats.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableBatSounds;

@Switch(
name = "Disable Fire Sounds",
description = "Remove sounds created by fire.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableFireSounds;

@Switch(
name = "Disable Enderman Sounds",
description = "Remove sounds created by endermen.",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableEndermanSounds;

@Switch(
name = "Disable Door Sounds",
description = "Disable sounds caused by doors, trapdoors, and fence gates",
category = "Lobby", subcategory = "Sounds"
)
public static boolean lobbyDisableDoorSounds;

@Switch(
name = "Remove Limbo AFK Title",
description = "Remove the AFK title when you get sent to limbo for being AFK.",
Expand Down Expand Up @@ -1123,6 +1242,14 @@ public HytilsConfig() {
//addDependency("editHeightOverlay", "heightOverlay");
addDependency("manuallyEditHeightOverlay", "heightOverlay");
//addDependency("editHeightOverlay", "manuallyEditHeightOverlay");

Arrays.asList(
"lobbyDisableSteppingSounds", "lobbyDisableSlimeSounds", "lobbyDisableDragonSounds", "lobbyDisableWitherSounds",
"lobbyDisableItemPickupSounds", "lobbyDisableExperienceOrbSounds", "lobbyDisablePrimedTntSounds",
"lobbyDisableExplosionSounds", "lobbyDisableDeliveryManSounds", "lobbyDisableMysteryBoxSounds",
"lobbyDisableFireworkSounds", "lobbyDisableLevelupSounds", "lobbyDisableArrowSounds", "lobbyDisableBatSounds",
"lobbyDisableFireSounds", "lobbyDisableEndermanSounds", "lobbyDisableDoorSounds"
).forEach(property -> addDependency(property, "Silent Lobby", () -> !silentLobby));
}

public void hideTabulous() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,85 @@
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class SilentLobby {

@SubscribeEvent
public void onSoundPlay(PlaySoundEvent event) {
if (HypixelUtils.INSTANCE.isHypixel() && !LocrawUtil.INSTANCE.isInGame() && HytilsConfig.silentLobby) {
if (!event.name.startsWith("gui.")) {
if (HypixelUtils.INSTANCE.isHypixel() && !LocrawUtil.INSTANCE.isInGame()) {
String sound = event.name;
if (HytilsConfig.silentLobby && !sound.startsWith("gui.")) {
event.result = null;
} else {
/*
This code is taken from LobbySounds by Sk1er LLC under the GPL License:
https://github.com/Sk1erLLC/LobbySounds/blob/master/LICENSE
Only changes to adapt to this project have been made, as well as additions.
*/
if (sound.startsWith("step.") && HytilsConfig.lobbyDisableSteppingSounds) {
event.result = null;
}

if (sound.startsWith("mob.slime") && HytilsConfig.lobbyDisableSlimeSounds) {
event.result = null;
}

if (sound.startsWith("mob.enderdragon") && HytilsConfig.lobbyDisableDragonSounds) {
event.result = null;
}

if ((sound.startsWith("mob.wither") || sound.startsWith("mob.skeleton")) && HytilsConfig.lobbyDisableWitherSounds) {
event.result = null;
}

if (sound.equals("random.orb") && HytilsConfig.lobbyDisableExperienceOrbSounds) {
event.result = null;
}

if (sound.equals("random.pop") && HytilsConfig.lobbyDisableItemPickupSounds) {
event.result = null;
}

if (sound.equals("game.tnt.primed") && HytilsConfig.lobbyDisablePrimedTntSounds) {
event.result = null;
}

if (sound.equals("random.explode") && HytilsConfig.lobbyDisableExplosionSounds) {
event.result = null;
}

if (sound.equals("mob.chicken.plop") && HytilsConfig.lobbyDisableDeliveryManSounds) {
event.result = null;
}

if ((sound.startsWith("note.") || sound.equals("random.click")) && HytilsConfig.lobbyDisableMysteryBoxSounds) {
event.result = null;
}

if (sound.startsWith("fireworks") && HytilsConfig.lobbyDisableFireworkSounds) {
event.result = null;
}

if (sound.equals("random.levelup") && HytilsConfig.lobbyDisableLevelupSounds) {
event.result = null;
}

if (sound.startsWith("mob.bat") && HytilsConfig.lobbyDisableBatSounds) {
event.result = null;
}

if (sound.equals("fire.fire") && HytilsConfig.lobbyDisableFireSounds) {
event.result = null;
}

if (sound.startsWith("mob.endermen") && HytilsConfig.lobbyDisableEndermanSounds) {
event.result = null;
}

if (sound.startsWith("random.bow") && HytilsConfig.lobbyDisableArrowSounds) {
event.result = null;
}

if (sound.startsWith("random.door") && HytilsConfig.lobbyDisableDoorSounds) {
event.result = null;
}
}
}
}
Expand Down
Loading