From c69fa2597a8f1b9f2c20f60f65fca705f656832c Mon Sep 17 00:00:00 2001 From: Defeatomizer Date: Sun, 15 Oct 2023 15:11:55 +0300 Subject: [PATCH] Removed some dangerous methods from Workspace class (#4313) * Removed some dangerous methods from Workspace class * Hide another way --- .../net/mcreator/workspace/Workspace.java | 54 +------------------ 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/src/main/java/net/mcreator/workspace/Workspace.java b/src/main/java/net/mcreator/workspace/Workspace.java index 688eba898d4..098a086eb9a 100644 --- a/src/main/java/net/mcreator/workspace/Workspace.java +++ b/src/main/java/net/mcreator/workspace/Workspace.java @@ -469,7 +469,7 @@ public boolean isRegenerateRequired() { // Below are methods that may still be used by some plugins - public void loadStoredDataFrom(Workspace other) { + @SuppressWarnings("unused") void loadStoredDataFrom(Workspace other) { this.mod_elements = other.mod_elements; this.variable_elements = other.variable_elements; this.sound_elements = other.sound_elements; @@ -480,56 +480,4 @@ public void loadStoredDataFrom(Workspace other) { this.workspaceSettings.setWorkspace(this); } - @SuppressWarnings("unused") public void setFoldersRoot(FolderElement foldersRoot) { - this.foldersRoot = foldersRoot; - markDirty(); - } - - @SuppressWarnings("unused") public void updateModElement(ModElement element) { - for (ModElement el : mod_elements) { - if (el == element || el.getName().equals(element.getName())) { - el.loadDataFrom(element); - el.reloadElementIcon(); // update ME icon - el.getMCItems().forEach(mcItem -> mcItem.icon.getImage().flush()); // update MCItem icons - - break; // there can be only one element with given name so no need to iterate further - } - } - markDirty(); - } - - @SuppressWarnings("unused") - public void updateSoundElement(SoundElement originalElement, SoundElement updatedElement) { - Set tmp = new HashSet<>(sound_elements); - for (SoundElement el : tmp) { - if (el.getName().equals(originalElement.getName())) { - sound_elements.remove(el); - sound_elements.add(updatedElement); - } - } - markDirty(); - } - - @SuppressWarnings("unused") - public void updateVariableElement(VariableElement originalElement, VariableElement updatedElement) { - Set tmp = new HashSet<>(variable_elements); - for (VariableElement el : tmp) { - if (el.getName().equals(originalElement.getName())) { - variable_elements.remove(el); - variable_elements.add(updatedElement); - } - } - markDirty(); - } - - @SuppressWarnings("unused") public void reloadFromFS() { - String workspace_string = FileIO.readFileToString(fileManager.getWorkspaceFile()); - Workspace workspace_on_fs = WorkspaceFileManager.gson.fromJson(workspace_string, Workspace.class); - fileManager.getModElementManager().invalidateCache(); - loadStoredDataFrom(workspace_on_fs); - reloadModElements(); - reloadFolderStructure(); - LOG.info("Reloaded current workspace from the workspace file"); - } - }