Fixed custom sounds not playing at all

(Custom Sounds should now work exactly as intended!)
This commit is contained in:
ASangarin 2021-01-02 21:22:49 +01:00
parent fcf0364a03
commit 54113b3a15

View File

@ -45,7 +45,7 @@ public class CustomSoundListener implements Listener {
@EventHandler
public void d(PlayerInteractEvent event) {
if (event.getAction() != Action.PHYSICAL || !event.hasItem())
if (event.getAction() == Action.PHYSICAL || !event.hasItem())
return;
if (event.getAction().name().contains("RIGHT_CLICK"))
@ -99,7 +99,7 @@ public class CustomSoundListener implements Listener {
NBTItem nbt = NBTItem.get(item);
if (nbt.hasTag("MMOITEMS_SOUND_" + type)) {
SoundReader sound = new SoundReader(nbt.getString("MMOITEMS_SOUND_" + type), Sound.ENTITY_PIG_AMBIENT);
sound.play(loc, (float) nbt.getDouble("MMOITEMS_SOUND_" + sound + "_VOL"), (float) nbt.getDouble("MMOITEMS_SOUND_" + sound + "_PIT"));
sound.play(loc, (float) nbt.getDouble("MMOITEMS_SOUND_" + type + "_VOL"), (float) nbt.getDouble("MMOITEMS_SOUND_" + type + "_PIT"));
}
}
}