mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
Update BukkitActionManager.java
This commit is contained in:
@@ -693,14 +693,18 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
private void registerSoundAction() {
|
private void registerSoundAction() {
|
||||||
registerAction((args, chance) -> {
|
registerAction((args, chance) -> {
|
||||||
if (args instanceof Section section) {
|
if (args instanceof Section section) {
|
||||||
Sound sound = Sound.sound(
|
MathValue<Player> volume = MathValue.auto(section.get("volume"));
|
||||||
Key.key(section.getString("key")),
|
MathValue<Player> pitch = MathValue.auto(section.get("pitch"));
|
||||||
Sound.Source.valueOf(section.getString("source", "PLAYER").toUpperCase(Locale.ENGLISH)),
|
Key key = Key.key(section.getString("key"));
|
||||||
section.getDouble("volume", 1.0).floatValue(),
|
Sound.Source source = Sound.Source.valueOf(section.getString("source", "PLAYER").toUpperCase(Locale.ENGLISH));
|
||||||
section.getDouble("pitch", 1.0).floatValue()
|
|
||||||
);
|
|
||||||
return context -> {
|
return context -> {
|
||||||
if (Math.random() > chance.evaluate(context)) return;
|
if (Math.random() > chance.evaluate(context)) return;
|
||||||
|
Sound sound = Sound.sound(
|
||||||
|
key,
|
||||||
|
source,
|
||||||
|
(float) volume.evaluate(context),
|
||||||
|
(float) pitch.evaluate(context)
|
||||||
|
);
|
||||||
Audience audience = plugin.getSenderFactory().getAudience(context.holder());
|
Audience audience = plugin.getSenderFactory().getAudience(context.holder());
|
||||||
AdventureHelper.playSound(audience, sound);
|
AdventureHelper.playSound(audience, sound);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user