From 5586d4588c8d106a3b080bb45ba74b3c81113162 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 28 Apr 2022 20:24:38 -0400 Subject: Add F7 phases to custom music --- .../me/Danker/commands/CustomMusicCommand.java | 26 +++- src/main/java/me/Danker/features/CustomMusic.java | 132 +++++++++++++-------- .../java/me/Danker/handlers/ConfigHandler.java | 4 + 3 files changed, 111 insertions(+), 51 deletions(-) (limited to 'src/main/java/me/Danker') diff --git a/src/main/java/me/Danker/commands/CustomMusicCommand.java b/src/main/java/me/Danker/commands/CustomMusicCommand.java index f0634fc..621a6f0 100644 --- a/src/main/java/me/Danker/commands/CustomMusicCommand.java +++ b/src/main/java/me/Danker/commands/CustomMusicCommand.java @@ -21,7 +21,7 @@ public class CustomMusicCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [dungeonboss/bloodroom/dungeon/hub/island/dungeonhub/farmingislands/" + + return "/" + getCommandName() + " [dungeonboss/bloodroom/dungeon/p2/p3/p4/p5/hub/island/dungeonhub/farmingislands/" + "goldmine/deepcaverns/dwarvenmines/crystalhollows/spidersden/crimsonisle/end/park] [1-100]"; } @@ -90,6 +90,30 @@ public class CustomMusicCommand extends CommandBase { CustomMusic.dungeonVolume = volume; ConfigHandler.writeIntConfig("music", "DungeonVolume", volume); break; + case "p2": + if (!CustomMusic.phase2.setVolume(volume)) return; + + CustomMusic.phase2Volume = volume; + ConfigHandler.writeIntConfig("music", "Phase2Volume", volume); + break; + case "p3": + if (!CustomMusic.phase3.setVolume(volume)) return; + + CustomMusic.phase3Volume = volume; + ConfigHandler.writeIntConfig("music", "Phase3Volume", volume); + break; + case "p4": + if (!CustomMusic.phase4.setVolume(volume)) return; + + CustomMusic.phase4Volume = volume; + ConfigHandler.writeIntConfig("music", "Phase4Volume", volume); + break; + case "p5": + if (!CustomMusic.phase5.setVolume(volume)) return; + + CustomMusic.phase5Volume = volume; + ConfigHandler.writeIntConfig("music", "Phase5Volume", volume); + break; case "hub": if (!CustomMusic.hub.setVolume(volume)) return; diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index a31e40a..3ea8d1f 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -27,12 +27,21 @@ import java.util.Random; public class CustomMusic { static boolean cancelNotes; + public static Song dungeonboss; public static int dungeonbossVolume; public static Song bloodroom; public static int bloodroomVolume; public static Song dungeon; public static int dungeonVolume; + public static Song phase2; + public static int phase2Volume; + public static Song phase3; + public static int phase3Volume; + public static Song phase4; + public static int phase4Volume; + public static Song phase5; + public static int phase5Volume; public static Song hub; public static int hubVolume; public static Song island; @@ -79,56 +88,56 @@ public class CustomMusic { String firstLine = ScoreboardHandler.cleanSB(scoreboard.get(scoreboard.size() - 1)); String secondLine = ScoreboardHandler.cleanSB(scoreboard.get(scoreboard.size() - 2)); if (firstLine.contains("30,30") || // F1 - firstLine.contains("30,125") || // F2 - firstLine.contains("30,225") || // F3 - secondLine.contains("- Healthy") || // F3 - firstLine.contains("30,344") || // F4 - firstLine.contains("livid") || // F5 - firstLine.contains("sadan") || // F6 - firstLine.contains("necron")) { // F7 - - if (ToggleCommand.dungeonBossMusic) dungeonboss.start(); - } - } - } else { - switch (Utils.tabLocation) { - case "Hub": - if (ToggleCommand.hubMusic) hub.start(); - break; - case "Private Island": - if (ToggleCommand.islandMusic) island.start(); - break; - case "Dungeon Hub": - if (ToggleCommand.dungeonHubMusic) dungeonHub.start(); - break; - case "The Farming Islands": - if (ToggleCommand.farmingIslandsMusic) farmingIslands.start(); - break; - case "Gold Mine": - if (ToggleCommand.goldMineMusic) goldMine.start(); - break; - case "Deep Caverns": - if (ToggleCommand.deepCavernsMusic) deepCaverns.start(); - break; - case "Dwarven Mines": - if (ToggleCommand.dwarvenMinesMusic) dwarvenMines.start(); - break; - case "Crystal Hollows": - if (ToggleCommand.crystalHollowsMusic) crystalHollows.start(); - break; - case "Spider's Den": - if (ToggleCommand.spidersDenMusic) spidersDen.start(); - break; - case "Crimson Isle": - if (ToggleCommand.crimsonIsleMusic) crimsonIsle.start(); - break; - case "The End": - if (ToggleCommand.endMusic) end.start(); - break; - case "The Park": - if (ToggleCommand.parkMusic) park.start(); - break; + firstLine.contains("30,125") || // F2 + firstLine.contains("30,225") || // F3 + secondLine.contains("- Healthy") || // F3 + firstLine.contains("30,344") || // F4 + firstLine.contains("livid") || // F5 + firstLine.contains("sadan") || // F6 + firstLine.contains("maxor")) { // F7 + + if (ToggleCommand.dungeonBossMusic) dungeonboss.start(); } + } + } else { + switch (Utils.tabLocation) { + case "Hub": + if (ToggleCommand.hubMusic) hub.start(); + break; + case "Private Island": + if (ToggleCommand.islandMusic) island.start(); + break; + case "Dungeon Hub": + if (ToggleCommand.dungeonHubMusic) dungeonHub.start(); + break; + case "The Farming Islands": + if (ToggleCommand.farmingIslandsMusic) farmingIslands.start(); + break; + case "Gold Mine": + if (ToggleCommand.goldMineMusic) goldMine.start(); + break; + case "Deep Caverns": + if (ToggleCommand.deepCavernsMusic) deepCaverns.start(); + break; + case "Dwarven Mines": + if (ToggleCommand.dwarvenMinesMusic) dwarvenMines.start(); + break; + case "Crystal Hollows": + if (ToggleCommand.crystalHollowsMusic) crystalHollows.start(); + break; + case "Spider's Den": + if (ToggleCommand.spidersDenMusic) spidersDen.start(); + break; + case "Crimson Isle": + if (ToggleCommand.crimsonIsleMusic) crimsonIsle.start(); + break; + case "The End": + if (ToggleCommand.endMusic) end.start(); + break; + case "The Park": + if (ToggleCommand.parkMusic) park.start(); + break; + } } } } @@ -147,10 +156,26 @@ public class CustomMusic { if (message.contains(":")) return; if (Utils.inDungeons) { + if (ToggleCommand.dungeonBossMusic) { + if (message.startsWith("[BOSS] Storm: Pathetic Maxor")) { + phase2.start(); + } else if (message.startsWith("[BOSS] Goldor: Who dares trespass into my domain?")) { + phase3.start(); + } else if (message.startsWith("[BOSS] Necron: You went further than any human before")) { + phase4.start(); + } else if (message.startsWith("[BOSS] ") && message.endsWith("You.. again?")) { + phase5.start(); + } + } + if (message.contains("EXTRA STATS ")) { dungeonboss.stop(); bloodroom.stop(); dungeon.stop(); + phase2.stop(); + phase3.stop(); + phase4.stop(); + phase5.stop(); } else if (message.contains("The BLOOD DOOR has been opened!")) { dungeon.stop(); if (ToggleCommand.bloodRoomMusic) bloodroom.start(); @@ -175,6 +200,10 @@ public class CustomMusic { dungeonboss = new Song(directory, "dungeonboss", dungeonbossVolume); bloodroom = new Song(directory, "bloodroom", bloodroomVolume); dungeon = new Song(directory, "dungeon", dungeonVolume); + phase2 = new Song(directory, "phasetwo", phase2Volume); + phase3 = new Song(directory, "phasethree", phase3Volume); + phase4 = new Song(directory, "phasefour", phase4Volume); + phase5 = new Song(directory, "phasefive", phase5Volume); hub = new Song(directory, "hub", hubVolume); island = new Song(directory, "island", hubVolume); dungeonHub = new Song(directory, "dungeonhub", dungeonHubVolume); @@ -193,6 +222,10 @@ public class CustomMusic { if (dungeonboss != null) dungeonboss.stop(); if (bloodroom != null) bloodroom.stop(); if (dungeon != null) dungeon.stop(); + if (phase2 != null) phase2.stop(); + if (phase3 != null) phase3.stop(); + if (phase4 != null) phase4.stop(); + if (phase5 != null) phase5.stop(); if (hub != null) hub.stop(); if (island != null) island.stop(); if (dungeonHub != null) dungeonHub.stop(); @@ -230,7 +263,6 @@ public class CustomMusic { public void start() throws UnsupportedAudioFileException, LineUnavailableException, IOException { try { - if (music == null) music = AudioSystem.getClip(); if (!music.isRunning()) { reset(); shuffle(); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index a35a2d4..65e5c78 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -296,6 +296,10 @@ public class ConfigHandler { CustomMusic.dungeonbossVolume = initInt("music", "DungeonBossVolume", 50); CustomMusic.bloodroomVolume = initInt("music", "BloodRoomVolume", 50); CustomMusic.dungeonVolume = initInt("music", "DungeonVolume", 50); + CustomMusic.phase2Volume = initInt("music", "Phase2Volume", 50); + CustomMusic.phase3Volume = initInt("music", "Phase3Volume", 50); + CustomMusic.phase4Volume = initInt("music", "Phase4Volume", 50); + CustomMusic.phase5Volume = initInt("music", "Phase5Volume", 50); CustomMusic.hubVolume = initInt("music", "HubVolume", 50); CustomMusic.islandVolume = initInt("music", "IslandVolume", 50); CustomMusic.dungeonHubVolume = initInt("music", "DungeonHubVolume", 50); -- cgit