aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/repo/ReloadRepoCommand.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java3
4 files changed, 14 insertions, 12 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/ReloadRepoCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/ReloadRepoCommand.java
index c4ef8c2c..7e58088f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/ReloadRepoCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/ReloadRepoCommand.java
@@ -24,17 +24,5 @@ public class ReloadRepoCommand extends ClientCommandBase {
} else {
NotEnoughUpdates.INSTANCE.manager.reloadRepository();
}
- NotEnoughUpdates.INSTANCE.newConfigFile();
- if (NotEnoughUpdates.INSTANCE.getConfigFile().exists()) {
- try (
- BufferedReader reader = new BufferedReader(new InputStreamReader(
- new FileInputStream(NotEnoughUpdates.INSTANCE.getConfigFile()),
- StandardCharsets.UTF_8
- ))
- ) {
- NotEnoughUpdates.INSTANCE.config = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(reader, NEUConfig.class);
- } catch (Exception ignored) {
- }
- }
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
index 5a8fd901..2ed708e9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
@@ -421,6 +421,11 @@ public class GuiEnchantColour extends GuiScreen {
}
@Override
+ public void onGuiClosed() {
+ NotEnoughUpdates.INSTANCE.saveConfig();
+ }
+
+ @Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
super.keyTyped(typedChar, keyCode);
for (int yIndex = 0; yIndex < guiElementTextFields.size(); yIndex++) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java
index 83880846..d65a18b0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java
@@ -22,6 +22,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ResourceLocation;
+import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -841,6 +842,11 @@ public class GuiInvButtonEditor extends GuiScreen {
private final ExecutorService searchES = Executors.newSingleThreadExecutor();
private final AtomicInteger searchId = new AtomicInteger(0);
+ @Override
+ public void onGuiClosed() {
+ NotEnoughUpdates.INSTANCE.saveConfig();
+ }
+
public void search() {
final int thisSearchId = searchId.incrementAndGet();
final String searchString = iconTextField.getText();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
index 83ade3a9..43c04698 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
@@ -886,5 +886,8 @@ public class NEUConfigEditor extends GuiElement {
target.setTarget(target.getTarget() - 5);
}
}
+ if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
+ NotEnoughUpdates.INSTANCE.saveConfig();
+ }
}
}