Progress
This commit is contained in:
parent
ecf1907b3e
commit
82d8e6f8ca
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7
.idea/discord.xml
generated
Normal file
7
.idea/discord.xml
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DiscordProjectSettings">
|
||||||
|
<option name="show" value="APPLICATION" />
|
||||||
|
<option name="description" value="" />
|
||||||
|
</component>
|
||||||
|
</project>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -1,4 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
|
id 'com.github.johnrengelman.shadow' version '7.1.2'
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'application'
|
id 'application'
|
||||||
}
|
}
|
||||||
|
BIN
build/classes/java/main/com/calebfontenot/Common.class
Normal file
BIN
build/classes/java/main/com/calebfontenot/Common.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
build/classes/java/main/com/calebfontenot/parsers/PaperMC.class
Normal file
BIN
build/classes/java/main/com/calebfontenot/parsers/PaperMC.class
Normal file
Binary file not shown.
BIN
build/classes/java/main/com/calebfontenot/parsers/Velocity.class
Normal file
BIN
build/classes/java/main/com/calebfontenot/parsers/Velocity.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
build/libs/Minecraft-Updater-Java-1.0-SNAPSHOT-all.jar
Normal file
BIN
build/libs/Minecraft-Updater-Java-1.0-SNAPSHOT-all.jar
Normal file
Binary file not shown.
Binary file not shown.
@ -201,7 +201,7 @@ fi
|
|||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
-classpath "$CLASSPATH" \
|
-classpath "$CLASSPATH" \
|
||||||
NULL \
|
com.calebfontenot.Main \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
|
@ -71,7 +71,7 @@ set CLASSPATH=%APP_HOME%\lib\Minecraft-Updater-Java-1.0-SNAPSHOT.jar;%APP_HOME%\
|
|||||||
|
|
||||||
|
|
||||||
@rem Execute Minecraft-Updater-Java
|
@rem Execute Minecraft-Updater-Java
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %MINECRAFT_UPDATER_JAVA_OPTS% -classpath "%CLASSPATH%" NULL %*
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %MINECRAFT_UPDATER_JAVA_OPTS% -classpath "%CLASSPATH%" com.calebfontenot.Main %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
Binary file not shown.
3
build/tmp/shadowJar/MANIFEST.MF
Normal file
3
build/tmp/shadowJar/MANIFEST.MF
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: com.calebfontenot.Main
|
||||||
|
|
1
response.json
Normal file
1
response.json
Normal file
File diff suppressed because one or more lines are too long
51
src/main/java/com/calebfontenot/Common.java
Normal file
51
src/main/java/com/calebfontenot/Common.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package com.calebfontenot;
|
||||||
|
|
||||||
|
import org.json.*;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Common {
|
||||||
|
public static List<String> parse(String fetchURL, String keyToFetch) throws Exception {
|
||||||
|
//System.out.println("CURLing API...");
|
||||||
|
URL url = new URL(fetchURL);
|
||||||
|
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"))) {
|
||||||
|
for (String line; (line = reader.readLine()) != null; ) {
|
||||||
|
JSONObject json = new JSONObject(line);
|
||||||
|
//System.out.println(line);
|
||||||
|
JSONArray key = json.getJSONArray(keyToFetch);
|
||||||
|
List<String> returnList = new ArrayList<String>();
|
||||||
|
for (int i = 0; i < key.length() - 1; i++) {
|
||||||
|
String returnString = (String) key.get(i);
|
||||||
|
returnList.add(returnString);
|
||||||
|
}
|
||||||
|
return returnList;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception IllegalArgumentException) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String rawFetch(String fetchURL) throws Exception {
|
||||||
|
//System.out.println("CURLing API...");
|
||||||
|
URL url = new URL(fetchURL);
|
||||||
|
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"))) {
|
||||||
|
for (String line; (line = reader.readLine()) != null; ) {
|
||||||
|
//JSONObject json = new JSONObject(line);
|
||||||
|
//System.out.println(line);
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception IllegalArgumentException) {
|
||||||
|
System.out.println("Illegal Argument!");
|
||||||
|
IllegalArgumentException.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -1,28 +1,87 @@
|
|||||||
package com.calebfontenot;
|
package com.calebfontenot;
|
||||||
|
|
||||||
import java.net.*;
|
import com.calebfontenot.parsers.Velocity;
|
||||||
import java.io.*;
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
import org.json.*;
|
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
|
//TODO: Move these into the parser classes?
|
||||||
|
public static final String PAPER_API_URL = "https://api.papermc.io/v2";
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
System.out.println("args used: " + args[i]);
|
System.out.println("args used: " + args[i]);
|
||||||
}
|
}
|
||||||
System.out.println("CURLing API...");
|
// Check if user passed arguments, if none have been passed, go into interactive mode:
|
||||||
URL url = new URL("https://api.papermc.io/v2/projects");
|
if (args.length == 0) {
|
||||||
|
menu();
|
||||||
|
} else if (args[0].equals("download")) {
|
||||||
|
if (args[1].equals("modrinth")) {
|
||||||
|
Velocity.fetchVersions(args[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
List<String> projects = Common.parse("https://api.papermc.io/v2/projects", "projects");
|
||||||
|
System.out.println("The projects returned by Common.parse() are: ");
|
||||||
|
for(String projectNames:projects) {
|
||||||
|
System.out.println(projectNames);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"))) {
|
public static void menu() throws Exception {
|
||||||
for (String line; (line = reader.readLine()) != null; ) {
|
Scanner input = new Scanner(System.in);
|
||||||
JSONObject json = new JSONObject(line);
|
int userInput;
|
||||||
System.out.println(line);
|
System.out.println("No arguments passed, entering interactive mode!");
|
||||||
JSONArray projects = json.getJSONArray("projects");
|
System.out.println("Note: Typing '-1' at any point in this menu will exit the program.");
|
||||||
for (int i = 0; i < projects.length() - 1; i++) {
|
do {
|
||||||
System.out.println(projects.get(i));
|
System.out.println("What would you like to do?");
|
||||||
|
System.out.println("1. Download a jar file from a parser.");
|
||||||
|
System.out.println("2. Obtain information from an API.");
|
||||||
|
userInput = input.nextInt();
|
||||||
|
if (userInput == 1) { // Download
|
||||||
|
|
||||||
|
} else if (userInput == 2) { // Obtain info
|
||||||
|
System.out.println("Selected: Obtain info");
|
||||||
|
System.out.println("Select which parser to use:");
|
||||||
|
System.out.println("1. PaperMC (Not finished)");
|
||||||
|
System.out.println("2. Modrinth");
|
||||||
|
userInput = input.nextInt();
|
||||||
|
if (userInput == 1) { // user has selected PaperMC
|
||||||
|
System.out.println("Available Projects: ");
|
||||||
|
List<String> projects = Common.parse(PAPER_API_URL + "/projects", "projects");
|
||||||
|
int i = 1;
|
||||||
|
for (String projectNames : projects) {
|
||||||
|
System.out.println(i + ". " + projectNames);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
System.out.print("Select project: ");
|
||||||
|
userInput = input.nextInt();
|
||||||
|
System.out.println(Common.rawFetch(PAPER_API_URL + "/projects/" + projects.get(userInput - 1)));
|
||||||
|
}
|
||||||
|
if (userInput == 2) {
|
||||||
|
System.out.println("What would you like to do?");
|
||||||
|
System.out.println("1. Search for mods");
|
||||||
|
System.out.println("2. Get info about a slug/ID");
|
||||||
|
userInput = input.nextInt();
|
||||||
|
if(userInput == 1) {
|
||||||
|
System.out.print("Enter query:");
|
||||||
|
String inputString = input.next();
|
||||||
|
System.out.println(Common.rawFetch(com.calebfontenot.parsers.Velocity.MODRINTH_API_URL + "/search?query=" + inputString));
|
||||||
|
}
|
||||||
|
if(userInput == 2) {
|
||||||
|
System.out.print("Enter slug/ID: ");
|
||||||
|
String inputString = input.next();
|
||||||
|
System.out.println(Common.rawFetch(com.calebfontenot.parsers.Velocity.MODRINTH_API_URL + "/project/" + inputString + "/version"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} while (userInput != -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
8
src/main/java/com/calebfontenot/parsers/PaperMC.java
Normal file
8
src/main/java/com/calebfontenot/parsers/PaperMC.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package com.calebfontenot.parsers;
|
||||||
|
|
||||||
|
public class PaperMC {
|
||||||
|
public static String download() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
10
src/main/java/com/calebfontenot/parsers/Velocity.java
Normal file
10
src/main/java/com/calebfontenot/parsers/Velocity.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package com.calebfontenot.parsers;
|
||||||
|
|
||||||
|
import com.calebfontenot.Common;
|
||||||
|
|
||||||
|
public class Velocity {
|
||||||
|
public static final String MODRINTH_API_URL = "https://api.modrinth.com/v2";
|
||||||
|
public static void fetchVersions(String modID) throws Exception { // Fetch information about mod versions from the API.
|
||||||
|
System.out.println(Common.rawFetch(MODRINTH_API_URL + "/project/" + modID + "/version"));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user