mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-02-17 21:02:12 +01:00
Sound sign compatibility fix
This commit is contained in:
parent
ac788515db
commit
6282deaf3c
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package io.github.dre2n.dungeonsxl.sign.message;
|
||||
|
||||
import de.erethon.commons.compatibility.CompatibilityHandler;
|
||||
import de.erethon.commons.compatibility.Internals;
|
||||
import de.erethon.commons.misc.EnumUtil;
|
||||
import de.erethon.commons.misc.NumberUtil;
|
||||
import io.github.dre2n.dungeonsxl.sign.DSign;
|
||||
@ -62,13 +64,16 @@ public class SoundMessageSign extends DSign {
|
||||
sound = lines[1];
|
||||
if (!lines[2].isEmpty()) {
|
||||
String[] args = lines[2].split(",");
|
||||
if (args.length >= 1) {
|
||||
if (args.length >= 1 && args.length != 2 && Internals.andHigher(Internals.v1_11_R1).contains(CompatibilityHandler.getInstance().getInternals())) {
|
||||
category = EnumUtil.getEnumIgnoreCase(SoundCategory.class, args[0]);
|
||||
if (category == null) {
|
||||
category = SoundCategory.MASTER;
|
||||
}
|
||||
}
|
||||
if (args.length == 3) {
|
||||
if (args.length == 2) {
|
||||
volume = (float) NumberUtil.parseDouble(args[0], 5.0);
|
||||
pitch = (float) NumberUtil.parseDouble(args[1], 1.0);
|
||||
} else if (args.length == 3) {
|
||||
volume = (float) NumberUtil.parseDouble(args[1], 5.0);
|
||||
pitch = (float) NumberUtil.parseDouble(args[2], 1.0);
|
||||
}
|
||||
@ -95,7 +100,11 @@ public class SoundMessageSign extends DSign {
|
||||
if (initialized) {
|
||||
if (!done.contains(player)) {
|
||||
done.add(player);
|
||||
player.playSound(getSign().getLocation(), sound, category, volume, pitch);
|
||||
if (Internals.andHigher(Internals.v1_11_R1).contains(CompatibilityHandler.getInstance().getInternals())) {
|
||||
player.playSound(getSign().getLocation(), sound, category, volume, pitch);
|
||||
} else {
|
||||
player.playSound(getSign().getLocation(), sound, volume, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
if (done.size() >= getGameWorld().getWorld().getPlayers().size()) {
|
||||
|
Loading…
Reference in New Issue
Block a user