aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.java
blob: c81f44a8f5fd028ad1c7ac243fa9f6802b57e3d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package io.github.moulberry.notenoughupdates.commands.help;

import com.google.gson.JsonObject;
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.util.ChatComponentText;

import java.io.File;

public class LinksCommand extends ClientCommandBase {

	public LinksCommand() {
		super("neulinks");
	}

	@Override
	public void processCommand(ICommandSender sender, String[] args) throws CommandException {
		File repo = NotEnoughUpdates.INSTANCE.manager.repoLocation;
		if (repo.exists()) {
			File updateJson = new File(repo, "update.json");
			try {
				JsonObject update = NotEnoughUpdates.INSTANCE.manager.getJsonFromFile(updateJson);

				Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""));
				NotEnoughUpdates.INSTANCE.displayLinks(update);
				Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""));
			} catch (Exception ignored) {
			}
		}
	}
}