Skip to content

Commit cbef72f

Browse files
committed
Replace unconditional Optional.get()
1 parent 9b0a5ce commit cbef72f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

chunky/src/java/se/llbit/chunky/ui/ChunkyFxController.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import javafx.stage.Stage;
5050
import javafx.util.converter.NumberStringConverter;
5151
import se.llbit.chunky.PersistentSettings;
52+
import se.llbit.chunky.block.Block;
5253
import se.llbit.chunky.launcher.LauncherSettings;
5354
import se.llbit.chunky.main.Chunky;
5455
import se.llbit.chunky.map.WorldMapLoader;
@@ -57,14 +58,12 @@
5758
import se.llbit.chunky.renderer.scene.AsynchronousSceneManager;
5859
import se.llbit.chunky.renderer.scene.Camera;
5960
import se.llbit.chunky.ui.render.RenderControlsFx;
60-
import se.llbit.chunky.block.Block;
6161
import se.llbit.chunky.world.ChunkPosition;
6262
import se.llbit.chunky.world.ChunkSelectionListener;
6363
import se.llbit.chunky.world.ChunkView;
6464
import se.llbit.chunky.world.Icon;
6565
import se.llbit.chunky.world.World;
6666
import se.llbit.chunky.world.listeners.ChunkUpdateListener;
67-
import se.llbit.fx.LuxColorPalette;
6867
import se.llbit.fx.LuxColorPicker;
6968
import se.llbit.fxutil.GroupedChangeListener;
7069
import se.llbit.log.Level;
@@ -276,7 +275,7 @@ public ChunkyFxController(Chunky chunky) {
276275
alert.setTitle("Delete Selected Chunks");
277276
alert.setContentText(
278277
"Do you really want to delete the selected chunks? This can not be undone.");
279-
if (alert.showAndWait().get() == ButtonType.OK) {
278+
if (alert.showAndWait().orElse(ButtonType.CANCEL) == ButtonType.OK) {
280279
mapLoader.deleteSelectedChunks(ProgressTracker.NONE);
281280
}
282281
});
@@ -502,7 +501,7 @@ public void createNew3DScene() {
502501
alert.setHeaderText("Overwrite existing scene?");
503502
alert.setContentText(
504503
"It seems like a scene already exists. Do you wish to overwrite it?");
505-
if (alert.showAndWait().get() != ButtonType.OK) {
504+
if (alert.showAndWait().orElse(ButtonType.CANCEL) != ButtonType.OK) {
506505
return;
507506
}
508507
}

0 commit comments

Comments
 (0)