From 09abab1b5db73c6031d4d1adf566f742847a6cca Mon Sep 17 00:00:00 2001 From: GJ Date: Fri, 3 May 2013 07:48:50 -0400 Subject: [PATCH] Kraken sounds can now be set to either player-only or global (default). --- .../java/com/gmail/nossr50/config/AdvancedConfig.java | 1 + .../gmail/nossr50/runnables/skills/KrakenAttackTask.java | 9 +++++++++ .../com/gmail/nossr50/skills/fishing/FishingManager.java | 8 +++++++- src/main/resources/advanced.yml | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 5da688e66..c49c9a86b 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -283,6 +283,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { /* KRAKEN STUFF */ public boolean getKrakenEnabled() { return config.getBoolean("Kraken.Enabled", true); } + public boolean getKrakenGlobalSoundsEnabled() { return config.getBoolean("Kraken.Global_Sounds", true); } public int getKrakenTriesBeforeRelease() { return config.getInt("Kraken.Tries_Before_Release", 50); } public int getKrakenHealth() { return config.getInt("Kraken.Health", 50); } public String getKrakenName() { return config.getString("Kraken.Name", "The Kraken"); } diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java index 7b3876991..ac536ffa9 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java @@ -13,6 +13,7 @@ import com.gmail.nossr50.util.Misc; public class KrakenAttackTask extends BukkitRunnable { private Squid kraken; private Player player; + private final boolean GLOBAL_SOUNDS = AdvancedConfig.getInstance().getKrakenGlobalSoundsEnabled(); public KrakenAttackTask(Squid kraken, Player player) { this.kraken = kraken; @@ -31,6 +32,14 @@ public class KrakenAttackTask extends BukkitRunnable { kraken.teleport(player); player.damage(AdvancedConfig.getInstance().getKrakenAttackDamage(), kraken); + + if (GLOBAL_SOUNDS) { + world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); + } + else { + player.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); + } + world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); world.strikeLightningEffect(location); } diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index c7d4d68b4..5dae3b3a0 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -91,7 +91,13 @@ public class FishingManager extends SkillManager { world.strikeLightningEffect(location); world.strikeLightningEffect(location); player.sendMessage(AdvancedConfig.getInstance().getPlayerUnleashMessage()); - world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); + + if (AdvancedConfig.getInstance().getKrakenGlobalSoundsEnabled()) { + world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); + } + else { + player.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); + } String globalMessage = AdvancedConfig.getInstance().getServerUnleashMessage(); diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index ca3d88906..b1bd44981 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -422,6 +422,7 @@ Kraken: Name: The Kraken Attack_Interval_Seconds: 1 Attack_Damage: 1 + Global_Sounds: true Unleashed_Message: Server: (PLAYER) has unleashed the kraken! Player: THE KRAKEN HAS BEEN UNLEASHED! \ No newline at end of file