Fix the sfx selection gui for playsound (#10095)
* fix the index used to get the sfx substring * handle cases where the sxf variable is not a built-in This prevents a crash that happened whenever the sfx variable's name had less than 5 characters (4 before this pr), since the substring method was called regardless of the name's size.
This commit is contained in:
@@ -2149,7 +2149,8 @@ public class LStatements{
|
||||
table.button(b -> {
|
||||
b.image(Icon.pencilSmall);
|
||||
|
||||
b.clicked(() -> showSelect(b, GlobalVars.soundNames.toArray(String.class), id.substring(4), t -> {
|
||||
String soundName = id.startsWith("@sfx-") ? id.substring(5) : id;
|
||||
b.clicked(() -> showSelect(b, GlobalVars.soundNames.toArray(String.class), soundName, t -> {
|
||||
id = "@sfx-" + t;
|
||||
rebuild(table);
|
||||
}, 2, cell -> cell.size(160, 50)));
|
||||
|
||||
Reference in New Issue
Block a user