| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | function registerWorldInfoSlashCommands() { |
| 888 | | - function reloadEditor(file) { |
| 888 | + /** |
| 889 | + * Reloads the editor with the specified world info file |
| 890 | + * @param {string} file - The file to load in the editor |
| 891 | + * @param {boolean} [loadIfNotSelected=false] - Indicates whether to load the file even if it's not currently selected |
| 892 | + */ |
| 893 | + function reloadEditor(file, loadIfNotSelected = false) { |
| 894 | + const currentIndex = $('#world_editor_select').val(); |
| 889 | 895 | const selectedIndex = world_names.indexOf(file); |
| 890 | 896 | if (selectedIndex !== -1 && (loadIfNotSelected || currentIndex === selectedIndex)) { |
| 891 | 897 | $('#world_editor_select').val(selectedIndex).trigger('change'); |
| 892 | 898 | } |
| 893 | 899 | } |