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

Feature: Custom user sounds for Inquisitor waypoint sharing #3160

Open
wants to merge 6 commits into
base: beta
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import at.hannibal2.skyhanni.config.FeatureToggle;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.Accordion;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorKeybind;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
Expand Down Expand Up @@ -30,6 +31,11 @@ public class InquisitorSharingConfig {
@ConfigEditorKeybind(defaultKey = Keyboard.KEY_Y)
public int keyBindShare = Keyboard.KEY_Y;

@Expose
@ConfigOption(name = "Inquisitor Sound", desc = "")
@Accordion
public InquisitorSoundConfig sound = new InquisitorSoundConfig();

@Expose
@ConfigOption(name = "Show Despawn Time", desc = "Show the time until the shared Inquisitor will despawn.")
@ConfigEditorBoolean
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package at.hannibal2.skyhanni.config.features.event.diana;

import at.hannibal2.skyhanni.events.diana.InquisitorFoundEvent;
import at.hannibal2.skyhanni.features.event.diana.InquisitorWaypointShare;
import at.hannibal2.skyhanni.features.garden.farming.lane.FarmingLaneFeatures;
import at.hannibal2.skyhanni.utils.OSUtils;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorButton;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorText;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;

public class InquisitorSoundConfig {
@Expose
@ConfigOption(name = "Notification Sound", desc = "The sound played when an Inquisitor is found.")
@ConfigEditorText
public String name = "random.orb";

@Expose
@ConfigOption(name = "Pitch", desc = "The pitch of the sound.")
@ConfigEditorSlider(minValue = 0.5f, maxValue = 2.0f, minStep = 0.1f)
public float pitch = 1.0f;

@ConfigOption(name = "Test Sound", desc = "Test current sound settings.")
@ConfigEditorButton(buttonText = "Test")
public Runnable testSound = InquisitorWaypointShare::playUserSound;

@ConfigOption(name = "List of Sounds", desc = "A list of available sounds.")
@ConfigEditorButton(buttonText = "Open")
public Runnable listOfSounds = () -> OSUtils.openBrowser("https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/mapping-and-modding-tutorials/2213619-1-8-all-playsound-sound-arguments");
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.SoundUtils.playSound
import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName
import at.hannibal2.skyhanni.utils.StringUtils.stripHypixelMessage
import at.hannibal2.skyhanni.utils.getLorenzVec
Expand Down Expand Up @@ -299,7 +300,7 @@ object InquisitorWaypointShare {
ChatUtils.chat("$displayName §l§efound an inquisitor at §l§c${x.toInt()} ${y.toInt()} ${z.toInt()}!")
if (name != LorenzUtils.getPlayerName()) {
LorenzUtils.sendTitle("§dINQUISITOR §efrom §b$displayName", 5.seconds)
SoundUtils.playBeepSound()
playUserSound()
}
}
val inquis = SharedInquisitor(name, displayName, location, SimpleTimeMark.now())
Expand All @@ -317,4 +318,11 @@ object InquisitorWaypointShare {
ChatUtils.chat("Inquisitor from ${inquis.displayName} §enot found, deleting.")
}
}

@JvmStatic
fun playUserSound() {
with(config.sound) {
SoundUtils.createSound(name, pitch).playSound()
}
}
}
Loading