Skip to content

Commit

Permalink
Add lobbysounds migration + fix autogg migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest committed Jun 20, 2024
1 parent c3ba647 commit caf08e8
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 18 deletions.
58 changes: 58 additions & 0 deletions src/dummy/java/club/sk1er/lobbysounds/config/Sounds.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* 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 club.sk1er.lobbysounds.config;

public class Sounds {

public static boolean DISABLE_SLIME_SOUNDS;

public static boolean DISABLE_DRAGON_SOUNDS;

public static boolean DISABLE_WITHER_SOUNDS;

public static boolean DISABLE_ITEM_PICKUP_SOUNDS;

public static boolean DISABLE_EXPERIENCE_SOUNDS;

public static boolean DISABLE_TNT_PRIME_SOUNDS;

public static boolean DISABLE_EXPLOSION_SOUNDS;

public static boolean DISABLE_DELIVERY_MAN_SOUNDS;

public static boolean DISABLE_NOTE_SOUNDS;

public static boolean DISABLE_FIREWORKS_SOUNDS;

public static boolean DISABLE_LEVELUP_SOUNDS;

public static boolean DISABLE_STEP_SOUNDS;

public static boolean DISABLE_ARROW_SOUNDS;

public static boolean DISABLE_BAT_SOUNDS;

public static boolean DISABLE_FIRE_SOUNDS;

public static boolean DISABLE_ENDERMEN_SOUNDS;

public void markDirty() {}

public void writeData() {}
}
17 changes: 10 additions & 7 deletions src/dummy/java/club/sk1er/mods/autogg/config/AutoGGConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@

public class AutoGGConfig {

// these arent the actual default values
private boolean autoGGEnabled = true;
private boolean casualAutoGGEnabled = true;
private boolean antiGGEnabled = true;
private boolean antiKarmaEnabled = true;
private int autoGGDelay = 5;
private boolean casualAutoGGEnabled;
private boolean antiGGEnabled;
private boolean antiKarmaEnabled;
private int autoGGDelay = 1;
private int autoGGPhrase = 0;
private boolean secondaryEnabled = true;
private boolean secondaryEnabled;
private int autoGGPhrase2 = 0;
private int secondaryDelay = 5;
private int secondaryDelay = 1;

public boolean isModEnabled() {
return autoGGEnabled;
Expand Down Expand Up @@ -66,4 +65,8 @@ public int getAutoGGPhrase2() {
public int getSecondaryDelay() {
return secondaryDelay;
}

public void markDirty() {}

public void writeData() {}
}
141 changes: 130 additions & 11 deletions src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.polyfrost.hytils.config;

import cc.polyfrost.oneconfig.config.Config;
import cc.polyfrost.oneconfig.config.annotations.Checkbox;
import cc.polyfrost.oneconfig.config.annotations.*;
import cc.polyfrost.oneconfig.config.core.OneColor;
import cc.polyfrost.oneconfig.config.data.InfoType;
Expand All @@ -27,13 +28,14 @@
import cc.polyfrost.oneconfig.config.data.PageLocation;
import cc.polyfrost.oneconfig.config.migration.VigilanceMigrator;
import cc.polyfrost.oneconfig.utils.Notifications;
import club.sk1er.lobbysounds.config.Sounds;
import club.sk1er.mods.autogg.AutoGG;
import org.polyfrost.hytils.HytilsReborn;
import org.polyfrost.hytils.handlers.chat.modules.modifiers.GameStartCompactor;
import org.polyfrost.hytils.util.DarkColorUtils;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import org.apache.commons.io.FileUtils;
import org.polyfrost.hytils.HytilsReborn;
import org.polyfrost.hytils.handlers.chat.modules.modifiers.GameStartCompactor;
import org.polyfrost.hytils.util.DarkColorUtils;

import java.awt.Color;
import java.io.File;
Expand Down Expand Up @@ -1254,23 +1256,140 @@ public HytilsConfig() {

HytilsReborn.INSTANCE.isSk1erAutoGG = true;

autoGG = AutoGG.INSTANCE.getAutoGGConfig().isModEnabled();
autoGGSecondMessage = AutoGG.INSTANCE.getAutoGGConfig().isSecondaryEnabled();
casualAutoGG = AutoGG.INSTANCE.getAutoGGConfig().isCasualAutoGGEnabled();
autoGGMessage = AutoGG.INSTANCE.getAutoGGConfig().getAutoGGPhrase();
autoGGFirstPhraseDelay = AutoGG.INSTANCE.getAutoGGConfig().getAutoGGDelay();
autoGGMessage2 = AutoGG.INSTANCE.getAutoGGConfig().getAutoGGPhrase2();
autoGGSecondPhraseDelay = AutoGG.INSTANCE.getAutoGGConfig().getSecondaryDelay();
if (AutoGG.INSTANCE.getAutoGGConfig().isModEnabled()) {
autoGG = true;
}
if (AutoGG.INSTANCE.getAutoGGConfig().isSecondaryEnabled()) {
autoGGSecondMessage = true;
}
if (AutoGG.INSTANCE.getAutoGGConfig().isCasualAutoGGEnabled()) {
casualAutoGG = true;
}
if (AutoGG.INSTANCE.getAutoGGConfig().getAutoGGPhrase() != 0) {
autoGGMessage = AutoGG.INSTANCE.getAutoGGConfig().getAutoGGPhrase();
}
if (AutoGG.INSTANCE.getAutoGGConfig().getAutoGGDelay() != 1) {
autoGGFirstPhraseDelay = AutoGG.INSTANCE.getAutoGGConfig().getAutoGGDelay();
}
if (AutoGG.INSTANCE.getAutoGGConfig().getAutoGGPhrase2() != 0) {
autoGGMessage2 = AutoGG.INSTANCE.getAutoGGConfig().getAutoGGPhrase2();
}
if (AutoGG.INSTANCE.getAutoGGConfig().getSecondaryDelay() != 1) {
autoGGSecondPhraseDelay = AutoGG.INSTANCE.getAutoGGConfig().getSecondaryDelay();
}
if (AutoGG.INSTANCE.getAutoGGConfig().isAntiGGEnabled()) {
antiGG = true;
}
if (AutoGG.INSTANCE.getAutoGGConfig().isAntiKarmaEnabled()) {
hideKarmaMessages = true;
}

try {
Field sk1erEnabled = clazz.getDeclaredField("autoGGEnabled");
sk1erEnabled.setAccessible(true);
sk1erEnabled.set(AutoGG.INSTANCE.getAutoGGConfig(), false);

AutoGG.INSTANCE.getAutoGGConfig().markDirty();
AutoGG.INSTANCE.getAutoGGConfig().writeData();
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}

Notifications.INSTANCE.send("Hytils Reborn", "AutoGG settings have been migrated to Hytils Reborn. You can now configure them in the Hytils Reborn settings.", 5);
Notifications.INSTANCE.send("Hytils Reborn", "AutoGG settings have been migrated to Hytils Reborn. You can now configure them in the Hytils Reborn settings, and remove Sk1erLLC's AutoGG.", 5);
} catch (ClassNotFoundException ignored) {

}
try {
Class.forName("club.sk1er.lobbysounds.config.Sounds");
boolean modified = false;
if (Sounds.DISABLE_SLIME_SOUNDS) {
lobbyDisableSlimeSounds = true;
modified = true;
}
if (Sounds.DISABLE_DRAGON_SOUNDS) {
lobbyDisableDragonSounds = true;
modified = true;
}
if (Sounds.DISABLE_WITHER_SOUNDS) {
lobbyDisableWitherSounds = true;
modified = true;
}
if (Sounds.DISABLE_ITEM_PICKUP_SOUNDS) {
lobbyDisableItemPickupSounds = true;
modified = true;
}
if (Sounds.DISABLE_EXPERIENCE_SOUNDS) {
lobbyDisableExperienceOrbSounds = true;
modified = true;
}
if (Sounds.DISABLE_TNT_PRIME_SOUNDS) {
lobbyDisablePrimedTntSounds = true;
modified = true;
}
if (Sounds.DISABLE_EXPLOSION_SOUNDS) {
lobbyDisableExplosionSounds = true;
modified = true;
}
if (Sounds.DISABLE_DELIVERY_MAN_SOUNDS) {
lobbyDisableDeliveryManSounds = true;
modified = true;
}
if (Sounds.DISABLE_NOTE_SOUNDS) {
lobbyDisableNoteBlockSounds = true;
modified = true;
}
if (Sounds.DISABLE_FIREWORKS_SOUNDS) {
lobbyDisableFireworkSounds = true;
modified = true;
}
if (Sounds.DISABLE_LEVELUP_SOUNDS) {
lobbyDisableLevelupSounds = true;
modified = true;
}
if (Sounds.DISABLE_ARROW_SOUNDS) {
lobbyDisableArrowSounds = true;
modified = true;
}
if (Sounds.DISABLE_BAT_SOUNDS) {
lobbyDisableBatSounds = true;
modified = true;
}
if (Sounds.DISABLE_FIRE_SOUNDS) {
lobbyDisableFireSounds = true;
modified = true;
}
if (Sounds.DISABLE_ENDERMEN_SOUNDS) {
lobbyDisableEndermanSounds = true;
modified = true;
}
if (Sounds.DISABLE_STEP_SOUNDS) {
lobbyDisableSteppingSounds = true;
modified = true;
}

if (Sounds.DISABLE_SLIME_SOUNDS &&
Sounds.DISABLE_DRAGON_SOUNDS &&
Sounds.DISABLE_WITHER_SOUNDS &&
Sounds.DISABLE_ITEM_PICKUP_SOUNDS &&
Sounds.DISABLE_EXPERIENCE_SOUNDS &&
Sounds.DISABLE_TNT_PRIME_SOUNDS &&
Sounds.DISABLE_EXPLOSION_SOUNDS &&
Sounds.DISABLE_DELIVERY_MAN_SOUNDS &&
Sounds.DISABLE_NOTE_SOUNDS &&
Sounds.DISABLE_FIREWORKS_SOUNDS &&
Sounds.DISABLE_LEVELUP_SOUNDS &&
Sounds.DISABLE_ARROW_SOUNDS &&
Sounds.DISABLE_BAT_SOUNDS &&
Sounds.DISABLE_FIRE_SOUNDS &&
Sounds.DISABLE_ENDERMEN_SOUNDS &&
Sounds.DISABLE_STEP_SOUNDS) {
silentLobby = true;
lobbyDisableDoorSounds = true;
}

if (modified) {
Notifications.INSTANCE.send("Hytils Reborn", "Lobby Sounds settings have been migrated to Hytils Reborn. You can now configure them in the Hytils Reborn settings, and remove Sk1erLLC's Lobby Sounds.", 5);
}
} catch (ClassNotFoundException ignored) {

}
Expand Down

0 comments on commit caf08e8

Please sign in to comment.