aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/config
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-23 18:05:14 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-23 18:05:14 +0200
commita086a98cff6d5b327477fe7846495f1d392feebd (patch)
tree18f52aab6777c27a0e623921f863efb1c50fdb80 /src/main/java/cc/polyfrost/oneconfig/config
parentcc30afc4eb515c93b0d763e4347bee628c007372 (diff)
downloadOneConfig-a086a98cff6d5b327477fe7846495f1d392feebd.tar.gz
OneConfig-a086a98cff6d5b327477fe7846495f1d392feebd.tar.bz2
OneConfig-a086a98cff6d5b327477fe7846495f1d392feebd.zip
OC-23 some things
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/config')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java9
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java30
2 files changed, 20 insertions, 19 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java
index a5ac1f6..f31b609 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java
@@ -130,25 +130,28 @@ public class VigilanceConfig extends Config {
private String getName(PropertyAttributesExt ext) {
try {
+ PropertyAttributesExt.class.getDeclaredField("i18nName").setAccessible(true);
return I18n.format((String) PropertyAttributesExt.class.getDeclaredField("i18nName").get(ext));
} catch (IllegalAccessException | NoSuchFieldException e) {
- throw new RuntimeException(e);
+ return ext.getName();
}
}
private String getCategory(PropertyAttributesExt ext) {
try {
+ PropertyAttributesExt.class.getDeclaredField("i18nCategory").setAccessible(true);
return I18n.format((String) PropertyAttributesExt.class.getDeclaredField("i18nCategory").get(ext));
} catch (IllegalAccessException | NoSuchFieldException e) {
- throw new RuntimeException(e);
+ return ext.getCategory();
}
}
private String getSubcategory(PropertyAttributesExt ext) {
try {
+ PropertyAttributesExt.class.getDeclaredField("i18nSubcategory").setAccessible(true);
return I18n.format((String) PropertyAttributesExt.class.getDeclaredField("i18nSubcategory").get(ext));
} catch (IllegalAccessException | NoSuchFieldException e) {
- throw new RuntimeException(e);
+ return ext.getSubcategory();
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java b/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java
index c7e86cd..da069c5 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java
@@ -1,38 +1,36 @@
package cc.polyfrost.oneconfig.config.data;
import cc.polyfrost.oneconfig.config.interfaces.Config;
+import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
+import java.util.Objects;
public class Mod {
public final String name;
public final ModType modType;
- public final String creator;
- public final String version;
+ public final String modIcon;
public Config config;
public final OptionPage defaultPage;
public boolean isShortCut = false;
- private static final ArrayList<Mod> mods = new ArrayList<>();
/**
* @param name Friendly name of the mod
* @param modType Type of the mod (for example ModType.QOL)
- * @param creator Creator of the mod
- * @param version Version of the mod
+ * @param modIcon path to icon of the mod (png or svg format)
*/
- public Mod(String name, ModType modType, String creator, String version) {
- int i = 1;
- for (Mod mod : mods) {
- if (mod.name.startsWith(name)) {
- ++i;
- name = name + " " + i;
- }
- }
+ public Mod(String name, ModType modType, @Nullable String modIcon) {
this.name = name;
this.modType = modType;
- this.creator = creator;
- this.version = version;
+ this.modIcon = modIcon;
this.defaultPage = new OptionPage(name, this);
- mods.add(this);
+ }
+
+ /**
+ * @param name Friendly name of the mod
+ * @param modType Type of the mod (for example ModType.QOL)
+ */
+ public Mod(String name, ModType modType) {
+ this(name, modType, null);
}
}