Skip to content

Commit 56878a9

Browse files
committed
fix parse sound action issues
1 parent f0a3314 commit 56878a9

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

modules/actions/src/main/java/top/mrxiaom/pluginbase/actions/ActionSound.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ public class ActionSound implements IAction {
2222
if (sound != null) {
2323
float volume = ConfigUtils.getFloat(section, "volume", 1.0f);
2424
float pitch = ConfigUtils.getFloat(section, "pitch", 1.0f);
25-
return new ActionSound(sound, volume, pitch);
25+
return new ActionSound(sound.toLowerCase(), volume, pitch);
2626
}
2727
}
2828
} else {
2929
String s = String.valueOf(input);
3030
if (s.startsWith("[sound]")) {
31-
String[] split = s.split(",");
32-
String sound = split[0];
33-
float volume = split.length > 1 ? Util.parseFloat(split[1]).orElse(1.0f) : 1.0f;
34-
float pitch = split.length > 2 ? Util.parseFloat(split[2]).orElse(1.0f) : 1.0f;
35-
return new ActionSound(sound, volume, pitch);
31+
String[] split = s.substring(7).split(",");
32+
String sound = split[0].trim();
33+
float volume = split.length > 1 ? Util.parseFloat(split[1].trim()).orElse(1.0f) : 1.0f;
34+
float pitch = split.length > 2 ? Util.parseFloat(split[2].trim()).orElse(1.0f) : 1.0f;
35+
return new ActionSound(sound.toLowerCase(), volume, pitch);
3636
}
3737
}
3838
return null;

0 commit comments

Comments
 (0)