@@ -19,11 +19,16 @@ public void play(Player player, Location location, Song song, Layer layer, Note
1919 if (InstrumentUtils .isCustomInstrument (note .getInstrument ())) {
2020 CustomInstrument instrument = song .getCustomInstruments ()[note .getInstrument () - InstrumentUtils .getCustomInstrumentFirstIndex ()];
2121
22- CompatibilityUtils .playSound (player , location , InstrumentUtils .warpNameOutOfRange (instrument .getSoundFileName (), note .getKey (), note .getPitch ()), soundCategory , volume , pitch , distance );
23- CompatibilityUtils .playSound (player , location , InstrumentUtils .warpNameOutOfRange (instrument .getSoundFileName (), note .getKey (), note .getPitch ()), soundCategory , volume , pitch , -distance );
22+ if (instrument .getSound () != null ) {
23+ CompatibilityUtils .playSound (player , location , instrument .getSound (), soundCategory , volume , pitch , distance );
24+ CompatibilityUtils .playSound (player , location , instrument .getSound (), soundCategory , volume , pitch , -distance );
25+ } else {
26+ CompatibilityUtils .playSound (player , location , instrument .getSoundFileName (), soundCategory , volume , pitch , distance );
27+ CompatibilityUtils .playSound (player , location , instrument .getSoundFileName (), soundCategory , volume , pitch , -distance );
28+ }
2429 } else {
25- CompatibilityUtils .playSound (player , location , InstrumentUtils .warpNameOutOfRange ( note . getInstrument (), note .getKey (), note . getPitch ()), soundCategory , volume , pitch , distance );
26- CompatibilityUtils .playSound (player , location , InstrumentUtils .warpNameOutOfRange ( note . getInstrument (), note .getKey (), note . getPitch ()), soundCategory , volume , pitch , -distance );
30+ CompatibilityUtils .playSound (player , location , InstrumentUtils .getInstrument (note .getInstrument ()), soundCategory , volume , pitch , distance );
31+ CompatibilityUtils .playSound (player , location , InstrumentUtils .getInstrument (note .getInstrument ()), soundCategory , volume , pitch , -distance );
2732 }
2833 }
2934
@@ -38,11 +43,26 @@ public void play(Player player, Location location, Song song, Layer layer, Note
3843 if (InstrumentUtils .isCustomInstrument (note .getInstrument ())) {
3944 CustomInstrument instrument = song .getCustomInstruments ()[note .getInstrument () - InstrumentUtils .getCustomInstrumentFirstIndex ()];
4045
41- CompatibilityUtils .playSound (player , location , InstrumentUtils .warpNameOutOfRange (instrument .getSoundFileName (), note .getKey (), note .getPitch ()), soundCategory , volume , pitch , distance );
42- CompatibilityUtils .playSound (player , location , InstrumentUtils .warpNameOutOfRange (instrument .getSoundFileName (), note .getKey (), note .getPitch ()), soundCategory , volume , pitch , -distance );
46+ if (!doTranspose ){
47+ CompatibilityUtils .playSound (player , location , InstrumentUtils .warpNameOutOfRange (instrument .getSoundFileName (), note .getKey (), note .getPitch ()), soundCategory , volume , pitch , distance );
48+ CompatibilityUtils .playSound (player , location , InstrumentUtils .warpNameOutOfRange (instrument .getSoundFileName (), note .getKey (), note .getPitch ()), soundCategory , volume , pitch , -distance );
49+ } else {
50+ if (instrument .getSound () != null ) {
51+ CompatibilityUtils .playSound (player , location , instrument .getSound (), soundCategory , volume , pitch , distance );
52+ CompatibilityUtils .playSound (player , location , instrument .getSound (), soundCategory , volume , pitch , -distance );
53+ } else {
54+ CompatibilityUtils .playSound (player , location , instrument .getSoundFileName (), soundCategory , volume , pitch , distance );
55+ CompatibilityUtils .playSound (player , location , instrument .getSoundFileName (), soundCategory , volume , pitch , -distance );
56+ }
57+ }
4358 } else {
44- CompatibilityUtils .playSound (player , location , InstrumentUtils .warpNameOutOfRange (note .getInstrument (), note .getKey (), note .getPitch ()), soundCategory , volume , pitch , distance );
45- CompatibilityUtils .playSound (player , location , InstrumentUtils .warpNameOutOfRange (note .getInstrument (), note .getKey (), note .getPitch ()), soundCategory , volume , pitch , -distance );
59+ if (NoteUtils .isOutOfRange (note .getKey (), note .getPitch ()) && !doTranspose ) {
60+ CompatibilityUtils .playSound (player , location , InstrumentUtils .warpNameOutOfRange (note .getInstrument (), note .getKey (), note .getPitch ()), soundCategory , volume , pitch , distance );
61+ CompatibilityUtils .playSound (player , location , InstrumentUtils .warpNameOutOfRange (note .getInstrument (), note .getKey (), note .getPitch ()), soundCategory , volume , pitch , -distance );
62+ } else {
63+ CompatibilityUtils .playSound (player , location , InstrumentUtils .getInstrument (note .getInstrument ()), soundCategory , volume , pitch , distance );
64+ CompatibilityUtils .playSound (player , location , InstrumentUtils .getInstrument (note .getInstrument ()), soundCategory , volume , pitch , -distance );
65+ }
4666 }
4767 }
4868
0 commit comments