aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/commands
diff options
context:
space:
mode:
authorRoman / Nea <roman.graef@gmail.com>2022-05-31 20:53:26 +0200
committerGitHub <noreply@github.com>2022-05-31 20:53:26 +0200
commitdfdc2d9519556dfec528ab9d1732cdf32aab0639 (patch)
tree6f046db7b581f40b2deedd202ceaf98ba9ec2567 /src/main/java/io/github/moulberry/notenoughupdates/commands
parenta6546a1abe954b394c40be58d73d6fb03d93709e (diff)
downloadnotenoughupdates-dfdc2d9519556dfec528ab9d1732cdf32aab0639.tar.gz
notenoughupdates-dfdc2d9519556dfec528ab9d1732cdf32aab0639.tar.bz2
notenoughupdates-dfdc2d9519556dfec528ab9d1732cdf32aab0639.zip
Move repository related configuration to GUI. (#151)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/commands')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ReloadRepoCommand.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/commands/repo/ReloadRepoCommand.java)16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ResetRepoCommand.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/commands/repo/ResetRepoCommand.java)9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/StatsCommand.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/profile/ViewProfileCommand.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/repo/RepoModeCommand.java60
7 files changed, 17 insertions, 86 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
index 5c2bf5c0..ea401eb7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
@@ -14,9 +14,6 @@ import io.github.moulberry.notenoughupdates.commands.profile.CataCommand;
import io.github.moulberry.notenoughupdates.commands.profile.PeekCommand;
import io.github.moulberry.notenoughupdates.commands.profile.PvCommand;
import io.github.moulberry.notenoughupdates.commands.profile.ViewProfileCommand;
-import io.github.moulberry.notenoughupdates.commands.repo.ReloadRepoCommand;
-import io.github.moulberry.notenoughupdates.commands.repo.RepoModeCommand;
-import io.github.moulberry.notenoughupdates.commands.repo.ResetRepoCommand;
import io.github.moulberry.notenoughupdates.miscfeatures.FairySouls;
import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour;
import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor;
@@ -41,11 +38,8 @@ public class Commands {
ClientCommandHandler.instance.registerCommand(new DevTestCommand());
ClientCommandHandler.instance.registerCommand(new NullzeeSphereCommand());
ClientCommandHandler.instance.registerCommand(new DiagCommand());
-
- // Repo Commands
- ClientCommandHandler.instance.registerCommand(new ResetRepoCommand());
- ClientCommandHandler.instance.registerCommand(new RepoModeCommand());
ClientCommandHandler.instance.registerCommand(new ReloadRepoCommand());
+ ClientCommandHandler.instance.registerCommand(new ResetRepoCommand());
// Profile Commands
ClientCommandHandler.instance.registerCommand(new PeekCommand());
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/ReloadRepoCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ReloadRepoCommand.java
index 7e58088f..40db245a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/ReloadRepoCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ReloadRepoCommand.java
@@ -1,15 +1,10 @@
-package io.github.moulberry.notenoughupdates.commands.repo;
+package io.github.moulberry.notenoughupdates.commands.dev;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.options.NEUConfig;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
-
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
+import net.minecraft.util.ChatComponentText;
public class ReloadRepoCommand extends ClientCommandBase {
@@ -19,10 +14,7 @@ public class ReloadRepoCommand extends ClientCommandBase {
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (args.length > 1 && args[0].equals("fetch")) {
- NotEnoughUpdates.INSTANCE.manager.fetchRepository();
- } else {
- NotEnoughUpdates.INSTANCE.manager.reloadRepository();
- }
+ NotEnoughUpdates.INSTANCE.manager.reloadRepository();
+ sender.addChatMessage(new ChatComponentText("§e[NEU] Reloaded repository."));
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/ResetRepoCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ResetRepoCommand.java
index b9a0d7cd..9e8363fb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/ResetRepoCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ResetRepoCommand.java
@@ -1,9 +1,10 @@
-package io.github.moulberry.notenoughupdates.commands.repo;
+package io.github.moulberry.notenoughupdates.commands.dev;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
+import net.minecraft.util.ChatComponentText;
public class ResetRepoCommand extends ClientCommandBase {
@@ -13,6 +14,10 @@ public class ResetRepoCommand extends ClientCommandBase {
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- NotEnoughUpdates.INSTANCE.manager.resetRepo();
+ NotEnoughUpdates.INSTANCE.manager
+ .userFacingRepositoryReload()
+ .thenAccept(strings ->
+ strings.forEach(line ->
+ sender.addChatMessage(new ChatComponentText("§e[NEU] " + line))));
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/StatsCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/StatsCommand.java
index 38eafe39..c7b6e887 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/StatsCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/StatsCommand.java
@@ -146,7 +146,7 @@ public class StatsCommand extends ClientCommandBase {
builder.append("Loaded Mods", String.valueOf(activeModCount));
builder.append("Forge", ForgeVersion.getVersion());
builder.category("Neu Settings");
- builder.append("API Key", NotEnoughUpdates.INSTANCE.config.apiKey.apiKey.isEmpty() ? "FALSE" : "TRUE");
+ builder.append("API Key", NotEnoughUpdates.INSTANCE.config.apiData.apiKey.isEmpty() ? "FALSE" : "TRUE");
builder.append("On Skyblock", NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() ? "TRUE" : "FALSE");
builder.append(
"Mod Version",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java
index 0b2c155e..69d114ca 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java
@@ -21,8 +21,8 @@ public class AhCommand extends ClientCommandBase {
if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED +
"You must be on Skyblock to use this feature."));
- } else if (NotEnoughUpdates.INSTANCE.config.apiKey.apiKey == null ||
- NotEnoughUpdates.INSTANCE.config.apiKey.apiKey.trim().isEmpty()) {
+ } else if (NotEnoughUpdates.INSTANCE.config.apiData.apiKey == null ||
+ NotEnoughUpdates.INSTANCE.config.apiData.apiKey.trim().isEmpty()) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED +
"Can't open NeuAH, apikey is not set. Run /api new and put the result in settings."));
} else {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/ViewProfileCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/ViewProfileCommand.java
index 371db394..fe441ad6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/ViewProfileCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/ViewProfileCommand.java
@@ -23,8 +23,8 @@ public class ViewProfileCommand extends ClientCommandBase {
"Some parts of the profile viewer do not work with OF Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it."));
}
- if (NotEnoughUpdates.INSTANCE.config.apiKey.apiKey == null ||
- NotEnoughUpdates.INSTANCE.config.apiKey.apiKey.trim().isEmpty()) {
+ if (NotEnoughUpdates.INSTANCE.config.apiData.apiKey == null ||
+ NotEnoughUpdates.INSTANCE.config.apiData.apiKey.trim().isEmpty()) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED +
"Can't view profile, apikey is not set. Run /api new and put the result in settings."));
} else if (args.length == 0) {
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
deleted file mode 100644
index 7e5312fb..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/repo/RepoModeCommand.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package io.github.moulberry.notenoughupdates.commands.repo;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.event.ClickEvent;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.ChatStyle;
-
-public class RepoModeCommand extends ClientCommandBase {
-
- public RepoModeCommand() {
- super("neurepomode");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (args.length == 1 && args[0].equalsIgnoreCase("toggle")) {
- NotEnoughUpdates.INSTANCE.config.hidden.dev = !NotEnoughUpdates.INSTANCE.config.hidden.dev;
- NotEnoughUpdates.INSTANCE.config.hidden.enableItemEditing =
- !NotEnoughUpdates.INSTANCE.config.hidden.enableItemEditing;
- Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a75Toggled NEU repo dev mode."));
- } else if (args.length >= 2 && args[0].equalsIgnoreCase("setrepourl")) {
- String githubUser = "Moulberry";
- String githubRepo = "NotEnoughUpdates-REPO";
- String githubBranch = "master";
- if (!args[1].equalsIgnoreCase("reset")) {
- githubUser = args[1];
- if (args.length >= 3) {
- githubRepo = args[2];
- }
- if (args.length >= 4) {
- githubBranch = args[3];
- }
- }
- 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));
- Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a75Run <")
- .appendSibling(new ChatComponentText("/neureloadrepo fetch").setChatStyle(new ChatStyle().setChatClickEvent(new ClickEvent(
- ClickEvent.Action.SUGGEST_COMMAND, "/neureloadrepo fetch"))))
- .appendSibling(new ChatComponentText("\u00a75> to redownload your repo.")));
-
- } else if (args.length == 1 && args[0].equalsIgnoreCase("autoupdate")) {
- NotEnoughUpdates.INSTANCE.config.hidden.autoupdate = !NotEnoughUpdates.INSTANCE.config.hidden.autoupdate;
- Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a75Toggled repo auto-updating" + (NotEnoughUpdates.INSTANCE.config.hidden.autoupdate ? "on" : "off")));
- } else {
- Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a7cUsage:" +
- "\n\u00a75/neurepomode <toggle> Toggles on/off dev mode and item editing." +
- "\n\u00a75/neurepomode <setRepoURL> <githubuser> [reponame] [branch] Sets the repo URL for downloading from." +
- "\n\u00a75/neurepomode <autoupdate> Toggles on/off auto-updating the repo"));
- }
- }
-}