浏览代码

We're now using Bukkit sounds instead of Spout sounds - only
current exception is the custom level-up sound.

GJ 12 年之前
父节点
当前提交
ac7ed67d91

+ 1 - 0
Changelog.txt

@@ -37,6 +37,7 @@ Version 1.4.00-dev
  = Fixed a bug where /party kick would trigger the PartyChangeEvent for the wrong player
  = Fixed a bug where party join messages weren't displayed
  = Fixed a bug where Disarm and Deflect had wrong values
+ ! We're now using Bukkit sounds instead of Spout sounds.
  ! It is now possible to use a negative number for Max_Level in treasures.yml to not use a maximum level, changed default file accordingly
  ! A Fishing catch will now always contains a fish even if a treasure is found
  ! Changed how Berserk handles not picking up items to avoid listening to PlayerPickupItemEvent

+ 4 - 7
src/main/java/com/gmail/nossr50/listeners/BlockListener.java

@@ -3,6 +3,7 @@ package com.gmail.nossr50.listeners;
 import java.util.List;
 
 import org.bukkit.Material;
+import org.bukkit.Sound;
 import org.bukkit.block.Block;
 import org.bukkit.block.BlockFace;
 import org.bukkit.enchantments.Enchantment;
@@ -17,7 +18,6 @@ import org.bukkit.event.block.BlockPistonRetractEvent;
 import org.bukkit.event.block.BlockPlaceEvent;
 import org.bukkit.inventory.ItemStack;
 import org.bukkit.metadata.FixedMetadataValue;
-import org.getspout.spoutapi.sound.SoundEffect;
 
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.datatypes.PlayerProfile;
@@ -37,7 +37,6 @@ import com.gmail.nossr50.skills.repair.Repair;
 import com.gmail.nossr50.skills.repair.Salvage;
 import com.gmail.nossr50.skills.smelting.SmeltingManager;
 import com.gmail.nossr50.skills.woodcutting.Woodcutting;
-import com.gmail.nossr50.spout.SpoutSounds;
 import com.gmail.nossr50.util.BlockChecks;
 import com.gmail.nossr50.util.ItemChecks;
 import com.gmail.nossr50.util.Misc;
@@ -293,8 +292,8 @@ public class BlockListener implements Listener {
          *
          * We don't need to check permissions here because they've already been checked for the ability to even activate.
          */
-        if (mcMMO.spoutEnabled && profile.getAbilityMode(AbilityType.TREE_FELLER) && BlockChecks.isLog(block)) {
-            SpoutSounds.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
+        if (profile.getAbilityMode(AbilityType.TREE_FELLER) && BlockChecks.isLog(block)) {
+            player.playSound(block.getLocation(), Sound.FIZZ, Misc.FIZZ_VOLUME, Misc.FIZZ_PITCH);
         }
     }
 
@@ -347,9 +346,7 @@ public class BlockListener implements Listener {
                 event.setInstaBreak(true);
             }
 
-            if (mcMMO.spoutEnabled) {
-                SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
-            }
+            player.playSound(block.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.POP_PITCH);
         }
         else if (profile.getAbilityMode(AbilityType.SUPER_BREAKER) && SkillTools.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) {
             MiningManager miningManager = new MiningManager(player);

+ 2 - 5
src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java

@@ -5,10 +5,10 @@ import java.util.List;
 
 import org.bukkit.Location;
 import org.bukkit.Material;
+import org.bukkit.Sound;
 import org.bukkit.block.Block;
 import org.bukkit.entity.Player;
 import org.bukkit.inventory.ItemStack;
-import org.getspout.spoutapi.sound.SoundEffect;
 
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.config.Config;
@@ -18,7 +18,6 @@ import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
 import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
 import com.gmail.nossr50.skills.SkillType;
 import com.gmail.nossr50.skills.SkillTools;
-import com.gmail.nossr50.spout.SpoutSounds;
 import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.ModChecks;
 import com.gmail.nossr50.util.Permissions;
@@ -152,8 +151,6 @@ public class Excavation {
             Excavation.excavationProcCheck(block, player);
         }
 
-        if (mcMMO.spoutEnabled) {
-            SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
-        }
+        player.playSound(block.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.POP_PITCH);
     }
 }

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java

@@ -146,6 +146,6 @@ public class MiningManager extends SkillManager{
         eventHandler.callFakeArmswing();
         eventHandler.processDurabilityLoss();
         eventHandler.processDropsAndXP();
-        eventHandler.playSpoutSound();
+        eventHandler.playSound();
     }
 }

+ 3 - 6
src/main/java/com/gmail/nossr50/skills/mining/SuperBreakerEventHandler.java

@@ -1,15 +1,14 @@
 package com.gmail.nossr50.skills.mining;
 
 import org.bukkit.Material;
+import org.bukkit.Sound;
 import org.bukkit.block.Block;
 import org.bukkit.entity.Player;
 import org.bukkit.inventory.ItemStack;
-import org.getspout.spoutapi.sound.SoundEffect;
 
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
 import com.gmail.nossr50.skills.SkillTools;
-import com.gmail.nossr50.spout.SpoutSounds;
 import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.ModChecks;
 
@@ -55,10 +54,8 @@ public class SuperBreakerEventHandler {
         manager.miningBlockCheck(block);
     }
 
-    protected void playSpoutSound() {
-        if (mcMMO.spoutEnabled) {
-            SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
-        }
+    protected void playSound() {
+        player.playSound(block.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.POP_PITCH);
     }
 
     /**

+ 3 - 4
src/main/java/com/gmail/nossr50/skills/repair/Repair.java

@@ -4,6 +4,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import org.bukkit.Material;
+import org.bukkit.Sound;
 import org.bukkit.enchantments.Enchantment;
 import org.bukkit.entity.Player;
 import org.bukkit.inventory.ItemStack;
@@ -17,7 +18,6 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
 import com.gmail.nossr50.locale.LocaleLoader;
 import com.gmail.nossr50.skills.SkillType;
 import com.gmail.nossr50.skills.SkillTools;
-import com.gmail.nossr50.spout.SpoutSounds;
 import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.Permissions;
 import com.gmail.nossr50.util.Users;
@@ -55,9 +55,7 @@ public class Repair {
         SkillTools.xpProcessing(player, profile, SkillType.REPAIR, dif * 10);
 
         //CLANG CLANG
-        if (mcMMO.spoutEnabled) {
-            SpoutSounds.playRepairNoise(player, mcMMO.p);
-        }
+        player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
     }
 
     /**
@@ -275,6 +273,7 @@ public class Repair {
                 player.sendMessage(LocaleLoader.getString("Repair.Listener.Anvil"));
             }
 
+            player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
             profile.togglePlacedAnvil();
         }
     }

+ 2 - 5
src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java

@@ -2,12 +2,12 @@ package com.gmail.nossr50.skills.woodcutting;
 
 import org.bukkit.Location;
 import org.bukkit.Material;
+import org.bukkit.Sound;
 import org.bukkit.TreeSpecies;
 import org.bukkit.block.Block;
 import org.bukkit.entity.Player;
 import org.bukkit.event.block.BlockBreakEvent;
 import org.bukkit.inventory.ItemStack;
-import org.getspout.spoutapi.sound.SoundEffect;
 
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.config.AdvancedConfig;
@@ -16,7 +16,6 @@ import com.gmail.nossr50.datatypes.mods.CustomBlock;
 import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
 import com.gmail.nossr50.skills.SkillType;
 import com.gmail.nossr50.skills.SkillTools;
-import com.gmail.nossr50.spout.SpoutSounds;
 import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.ModChecks;
 import com.gmail.nossr50.util.Permissions;
@@ -55,9 +54,7 @@ public final class Woodcutting {
     public static void beginLeafBlower(Player player, Block block) {
         mcMMO.p.getServer().getPluginManager().callEvent(new FakePlayerAnimationEvent(player));
 
-        if (mcMMO.spoutEnabled) {
-            SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
-        }
+        player.playSound(block.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.POP_PITCH);
     }
 
     /**

+ 0 - 13
src/main/java/com/gmail/nossr50/spout/SpoutSounds.java

@@ -25,19 +25,6 @@ public class SpoutSounds {
         soundManager.playSoundEffect(spoutPlayer, effect, location);
     }
 
-    /**
-     * Play noise on successful repair.
-     *
-     * @param player The player who repaired an item
-     */
-    public static void playRepairNoise(Player player, mcMMO plugin) {
-        SoundManager soundManager = SpoutManager.getSoundManager();
-        SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
-
-        //If this is pulling from online, why have it in the jar?
-        soundManager.playCustomSoundEffect(plugin, spoutPlayer, "repair.wav", false);
-    }
-
     /**
      * Play noise on level-up.
      *

+ 8 - 0
src/main/java/com/gmail/nossr50/util/Misc.java

@@ -36,6 +36,14 @@ public final class Misc {
     public static final int NORMAL_SKILL_ACTIVATION_CHANCE = 100;
     public static final int LUCKY_SKILL_ACTIVATION_CHANCE = 75;
 
+    //Sound Pitches & Volumes from CB
+    public static final float ANVIL_USE_PITCH = 0.3F; // Not in CB directly, I went off the place sound values
+    public static final float ANVIL_USE_VOLUME = 1.0F; // Not in CB directly, I went off the place sound values
+    public static final float FIZZ_PITCH = 2.6F + (Misc.getRandom().nextFloat() - Misc.getRandom().nextFloat()) * 0.8F;
+    public static final float FIZZ_VOLUME = 0.5F;
+    public static final float POP_PITCH = ((getRandom().nextFloat() - getRandom().nextFloat()) * 0.7F + 1.0F) * 2.0F;
+    public static final float POP_VOLUME = 0.2F;
+
     private Misc() {};
 
     /**

二进制
src/main/resources/sound/repair.wav