Skip to content

Commit 2c3e8af

Browse files
committed
Fixed options rejecting their previous name
Also fixed the rename GUI a bit
1 parent fdfd80d commit 2c3e8af

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/io/github/techstreet/dfscript/screen/script/ScriptEditSettingScreen.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import io.github.techstreet.dfscript.script.Script;
88
import io.github.techstreet.dfscript.script.options.ScriptNamedOption;
99

10+
import java.util.Objects;
11+
1012
public class ScriptEditSettingScreen extends CScreen {
1113
private final Script script;
1214
private final ScriptNamedOption option;
@@ -20,8 +22,8 @@ public ScriptEditSettingScreen(Script script, ScriptNamedOption o) {
2022

2123
input.setChangedListener(() -> input.textColor = 0xFFFFFF);
2224

23-
CButton confirm = new CButton(0, 35, 50, 15, "Confirm Rename", () -> {
24-
if(option.getName() != input.getText()) {
25+
CButton confirm = new CButton(2, 37, 46, 10, "Confirm Rename", () -> {
26+
if(!Objects.equals(option.getName(), input.getText())) {
2527
if(script.optionExists(input.getText())) {
2628
input.textColor = 0xFF3333;
2729
} else {
@@ -33,7 +35,7 @@ public ScriptEditSettingScreen(Script script, ScriptNamedOption o) {
3335
}
3436
});
3537

36-
CButton cancel = new CButton(50, 35, 50, 15, "Cancel", this::close);
38+
CButton cancel = new CButton(52, 37, 46, 10, "Cancel", this::close);
3739

3840
widgets.add(input);
3941
widgets.add(confirm);

0 commit comments

Comments
 (0)