> implem
/**
* Checks if the option is valid
*
- * 0 == valid
- * 1 == number too high
- * -1 == number too low
+ * @return 0 == valid
+ * 1 == number too high
+ *
-1 == number too low
*/
@Override
public byte isValid() {
@@ -139,9 +139,9 @@ public class ConfigEntry extends AbstractConfigType> implem
if (this.configBase.disableMinMax)
return 0;
if (Number.class.isAssignableFrom(value.getClass())) { // Only check min max if it is a number
- if (this.max != null && Double.valueOf(value.toString()) > Double.valueOf(max.toString()))
+ if (this.max != null && Double.parseDouble(value.toString()) > Double.parseDouble(max.toString()))
return 1;
- if (this.min != null && Double.valueOf(value.toString()) < Double.valueOf(min.toString()))
+ if (this.min != null && Double.parseDouble(value.toString()) < Double.parseDouble(min.toString()))
return -1;
return 0;
@@ -160,41 +160,23 @@ public class ConfigEntry extends AbstractConfigType> implem
@Override
- public boolean equals(IConfigEntry> obj) { return obj.getClass() == ConfigEntry.class ? equals((ConfigEntry>)obj) : false; }
+ public boolean equals(IConfigEntry> obj) { return obj.getClass() == ConfigEntry.class && equals((ConfigEntry>) obj); }
/** Is the value of this equal to another */
public boolean equals(ConfigEntry> obj) {
// Can all of this just be "return this.value.equals(obj.value)"?
- if (this.value.getClass() != obj.value.getClass())
- return false;
- if (Number.class.isAssignableFrom(this.value.getClass())) {
- if (this.value == obj.value)
- return true;
- else return false;
- } else {
- if (this.value.equals(obj.value))
- return true;
- else return false;
- }
+ if (Number.class.isAssignableFrom(this.value.getClass()))
+ return this.value == obj.value;
+ else
+ return this.value.equals(obj.value);
}
- public Runnable getRunnable() {
- return this.runnable;
- }
- public void setRunnable(Runnable runnable) {
- this.runnable = runnable;
- }
- public void runRunnable() {
- if (runnable != null)
- runnable.run();
- }
public static class Builder extends AbstractConfigType.Builder> {
private String tmpComment = null;
private T tmpMin;
private T tmpMax;
private boolean tmpUseApiOverwrite;
- private Runnable tmpRunnable;
private ConfigEntryPerformance tmpPerformance = ConfigEntryPerformance.DONT_SHOW;
public Builder comment(String newComment) {
@@ -202,6 +184,7 @@ public class ConfigEntry extends AbstractConfigType> implem
return this;
}
+ /** Allows most values to be set by 1 setter */
public Builder setMinDefaultMax(T newMin, T newDefault, T newMax) {
this.set(newDefault);
this.setMinMax(newMin, newMax);
@@ -228,11 +211,6 @@ public class ConfigEntry extends AbstractConfigType> implem
return this;
}
- public Builder setRunnable(Runnable newRunnable) {
- this.tmpRunnable = newRunnable;
- return this;
- }
-
public Builder setPerformance(ConfigEntryPerformance newPerformance) {
this.tmpPerformance = newPerformance;
return this;
@@ -241,7 +219,7 @@ public class ConfigEntry extends AbstractConfigType> implem
public ConfigEntry build() {
- return new ConfigEntry(tmpAppearance, tmpValue, tmpComment, tmpMin, tmpMax, tmpUseApiOverwrite, tmpRunnable, tmpPerformance, tmpListener);
+ return new ConfigEntry(tmpAppearance, tmpValue, tmpComment, tmpMin, tmpMax, tmpUseApiOverwrite, tmpPerformance, tmpListener);
}
}
}
diff --git a/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntryAppearance.java b/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntryAppearance.java
index dc76d6f7c..a92f169de 100644
--- a/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntryAppearance.java
+++ b/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntryAppearance.java
@@ -1,5 +1,11 @@
package com.seibel.lod.core.config.types;
+/**
+ * Allows options or categories to only be shown in the file or only in the ui
+ * (remember that if you make it only visible in the ui then the option wont save on game restart)
+ *
+ * @author coolGi
+ */
public enum ConfigEntryAppearance {
ALL(true, true),
ONLY_SHOW(true, false),
diff --git a/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntryPerformance.java b/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntryPerformance.java
index 7c45aa2e1..85390f68f 100644
--- a/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntryPerformance.java
+++ b/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntryPerformance.java
@@ -2,6 +2,7 @@ package com.seibel.lod.core.config.types;
/**
* What is the performance impact of an entry
+ * (default is DONT_SHOW)
*
* @author coolGi
*/
diff --git a/core/src/main/java/com/seibel/lod/core/config/types/ConfigUIComment.java b/core/src/main/java/com/seibel/lod/core/config/types/ConfigUIComment.java
index 59bcdf18f..fbec4b6cb 100644
--- a/core/src/main/java/com/seibel/lod/core/config/types/ConfigUIComment.java
+++ b/core/src/main/java/com/seibel/lod/core/config/types/ConfigUIComment.java
@@ -1,7 +1,7 @@
package com.seibel.lod.core.config.types;
/**
- * Adds something like a ConfigEntry but without a button to change the input and only in the gui
+ * Adds something like a ConfigEntry but without a button to change the input
*
* @author coolGi
*/
diff --git a/core/src/main/java/com/seibel/lod/core/jar/DarkModeDetector.java b/core/src/main/java/com/seibel/lod/core/jar/DarkModeDetector.java
index 0adbb085b..122d5c3e8 100644
--- a/core/src/main/java/com/seibel/lod/core/jar/DarkModeDetector.java
+++ b/core/src/main/java/com/seibel/lod/core/jar/DarkModeDetector.java
@@ -3,7 +3,7 @@ package com.seibel.lod.core.jar;
import java.io.*;
import java.util.regex.Pattern;
-import static com.seibel.lod.core.JarMain.getOperatingSystem;
+import static com.seibel.lod.core.jar.JarMain.getOperatingSystem;
/**
* A fork of iris'is dark mode detector (https://github.com/IrisShaders/Iris-Installer/blob/master/src/main/java/net/hypercubemc/iris_installer/DarkModeDetector.java)
diff --git a/core/src/main/java/com/seibel/lod/core/JarMain.java b/core/src/main/java/com/seibel/lod/core/jar/JarMain.java
similarity index 98%
rename from core/src/main/java/com/seibel/lod/core/JarMain.java
rename to core/src/main/java/com/seibel/lod/core/jar/JarMain.java
index 0f409deb4..3010ecf3c 100644
--- a/core/src/main/java/com/seibel/lod/core/JarMain.java
+++ b/core/src/main/java/com/seibel/lod/core/jar/JarMain.java
@@ -1,7 +1,8 @@
-package com.seibel.lod.core;
+package com.seibel.lod.core.jar;
import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatLightLaf;
+import com.seibel.lod.core.ModInfo;
import com.seibel.lod.core.jar.DarkModeDetector;
import com.seibel.lod.core.jar.JarUtils;
import com.seibel.lod.core.jar.gui.BaseJFrame;
@@ -34,6 +35,7 @@ public class JarMain {
Locale.setDefault(Locale.US);
}
// Set up the theme
+ System.setProperty("apple.awt.application.appearance", "system");
if (isDarkTheme)
FlatDarkLaf.setup();
else
diff --git a/core/src/main/java/com/seibel/lod/core/jar/JarUtils.java b/core/src/main/java/com/seibel/lod/core/jar/JarUtils.java
index 60cfda204..ed4069b9a 100644
--- a/core/src/main/java/com/seibel/lod/core/jar/JarUtils.java
+++ b/core/src/main/java/com/seibel/lod/core/jar/JarUtils.java
@@ -4,6 +4,12 @@ import java.io.*;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
+/**
+ * Some general utils for the jar
+ * this includes stuff like accessing files inside the jar and checking the checksum of a file
+ *
+ * @author coolGi
+ */
public class JarUtils {
public static final File jarFile = new File(JarUtils.class.getProtectionDomain().getCodeSource().getLocation().getPath());
diff --git a/core/src/main/java/com/seibel/lod/core/jar/gui/BaseJFrame.java b/core/src/main/java/com/seibel/lod/core/jar/gui/BaseJFrame.java
index ac8c80642..7de9d6743 100644
--- a/core/src/main/java/com/seibel/lod/core/jar/gui/BaseJFrame.java
+++ b/core/src/main/java/com/seibel/lod/core/jar/gui/BaseJFrame.java
@@ -39,6 +39,7 @@ public class BaseJFrame extends JFrame {
} catch (Exception e) {e.printStackTrace();}
setSize(720, 480);
setLocationRelativeTo(null); // Puts the window at the middle of the screen
+ setLayout(new BorderLayout());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
diff --git a/core/src/main/java/com/seibel/lod/core/jar/gui/JSwitch.java b/core/src/main/java/com/seibel/lod/core/jar/gui/JSwitch.java
index cbca504a0..95f9eb9e6 100644
--- a/core/src/main/java/com/seibel/lod/core/jar/gui/JSwitch.java
+++ b/core/src/main/java/com/seibel/lod/core/jar/gui/JSwitch.java
@@ -25,6 +25,7 @@ import javax.swing.plaf.ButtonUI;
*
* @author coolGi
*/
+// TODO: Make this for the theme (and finish the documentation once it is done)
@SuppressWarnings("serial")
public class JSwitch extends AbstractButton {
private static final String uiClassID = "SwitchUI";
diff --git a/core/src/main/java/com/seibel/lod/core/jar/gui/cusomJObject/JBox.java b/core/src/main/java/com/seibel/lod/core/jar/gui/cusomJObject/JBox.java
index 2c5eed583..6ae1d0c7a 100644
--- a/core/src/main/java/com/seibel/lod/core/jar/gui/cusomJObject/JBox.java
+++ b/core/src/main/java/com/seibel/lod/core/jar/gui/cusomJObject/JBox.java
@@ -3,6 +3,11 @@ package com.seibel.lod.core.jar.gui.cusomJObject;
import javax.swing.*;
import java.awt.*;
+/**
+ * A rectangular box that can be placed with java swing
+ *
+ * @author coolGi
+ */
public class JBox extends JComponent {
private static final String uiClassID = "BoxBarUI";
diff --git a/core/src/main/java/com/seibel/lod/core/jar/installer/GitlabGetter.java b/core/src/main/java/com/seibel/lod/core/jar/installer/GitlabGetter.java
index 626633f5e..ca3d30552 100644
--- a/core/src/main/java/com/seibel/lod/core/jar/installer/GitlabGetter.java
+++ b/core/src/main/java/com/seibel/lod/core/jar/installer/GitlabGetter.java
@@ -12,10 +12,12 @@ import java.util.List;
import java.util.stream.Collectors;
/**
- * Gets the releases available on gitlab and sends out the link
+ * Gets the releases available on gitlab and sends out the link.
+ * Please move over to ModrinthGetter for downloading releases of the mod
*
* @author coolGi
*/
+// TODO: Change this to a way to get the nightly builds
@Deprecated
public class GitlabGetter {
public static final String GitLabApi = "https://gitlab.com/api/v4/projects/";
diff --git a/core/src/main/java/com/seibel/lod/core/jar/installer/WebDownloader.java b/core/src/main/java/com/seibel/lod/core/jar/installer/WebDownloader.java
index 177725d13..9d4be6af5 100644
--- a/core/src/main/java/com/seibel/lod/core/jar/installer/WebDownloader.java
+++ b/core/src/main/java/com/seibel/lod/core/jar/installer/WebDownloader.java
@@ -9,7 +9,7 @@ import java.security.DigestInputStream;
import java.security.MessageDigest;
/**
- * Does something similar to wget
+ * Does something similar to wget/curl.
* It allows you to download a file from a link
*
* @author coolGi
@@ -17,7 +17,7 @@ import java.security.MessageDigest;
public class WebDownloader {
public static boolean netIsAvailable() {
try {
- final URL url = new URL("https://gitlab.com");
+ final URL url = new URL("https://www.google.com"); // Google will probably be online forever so we use that to check network connection
final URLConnection conn = url.openConnection();
conn.connect();
conn.getInputStream().close();