Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ public WorldManagePage(World world, Path backupsDir, Profile profile, String id)

if (world.getGameVersion() != null && world.getGameVersion().isAtLeast("1.20", "23w14a")) {
toolbar.addNavigationDrawerItem(i18n("version.launch"), SVG.ROCKET_LAUNCH, this::launch, advancedListItem -> advancedListItem.setDisable(isReadOnly()));
toolbar.addNavigationDrawerItem(i18n("version.launch_script"), SVG.SCRIPT, this::generateLaunchScript, null);
}

if (ChunkBaseApp.isSupported(world)) {
Expand Down Expand Up @@ -144,6 +143,14 @@ public WorldManagePage(World world, Path backupsDir, Profile profile, String id)
PopupMenu managePopupMenu = new PopupMenu();
JFXPopup managePopup = new JFXPopup(managePopupMenu);

if (world.getGameVersion() != null && world.getGameVersion().isAtLeast("1.20", "23w14a")) {
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version check condition is duplicated on lines 113 and 146. Consider extracting this to a local variable or method to avoid code duplication and improve maintainability. For example, you could add a boolean variable before the toolbar creation to store this condition result.

Copilot uses AI. Check for mistakes.
managePopupMenu.getContent().addAll(
new IconedMenuItem(SVG.ROCKET_LAUNCH, i18n("version.launch"), this::launch, managePopup),
new IconedMenuItem(SVG.SCRIPT, i18n("version.launch_script"), this::generateLaunchScript, managePopup),
new MenuSeparator()
);
}

Comment on lines +149 to +153
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MenuSeparator is added unconditionally when the version check passes. If only the "Generate Launch Script" button should be moved to the popup menu (not the "Launch" button), then this separator might create an unnecessary visual gap when there's only one item before the export/delete/duplicate items. Consider whether the separator is still needed if the "Launch" button is removed from the popup menu.

Suggested change
new IconedMenuItem(SVG.SCRIPT, i18n("version.launch_script"), this::generateLaunchScript, managePopup),
new MenuSeparator()
);
}
new IconedMenuItem(SVG.SCRIPT, i18n("version.launch_script"), this::generateLaunchScript, managePopup)
);
}
if (managePopupMenu.getContent().size() > 1) {
managePopupMenu.getContent().add(new MenuSeparator());
}

Copilot uses AI. Check for mistakes.
managePopupMenu.getContent().addAll(
new IconedMenuItem(SVG.OUTPUT, i18n("world.export"), () -> WorldManageUIUtils.export(world, sessionLockChannel), managePopup),
new IconedMenuItem(SVG.DELETE, i18n("world.delete"), () -> WorldManageUIUtils.delete(world, () -> fireEvent(new PageCloseEvent()), sessionLockChannel), managePopup),
Expand Down
Loading