Skip to content

Commit 4b1e13e

Browse files
committed
Play all music in the music sound category.
1 parent 94a1460 commit 4b1e13e

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/main/java/com/xxmicloxx/NoteBlockAPI/NoteBlockSongPlayer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.bukkit.Bukkit;
44
import org.bukkit.Material;
5+
import org.bukkit.SoundCategory;
56
import org.bukkit.block.Block;
67
import org.bukkit.entity.Player;
78

@@ -44,7 +45,7 @@ public void playTick(Player p, int tick) {
4445
if (song.getCustomInstruments()[note.getInstrument() - Instrument.getCustomInstrumentFirstIndex()].getSound() != null){
4546
p.playSound(noteBlock.getLocation(),
4647
song.getCustomInstruments()[note.getInstrument() - Instrument.getCustomInstrumentFirstIndex()].getSound(),
47-
((l.getVolume() * (int) volume * (int) playerVolume) / 1000000f) * ((1f/16f) * distance),
48+
SoundCategory.MUSIC,((l.getVolume() * (int) volume * (int) playerVolume) / 1000000f) * ((1f/16f) * distance),
4849
NotePitch.getPitch(note.getKey() - 33));
4950
}else {
5051
p.playSound(noteBlock.getLocation(),
@@ -56,7 +57,7 @@ public void playTick(Player p, int tick) {
5657
}else {
5758
p.playSound(noteBlock.getLocation(),
5859
Instrument.getInstrument(note.getInstrument()),
59-
((l.getVolume() * (int) volume * (int) playerVolume) / 1000000f) * ((1f/16f) * distance),
60+
SoundCategory.MUSIC,((l.getVolume() * (int) volume * (int) playerVolume) / 1000000f) * ((1f/16f) * distance),
6061
NotePitch.getPitch(note.getKey() - 33));
6162
}
6263

src/main/java/com/xxmicloxx/NoteBlockAPI/PositionSongPlayer.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.bukkit.Bukkit;
44
import org.bukkit.Location;
5+
import org.bukkit.SoundCategory;
56
import org.bukkit.entity.Player;
67

78
public class PositionSongPlayer extends SongPlayer {
@@ -39,19 +40,19 @@ public void playTick(Player p, int tick) {
3940
if (song.getCustomInstruments()[note.getInstrument() - Instrument.getCustomInstrumentFirstIndex()].getSound() != null){
4041
p.playSound(targetLocation,
4142
song.getCustomInstruments()[note.getInstrument() - Instrument.getCustomInstrumentFirstIndex()].getSound(),
42-
((l.getVolume() * (int) volume * (int) playerVolume) / 1000000f) * ((1f/16f) * distance),
43+
SoundCategory.MUSIC,((l.getVolume() * (int) volume * (int) playerVolume) / 1000000f) * ((1f/16f) * distance),
4344
NotePitch.getPitch(note.getKey() - 33));
4445
}else {
4546
p.playSound(targetLocation,
4647
song.getCustomInstruments()[note.getInstrument() - Instrument.getCustomInstrumentFirstIndex()].getSoundfile(),
47-
((l.getVolume() * (int) volume * (int) playerVolume) / 1000000f) * ((1f/16f) * distance),
48+
SoundCategory.MUSIC,((l.getVolume() * (int) volume * (int) playerVolume) / 1000000f) * ((1f/16f) * distance),
4849
NotePitch.getPitch(note.getKey() - 33));
4950
}
5051

5152
}else {
5253
p.playSound(targetLocation,
5354
Instrument.getInstrument(note.getInstrument()),
54-
((l.getVolume() * (int) volume * (int) playerVolume) / 1000000f) * ((1f/16f) * distance),
55+
SoundCategory.MUSIC,((l.getVolume() * (int) volume * (int) playerVolume) / 1000000f) * ((1f/16f) * distance),
5556
NotePitch.getPitch(note.getKey() - 33));
5657
}
5758

src/main/java/com/xxmicloxx/NoteBlockAPI/RadioSongPlayer.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.xxmicloxx.NoteBlockAPI;
22

3+
import org.bukkit.SoundCategory;
34
import org.bukkit.entity.Player;
45

56
public class RadioSongPlayer extends SongPlayer {
@@ -21,19 +22,19 @@ public void playTick(Player p, int tick) {
2122
if (song.getCustomInstruments()[note.getInstrument() - Instrument.getCustomInstrumentFirstIndex()].getSound() != null){
2223
p.playSound(p.getEyeLocation(),
2324
song.getCustomInstruments()[note.getInstrument() - Instrument.getCustomInstrumentFirstIndex()].getSound(),
24-
(l.getVolume() * (int) volume * (int) playerVolume) / 1000000f,
25+
SoundCategory.MUSIC,(l.getVolume() * (int) volume * (int) playerVolume) / 1000000f,
2526
NotePitch.getPitch(note.getKey() - 33));
2627
}else {
2728
p.playSound(p.getEyeLocation(),
2829
song.getCustomInstruments()[note.getInstrument() - Instrument.getCustomInstrumentFirstIndex()].getSoundfile(),
29-
(l.getVolume() * (int) volume * (int) playerVolume) / 1000000f,
30+
SoundCategory.MUSIC,(l.getVolume() * (int) volume * (int) playerVolume) / 1000000f,
3031
NotePitch.getPitch(note.getKey() - 33));
3132
}
3233

3334
}else {
3435
p.playSound(p.getEyeLocation(),
3536
Instrument.getInstrument(note.getInstrument()),
36-
(l.getVolume() * (int) volume * (int) playerVolume) / 1000000f,
37+
SoundCategory.MUSIC,(l.getVolume() * (int) volume * (int) playerVolume) / 1000000f,
3738
NotePitch.getPitch(note.getKey() - 33));
3839
}
3940
}

0 commit comments

Comments
 (0)