Bladeren bron

Code improvements

Lortseam 4 jaren geleden
bovenliggende
commit
4a0b7dd803

+ 0 - 2
src/main/java/me/lortseam/completeconfig/collection/Collection.java

@@ -15,7 +15,6 @@ import java.util.stream.Collectors;
 
 public class Collection {
 
-    private final String modTranslationKey;
     @Getter
     private final String translationKey;
     @Getter
@@ -24,7 +23,6 @@ public class Collection {
     private final CollectionMap collections;
 
     Collection(String modTranslationKey, String parentTranslationKey, ConfigCategory category) {
-        this.modTranslationKey = modTranslationKey;
         String categoryID = category.getConfigCategoryID();
         if (parentTranslationKey == null) {
             translationKey = categoryID;

+ 3 - 3
src/main/java/me/lortseam/completeconfig/entry/Entry.java

@@ -63,7 +63,7 @@ public class Entry<T> {
     private String translationKey;
     private String[] tooltipTranslationKeys;
     @Getter
-    private Extras<T> extras = new Extras<>(this);
+    private final Extras<T> extras = new Extras<>(this);
     private final List<Listener> listeners = new ArrayList<>();
     @Setter
     private boolean forceUpdate;
@@ -103,10 +103,10 @@ public class Entry<T> {
         if (extras.getBounds() != null) {
             if (new BigDecimal(value.toString()).compareTo(new BigDecimal(extras.getBounds().getMin().toString())) < 0) {
                 LOGGER.warn("[CompleteConfig] Tried to set value of field " + field + " to a value less than minimum bound, setting to minimum now!");
-                value = (T) extras.getBounds().getMin();
+                value = extras.getBounds().getMin();
             } else if (new BigDecimal(value.toString()).compareTo(new BigDecimal(extras.getBounds().getMax().toString())) > 0) {
                 LOGGER.warn("[CompleteConfig] Tried to set value of field " + field + " to a value greater than maximum bound, setting to maximum now!");
-                value = (T) extras.getBounds().getMax();
+                value = extras.getBounds().getMax();
             }
         }
         if (value.equals(getFieldValue())) {