aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornea <romangraef@gmail.com>2022-04-28 19:42:52 +0200
committernea <romangraef@gmail.com>2022-04-28 19:42:52 +0200
commitbbc5dbbca810606ea598aff3f15ce0f08b18d307 (patch)
treedf816b600a0d6e413b66954ba349787adf80fda8
parentbddc4ddf48184960af0e808e3276aeabb417a007 (diff)
downloadNotEnoughUpdates-bbc5dbbca810606ea598aff3f15ce0f08b18d307.tar.gz
NotEnoughUpdates-bbc5dbbca810606ea598aff3f15ce0f08b18d307.tar.bz2
NotEnoughUpdates-bbc5dbbca810606ea598aff3f15ce0f08b18d307.zip
fix crash in ItemShopRecipe.java + fetch repository
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/repo/ReloadRepoCommand.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/repo/RepoModeCommand.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/ItemShopRecipe.java2
4 files changed, 12 insertions, 11 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index e3a60066..8e26414c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -195,9 +195,6 @@ public class NEUManager {
}
public CompletableFuture<Boolean> fetchRepository() {
- if (!NotEnoughUpdates.INSTANCE.config.hidden.autoupdate) {
- return CompletableFuture.completedFuture(false);
- }
return CompletableFuture.<Boolean>supplyAsync(() -> {
JDialog dialog = null;
try {
@@ -287,9 +284,10 @@ public class NEUManager {
* downloading of new/updated files. This then calls the "loadItem" method for every item in the local repository.
*/
public void loadItemInformation() {
- fetchRepository().thenAccept(i -> {
- reloadRepository();
- });
+ if (!NotEnoughUpdates.INSTANCE.config.hidden.autoupdate)
+ fetchRepository().thenAccept(i -> {
+ reloadRepository();
+ });
}
/**
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 33efcb52..c4ef8c2c 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
@@ -3,7 +3,6 @@ package io.github.moulberry.notenoughupdates.commands.repo;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
-import io.github.moulberry.notenoughupdates.util.Constants;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
@@ -20,8 +19,11 @@ public class ReloadRepoCommand extends ClientCommandBase {
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- NotEnoughUpdates.INSTANCE.manager.reloadRepository();
-
+ if (args.length > 1 && args[0].equals("fetch")) {
+ NotEnoughUpdates.INSTANCE.manager.fetchRepository();
+ } else {
+ NotEnoughUpdates.INSTANCE.manager.reloadRepository();
+ }
NotEnoughUpdates.INSTANCE.newConfigFile();
if (NotEnoughUpdates.INSTANCE.getConfigFile().exists()) {
try (
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/RepoModeCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/RepoModeCommand.java
index a8f53460..ef07d72d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/RepoModeCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/RepoModeCommand.java
@@ -36,7 +36,8 @@ public class RepoModeCommand extends ClientCommandBase {
NotEnoughUpdates.INSTANCE.config.hidden.repoURL = "https://github.com/" + githubUser + "/" + githubRepo + "/archive/" + githubBranch + ".zip";
NotEnoughUpdates.INSTANCE.config.hidden.repoCommitsURL = "https://api.github.com/repos/" + githubUser + "/" + githubRepo + "/commits/" + githubBranch;
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a75Set NEU repo URL to " + NotEnoughUpdates.INSTANCE.config.hidden.repoURL +
- "\n\u00a75Set NEU repo commits URL to " + NotEnoughUpdates.INSTANCE.config.hidden.repoCommitsURL));
+ "\n\u00a75Set NEU repo commits URL to " + NotEnoughUpdates.INSTANCE.config.hidden.repoCommitsURL));
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a75Run </neureloadrepo fetch> to redownload your repo."));
} else {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a7cUsage:" +
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/ItemShopRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/ItemShopRecipe.java
index ab497f72..c1e2f72b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/ItemShopRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/ItemShopRecipe.java
@@ -11,8 +11,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
-import scala.actors.threadpool.Arrays;
+import java.util.Arrays;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;