diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e1f0391..882c9e7d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ *
  • {@link #loadJson(ResourceLocation, ResourceManager)} - Loads a JSON resource.
  • * * @author MeAlam - * @co-author Dan + * @since 1.0.0 */ public class JSONLoader { @@ -48,7 +48,7 @@ * @return The value of the custom parameter identified by {@code pParameterKey} * for the variant specified by {@code pVariantName}. * @author MeAlam - * @co-author Dan + * @since 1.0.0 */ public String getCustomParameter(String pVariantName, String pParameterKey) { @@ -67,7 +67,7 @@ * @return The value of the custom parameter identified by {@code pParameterKey} * for the variant specified by {@code pVariantName}. * @author MeAlam - * @co-author Dan + * @since 1.0.0 */ public String getCustomParameter(String pVariantName, String pParameterKey) { @@ -101,7 +101,7 @@ * TODO: Testing with Multiple Entities and Datapacks required before Deletion/Refactoring.
    * @return A map containing the parameters added to this builder. * @author MeAlam - * @co-author Dan + * @since 1.0.0 * @see #newMethod() */ diff --git a/Forge/src/main/java/software/bluelib/BlueLib.java b/Forge/src/main/java/software/bluelib/BlueLib.java index 87d8aef9..c58de55b 100644 --- a/Forge/src/main/java/software/bluelib/BlueLib.java +++ b/Forge/src/main/java/software/bluelib/BlueLib.java @@ -7,13 +7,6 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.fml.loading.FMLEnvironment; -import software.bluelib.utils.logging.BaseLogLevel; -import software.bluelib.utils.logging.BaseLogger; - -import java.util.concurrent.TimeUnit; - -import static software.bluelib.BlueLibConstants.SCHEDULER; /** * The main class of the {@link BlueLib} mod. @@ -30,9 +23,8 @@ * *

    * + * @author MeAlam, Dan and All Contributors of BlueLib! * @see BlueLib Wiki - * @author MeAlam, Dan - * @co-author All Contributors of BlueLib! * @since 1.0.0 */ @Mod(BlueLibConstants.MOD_ID) @@ -42,7 +34,6 @@ public class BlueLib { * Constructs a new {@link BlueLib} instance and registers the mod event bus. * * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public BlueLib() { @@ -55,7 +46,6 @@ public BlueLib() { * * @param pEvent {@link FMLLoadCompleteEvent} - The event fired after the mod loading process completes. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ @SubscribeEvent diff --git a/NeoForge/src/main/java/software/bluelib/BlueLib.java b/NeoForge/src/main/java/software/bluelib/BlueLib.java index 03f8ba47..ad53369f 100644 --- a/NeoForge/src/main/java/software/bluelib/BlueLib.java +++ b/NeoForge/src/main/java/software/bluelib/BlueLib.java @@ -7,14 +7,7 @@ import net.neoforged.fml.ModContainer; import net.neoforged.fml.common.Mod; import net.neoforged.fml.event.lifecycle.FMLLoadCompleteEvent; -import net.neoforged.fml.loading.FMLEnvironment; import org.spongepowered.asm.launch.MixinBootstrap; -import software.bluelib.utils.logging.BaseLogLevel; -import software.bluelib.utils.logging.BaseLogger; - -import java.util.concurrent.TimeUnit; - -import static software.bluelib.BlueLibConstants.SCHEDULER; /** * The main class of the {@code BlueLib} mod. @@ -30,9 +23,8 @@ * *

    * + * @author MeAlam, Dan and All Contributors of BlueLib! * @see BlueLib Wiki - * @author MeAlam, Dan - * @co-author All Contributors of BlueLib! * @since 1.0.0 */ @Mod(BlueLibConstants.MOD_ID) @@ -44,10 +36,9 @@ public class BlueLib { * Registers necessary mod event listeners, and if in developer mode, additional client-side listeners for rendering and attributes. *

    * - * @param pModEventBus {@link IEventBus} - The event bus where the mod registers its handlers. + * @param pModEventBus {@link IEventBus} - The event bus where the mod registers its handlers. * @param pModContainer {@link ModContainer} - The mod container that holds the instance of the mod. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public BlueLib(IEventBus pModEventBus, ModContainer pModContainer) { @@ -60,7 +51,6 @@ public BlueLib(IEventBus pModEventBus, ModContainer pModContainer) { * * @param pEvent {@link FMLLoadCompleteEvent} - The event fired after the mod loading process completes. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ @SubscribeEvent diff --git a/common/src/main/java/software/bluelib/BlueLibCommon.java b/common/src/main/java/software/bluelib/BlueLibCommon.java index e8921b59..fdc1d205 100644 --- a/common/src/main/java/software/bluelib/BlueLibCommon.java +++ b/common/src/main/java/software/bluelib/BlueLibCommon.java @@ -43,15 +43,14 @@ public static void init() { * * @return {@code true} if running in developer mode, {@code false} otherwise. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ static boolean isDeveloperMode() { boolean isDevMode = PLATFORM.isDevelopmentEnvironment(); if (isDevMode) { - BaseLogger.log(BaseLogLevel.INFO ,"Running in Developer mode.", true); + BaseLogger.log(BaseLogLevel.INFO, "Running in Developer mode.", true); } else { - BaseLogger.log(BaseLogLevel.INFO ,"Running in Production mode.", true); + BaseLogger.log(BaseLogLevel.INFO, "Running in Production mode.", true); } return isDevMode; } diff --git a/common/src/main/java/software/bluelib/BlueLibConstants.java b/common/src/main/java/software/bluelib/BlueLibConstants.java index 85821c46..c5934a6b 100644 --- a/common/src/main/java/software/bluelib/BlueLibConstants.java +++ b/common/src/main/java/software/bluelib/BlueLibConstants.java @@ -5,23 +5,31 @@ public class BlueLibConstants { - /** - * A {@code public static final} {@link ScheduledExecutorService} used to schedule tasks, such as printing messages after a delay. - *

    - * This executor runs tasks on a single thread to ensure delayed tasks run in a separate thread from the main thread. - *

    - * @co-author MeAlam, Dan - * @since 1.0.0 - */ - public static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(1); + /** + * A {@code public static final} {@link ScheduledExecutorService} used to schedule tasks, such as printing messages after a delay. + *

    + * This executor runs tasks on a single thread to ensure delayed tasks run in a separate thread from the main thread. + *

    + * + * @co-author MeAlam, Dan + * @since 1.0.0 + */ + public static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(1); - /** - * A {@code public static final} {@link String} representing the Mod ID for the {@code BlueLib} mod. - *

    This serves as a unique identifier for the mod.

    - * @co-author MeAlam, Dan - * @since 1.0.0 - */ - public static final String MOD_ID = "bluelib"; + /** + * A {@code public static final} {@link String} representing the Mod ID for the {@code BlueLib} mod. + *

    This serves as a unique identifier for the mod.

    + * + * @co-author MeAlam, Dan + * @since 1.0.0 + */ + public static final String MOD_ID = "bluelib"; - public static final String MOD_NAME = "BlueLib"; + /** + * A {@code public static final} {@link String} representing the Mod Name for the {@code BlueLib} mod. + * + * @co-author MeAlam, Dan + * @since 1.0.0 + */ + public static final String MOD_NAME = "BlueLib"; } \ No newline at end of file diff --git a/common/src/main/java/software/bluelib/entity/variant/VariantLoader.java b/common/src/main/java/software/bluelib/entity/variant/VariantLoader.java index ac421efd..af8e039e 100644 --- a/common/src/main/java/software/bluelib/entity/variant/VariantLoader.java +++ b/common/src/main/java/software/bluelib/entity/variant/VariantLoader.java @@ -29,8 +29,8 @@ *
  • {@link #getVariantsFromEntity(String)} - Retrieves the list of loaded {@link VariantParameter} for a specific entity.
  • *
  • {@link #getVariantByName(String, String)} - Retrieves a specific {@link VariantParameter} by its name for a given entity.
  • * + * * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public class VariantLoader implements IVariantEntityBase { @@ -40,6 +40,7 @@ public class VariantLoader implements IVariantEntityBase { *

    * This {@link Map} holds entity names and their corresponding list of {@link VariantParameter} instances. *

    + * * @co-author MeAlam, Dan * @since 1.0.0 */ @@ -47,6 +48,7 @@ public class VariantLoader implements IVariantEntityBase { /** * A {@code private static final} {@link JSONLoader} to load JSON data from resources. + * * @co-author MeAlam, Dan * @since 1.0.0 */ @@ -57,6 +59,7 @@ public class VariantLoader implements IVariantEntityBase { *

    * This {@link JSONMerger} instance is used to merge JSON data into a single {@link JsonObject}. *

    + * * @co-author MeAlam, Dan * @since 1.0.0 */ @@ -68,12 +71,13 @@ public class VariantLoader implements IVariantEntityBase { * The method loops through all resources in the folder and merges them into a single {@link JsonObject}.
    * The merged JSON data is then parsed into {@link VariantParameter} instances and stored in {@link #entityVariantsMap}. *

    - * @param folderPath {@link String} - The path to the folder containing JSON resources. - * @param pServer {@link MinecraftServer} - The {@link MinecraftServer} instance used to access resources. + * + * @param folderPath {@link String} - The path to the folder containing JSON resources. + * @param pServer {@link MinecraftServer} - The {@link MinecraftServer} instance used to access resources. * @param pEntityName {@link String} - The name of the entity whose variants should be cleared before loading new ones. */ public static void loadVariants(String folderPath, MinecraftServer pServer, String pEntityName) { - BaseLogger.log(BaseLogLevel.INFO,"Starting to load variants for entity: " + pEntityName); + BaseLogger.log(BaseLogLevel.INFO, "Starting to load variants for entity: " + pEntityName); clearVariantsForEntity(pEntityName); @@ -82,19 +86,19 @@ public static void loadVariants(String folderPath, MinecraftServer pServer, Stri Collection collection = resourceManager.listResources(folderPath, pFiles -> pFiles.getPath().endsWith(".json")).keySet(); - BaseLogger.log(BaseLogLevel.INFO,"Found resources: " + collection); + BaseLogger.log(BaseLogLevel.INFO, "Found resources: " + collection); for (ResourceLocation resourceLocation : collection) { try { - BaseLogger.log(BaseLogLevel.INFO,"Loading JSON data from resource: " + resourceLocation.toString()); + BaseLogger.log(BaseLogLevel.INFO, "Loading JSON data from resource: " + resourceLocation.toString()); JsonObject jsonObject = jsonLoader.loadJson(resourceLocation, resourceManager); jsonMerger.mergeJsonObjects(mergedJsonObject, jsonObject); } catch (Exception pException) { - BaseLogger.log(BaseLogLevel.ERROR,"Failed to load JSON data from resource: " + resourceLocation.toString(), pException); + BaseLogger.log(BaseLogLevel.ERROR, "Failed to load JSON data from resource: " + resourceLocation.toString(), pException); } } - BaseLogger.log(BaseLogLevel.INFO,"Successfully loaded and merged JSON data for entity: " + pEntityName); + BaseLogger.log(BaseLogLevel.INFO, "Successfully loaded and merged JSON data for entity: " + pEntityName); parseVariants(mergedJsonObject); } @@ -103,10 +107,11 @@ public static void loadVariants(String folderPath, MinecraftServer pServer, Stri *

    * This method removes all variants associated with the given entity name. *

    + * * @param pEntityName {@link String} - The name of the entity whose variants should be cleared. */ private static void clearVariantsForEntity(String pEntityName) { - BaseLogger.log(BaseLogLevel.INFO,"Clearing variants for entity: " + pEntityName); + BaseLogger.log(BaseLogLevel.INFO, "Clearing variants for entity: " + pEntityName); entityVariantsMap.remove(pEntityName); } @@ -115,6 +120,7 @@ private static void clearVariantsForEntity(String pEntityName) { *

    * This method processes each entry in the JSON object and stores the created {@link VariantParameter} instances in {@link #entityVariantsMap}. *

    + * * @param pJsonObject {@link JsonObject} - The merged {@link JsonObject} containing variant data. */ private static void parseVariants(JsonObject pJsonObject) { @@ -122,7 +128,7 @@ private static void parseVariants(JsonObject pJsonObject) { String entityName = entry.getKey(); JsonArray textureArray = entry.getValue().getAsJsonArray(); - BaseLogger.log(BaseLogLevel.INFO,"Parsing variants for entity: " + entityName); + BaseLogger.log(BaseLogLevel.INFO, "Parsing variants for entity: " + entityName); List variantList = entityVariantsMap.computeIfAbsent(entityName, k -> new ArrayList<>()); for (JsonElement variant : textureArray) { @@ -143,7 +149,8 @@ private static void parseVariants(JsonObject pJsonObject) { *

    * This method wraps the creation of {@link VariantParameter} instances for easier management and potential modification. *

    - * @param pJsonKey {@link String} - The key associated with this variant. + * + * @param pJsonKey {@link String} - The key associated with this variant. * @param pJsonObject {@link JsonObject} - The {@link JsonObject} containing the variant data. * @return {@link VariantParameter} - A {@link VariantParameter} instance. */ @@ -156,11 +163,12 @@ private static VariantParameter getEntityVariant(String pJsonKey, JsonObject pJs *

    * This method returns a list of variants for the given entity name. If no variants are found, an empty list is returned. *

    + * * @param pEntityName {@link String} - The name of the entity to retrieve variants for. * @return {@link List} - A {@link List} of {@link VariantParameter} instances for the specified entity. */ public static List getVariantsFromEntity(String pEntityName) { - BaseLogger.log(BaseLogLevel.INFO,"Retrieving variants for entity: " + pEntityName); + BaseLogger.log(BaseLogLevel.INFO, "Retrieving variants for entity: " + pEntityName); return entityVariantsMap.getOrDefault(pEntityName, new ArrayList<>()); } @@ -169,19 +177,20 @@ public static List getVariantsFromEntity(String pEntityName) { *

    * This method searches for a variant with the specified name within the list of variants for the given entity. *

    - * @param pEntityName {@link String} - The name of the entity to retrieve variants for. + * + * @param pEntityName {@link String} - The name of the entity to retrieve variants for. * @param pVariantName {@link String} - The name of the variant to retrieve. * @return {@link VariantParameter} - The {@link VariantParameter} with the specified name, or {@code null} if not found. */ public static VariantParameter getVariantByName(String pEntityName, String pVariantName) { - BaseLogger.log(BaseLogLevel.INFO,"Retrieving variant by name: " + pVariantName + " for entity: " + pEntityName); + BaseLogger.log(BaseLogLevel.INFO, "Retrieving variant by name: " + pVariantName + " for entity: " + pEntityName); List variants = getVariantsFromEntity(pEntityName); for (VariantParameter variant : variants) { if (variant.getVariantName().equals(pVariantName)) { return variant; } } - BaseLogger.log(BaseLogLevel.INFO,"Variant with name: " + pVariantName + " not found for entity: " + pEntityName); + BaseLogger.log(BaseLogLevel.INFO, "Variant with name: " + pVariantName + " not found for entity: " + pEntityName); return null; } } diff --git a/common/src/main/java/software/bluelib/entity/variant/VariantParameter.java b/common/src/main/java/software/bluelib/entity/variant/VariantParameter.java index 7069ef69..c5b4b01b 100644 --- a/common/src/main/java/software/bluelib/entity/variant/VariantParameter.java +++ b/common/src/main/java/software/bluelib/entity/variant/VariantParameter.java @@ -24,8 +24,8 @@ *
  • {@link #getVariantName()} - Retrieves the name of the variant.
  • *
  • {@link #getParameter(String)} - Retrieves the value of a specific parameter by its key.
  • * + * * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public class VariantParameter extends ParameterBase { @@ -35,6 +35,7 @@ public class VariantParameter extends ParameterBase { *

    * This key is used to map the entity to its corresponding parameters within a {@link JsonObject}. *

    + * * @co-author MeAlam, Dan * @since 1.0.0 */ @@ -51,29 +52,29 @@ public class VariantParameter extends ParameterBase { *
  • {@code Other Types}: Stores "null" for unhandled JSON types.
  • * *

    - * @param pJsonKey {@link String} - The key that identifies this entity within the {@link JsonObject}. + * + * @param pJsonKey {@link String} - The key that identifies this entity within the {@link JsonObject}. * @param pJsonObject {@link JsonObject} - The {@link JsonObject} containing the variant parameters. * @throws IllegalArgumentException if {@code pJsonKey} or {@code pJsonObject} is {@code null}. - * @see ParameterBase * @author MeAlam - * @co-author Dan + * @see ParameterBase * @since 1.0.0 */ public VariantParameter(String pJsonKey, JsonObject pJsonObject) { if (pJsonKey == null || pJsonObject == null) { Throwable throwable = new Throwable("JSON key or JSON object is null"); IllegalArgumentException exception = new IllegalArgumentException("JSON key and object must not be null"); - BaseLogger.log(BaseLogLevel.ERROR,exception.toString(), throwable); + BaseLogger.log(BaseLogLevel.ERROR, exception.toString(), throwable); throw exception; } this.jsonKey = pJsonKey; - BaseLogger.log(BaseLogLevel.INFO,"Creating VariantParameter with JSON key: " + pJsonKey); + BaseLogger.log(BaseLogLevel.INFO, "Creating VariantParameter with JSON key: " + pJsonKey); Set> entryMap = pJsonObject.entrySet(); for (Map.Entry entry : entryMap) { JsonElement element = entry.getValue(); if (element.isJsonPrimitive()) { addParameter(entry.getKey(), element.getAsString()); - BaseLogger.log(BaseLogLevel.SUCCESS,"Added primitive parameter: " + entry.getKey() + " = " + element.getAsString()); + BaseLogger.log(BaseLogLevel.SUCCESS, "Added primitive parameter: " + entry.getKey() + " = " + element.getAsString()); } else if (element.isJsonArray()) { StringBuilder arrayValues = new StringBuilder(); element.getAsJsonArray().forEach(e -> arrayValues.append(e.getAsString()).append(",")); @@ -81,13 +82,13 @@ public VariantParameter(String pJsonKey, JsonObject pJsonObject) { arrayValues.setLength(arrayValues.length() - 1); } addParameter(entry.getKey(), arrayValues.toString()); - BaseLogger.log(BaseLogLevel.SUCCESS,"Added array parameter: " + entry.getKey() + " = " + arrayValues.toString()); + BaseLogger.log(BaseLogLevel.SUCCESS, "Added array parameter: " + entry.getKey() + " = " + arrayValues.toString()); } else if (element.isJsonObject()) { addParameter(entry.getKey(), element.toString()); - BaseLogger.log(BaseLogLevel.SUCCESS,"Added object parameter: " + entry.getKey() + " = " + element.toString()); + BaseLogger.log(BaseLogLevel.SUCCESS, "Added object parameter: " + entry.getKey() + " = " + element.toString()); } else { addParameter(entry.getKey(), "null"); - BaseLogger.log(BaseLogLevel.SUCCESS,"Added null parameter for key: " + entry.getKey()); + BaseLogger.log(BaseLogLevel.SUCCESS, "Added null parameter for key: " + entry.getKey()); } } } @@ -97,10 +98,10 @@ public VariantParameter(String pJsonKey, JsonObject pJsonObject) { *

    * This key is used to retrieve or map the entity within a broader data structure. *

    + * * @return The key of the JSON object representing this entity. * @throws IllegalStateException if the key is unexpectedly {@code null}. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public String getJsonKey() { @@ -110,7 +111,7 @@ public String getJsonKey() { BaseLogger.log(BaseLogLevel.ERROR, "JSON key is unexpectedly null when retrieving from VariantParameter.", throwable); throw exception; } - BaseLogger.log(BaseLogLevel.INFO,"Retrieved JSON key: " + this.jsonKey); + BaseLogger.log(BaseLogLevel.INFO, "Retrieved JSON key: " + this.jsonKey); return this.jsonKey; } @@ -119,14 +120,14 @@ public String getJsonKey() { *

    * The variant name is expected to be stored under the key {@code "variantName"} in the parameters/JSON files. *

    + * * @return The name of the variant, or {@code null} if the variant name is not found. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public String getVariantName() { String variantName = getParameter("variantName"); - BaseLogger.log(BaseLogLevel.INFO,"Retrieved variant name: " + variantName); + BaseLogger.log(BaseLogLevel.INFO, "Retrieved variant name: " + variantName); return variantName; } @@ -135,15 +136,15 @@ public String getVariantName() { *

    * This method looks up the parameter's value within the internal data structure. *

    + * * @param pKey {@link String} - The key of the parameter to retrieve. * @return The value of the parameter, or {@code null} if the key does not exist. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public String getParameter(String pKey) { String value = (String) super.getParameter(pKey); - BaseLogger.log(BaseLogLevel.INFO,"Retrieved parameter for key " + pKey + ": " + value); + BaseLogger.log(BaseLogLevel.INFO, "Retrieved parameter for key " + pKey + ": " + value); return value; } } diff --git a/common/src/main/java/software/bluelib/entity/variant/base/ParameterBase.java b/common/src/main/java/software/bluelib/entity/variant/base/ParameterBase.java index 767fd17b..9769ac9f 100644 --- a/common/src/main/java/software/bluelib/entity/variant/base/ParameterBase.java +++ b/common/src/main/java/software/bluelib/entity/variant/base/ParameterBase.java @@ -29,8 +29,8 @@ *
  • {@link #getParameterValues()} - Returns a collection of all parameter values from {@link #parameters}.
  • *
  • {@link #updateParameter(String, Object)} - Updates the value of an existing parameter in {@link #parameters}.
  • * + * * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public abstract class ParameterBase { @@ -40,6 +40,7 @@ public abstract class ParameterBase { *

    * This {@link Map} holds parameter keys and their corresponding values. *

    + * * @co-author MeAlam, Dan * @since 1.0.0 */ @@ -50,10 +51,10 @@ public abstract class ParameterBase { *

    * This method stores a new parameter with the specified key and value in {@link #parameters}. *

    - * @param pKey {@link String} - The key under which the parameter is stored. + * + * @param pKey {@link String} - The key under which the parameter is stored. * @param pValue {@link Object} - The value of the parameter. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ protected void addParameter(String pKey, Object pValue) { @@ -66,10 +67,10 @@ protected void addParameter(String pKey, Object pValue) { *

    * This method returns the value associated with the specified key, or {@code null} if the key does not exist. *

    + * * @param pKey {@link String} - The key of the parameter to retrieve. * @return {@link Object} - The value associated with the key, or {@code null} if the key does not exist. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ protected Object getParameter(String pKey) { @@ -83,9 +84,9 @@ protected Object getParameter(String pKey) { *

    * This method deletes the parameter with the specified key from {@link #parameters}. If the key does not exist, no action is taken. *

    + * * @param pKey {@link String} - The key of the parameter to remove. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ protected void removeParameter(String pKey) { @@ -101,9 +102,9 @@ protected void removeParameter(String pKey) { *

    * This method returns a new {@link Map} containing all parameters stored in {@link #parameters}. *

    + * * @return {@link Map} - A {@link Map} containing all parameters. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ protected Map getAllParameters() { @@ -116,10 +117,10 @@ protected Map getAllParameters() { *

    * This method returns {@code true} if the parameter with the specified key exists in {@link #parameters}, {@code false} otherwise. *

    + * * @param pKey {@link String} - The key of the parameter to check. * @return {@link Boolean} - {@code true} if the parameter exists and {@code false} if it doesn't. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ protected boolean containsParameter(String pKey) { @@ -133,9 +134,9 @@ protected boolean containsParameter(String pKey) { *

    * This method returns {@code true} if {@link #parameters} contains no parameters, {@code false} otherwise. *

    + * * @return {@link Boolean} - {@code true} if {@link #parameters} is empty and {@code false} if it isn't. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ protected boolean isEmpty() { @@ -146,8 +147,8 @@ protected boolean isEmpty() { /** * A {@code protected void} that removes all parameters from {@link #parameters}. + * * @author MeAlam - * @co-author Dan * @since 1.0.0 */ protected void clearParameters() { @@ -157,9 +158,9 @@ protected void clearParameters() { /** * A {@code protected} {@link Integer} that returns the number of parameters in {@link #parameters}. + * * @return {@link Integer} - The number of parameters in the collection. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ protected int getParameterCount() { @@ -173,9 +174,9 @@ protected int getParameterCount() { *

    * This method provides a {@link Set} containing all the keys of parameters in {@link #parameters}. *

    + * * @return {@link Set} - A {@link Set} containing all parameter keys. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ protected Set getParameterKeys() { @@ -188,9 +189,9 @@ protected Set getParameterKeys() { *

    * This method provides a {@link Collection} containing all the values of parameters in {@link #parameters}. *

    + * * @return {@link Collection} - A {@link Collection} containing all parameter values. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ protected Collection getParameterValues() { @@ -203,11 +204,11 @@ protected Collection getParameterValues() { *

    * This method changes the value of a parameter in {@link #parameters} that is identified by the specified key. If the key does not exist, an exception is thrown. *

    - * @param pKey {@link String} - The key of the parameter to update. + * + * @param pKey {@link String} - The key of the parameter to update. * @param pNewValue {@link Object} - The new value to set for the parameter. * @throws IllegalArgumentException if the key does not exist. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ protected void updateParameter(String pKey, Object pNewValue) { diff --git a/common/src/main/java/software/bluelib/event/ReloadEventHandler.java b/common/src/main/java/software/bluelib/event/ReloadEventHandler.java index f590f02d..c9e3e8ce 100644 --- a/common/src/main/java/software/bluelib/event/ReloadEventHandler.java +++ b/common/src/main/java/software/bluelib/event/ReloadEventHandler.java @@ -20,11 +20,11 @@ *
  • {@link #registerEntityVariants(String, MinecraftServer, String, String)} - Registers entity variants from specified locations.
  • * *

    + * + * @author MeAlam * @see VariantLoader * @see MinecraftServer * @see ResourceLocation - * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public class ReloadEventHandler { @@ -51,31 +51,31 @@ public class ReloadEventHandler { *
  • {@link RuntimeException} - Thrown for unexpected errors during the registration process.
  • * *

    + * * @param pFolderPath {@link String} - The folder path location within the mod or datapack where variants are stored. - * @param pServer {@link MinecraftServer} - The server instance of the current world. - * @param pModID {@link String} - The mod ID used to locate the entity variant resources. (Use your Mod's ID) + * @param pServer {@link MinecraftServer} - The server instance of the current world. + * @param pModID {@link String} - The mod ID used to locate the entity variant resources. (Use your Mod's ID) * @param pEntityName {@link String} - The entity name to load. * @throws JsonParseException if there is an error parsing the JSON files. - * @throws RuntimeException if an unexpected error occurs during the registration process. + * @throws RuntimeException if an unexpected error occurs during the registration process. + * @author MeAlam * @see MinecraftServer * @see ResourceLocation * @see VariantLoader - * @author MeAlam - * @co-author Dan * @since 1.0.0 */ protected static void registerEntityVariants(String pFolderPath, MinecraftServer pServer, String pModID, String pEntityName) { - BaseLogger.log(BaseLogLevel.INFO,"Attempting to register entity variants for " + pEntityName + " with ModID: " + pModID); + BaseLogger.log(BaseLogLevel.INFO, "Attempting to register entity variants for " + pEntityName + " with ModID: " + pModID); try { VariantLoader.loadVariants(pFolderPath, pServer, pEntityName); - BaseLogger.log(BaseLogLevel.SUCCESS,"Successfully registered entity variants for " + pEntityName + " from ModID: " + pModID); + BaseLogger.log(BaseLogLevel.SUCCESS, "Successfully registered entity variants for " + pEntityName + " from ModID: " + pModID); } catch (JsonParseException pException) { - BaseLogger.log(BaseLogLevel.ERROR,"Failed to parse JSON(s) while registering entity variants for " + pEntityName + " from ModID: " + pModID, pException); + BaseLogger.log(BaseLogLevel.ERROR, "Failed to parse JSON(s) while registering entity variants for " + pEntityName + " from ModID: " + pModID, pException); throw pException; } catch (Exception pException) { - BaseLogger.log(BaseLogLevel.ERROR,"Unexpected error occurred while registering entity variants for " + pEntityName + " from ModID: " + pModID, pException); + BaseLogger.log(BaseLogLevel.ERROR, "Unexpected error occurred while registering entity variants for " + pEntityName + " from ModID: " + pModID, pException); throw pException; } } diff --git a/common/src/main/java/software/bluelib/interfaces/logging/ILogColorProvider.java b/common/src/main/java/software/bluelib/interfaces/logging/ILogColorProvider.java index 34ecbbdc..58dfb234 100644 --- a/common/src/main/java/software/bluelib/interfaces/logging/ILogColorProvider.java +++ b/common/src/main/java/software/bluelib/interfaces/logging/ILogColorProvider.java @@ -16,8 +16,8 @@ *
  • {@link #getColor(Level)} - Retrieves the color code associated with a specific {@link Level} of logging.
  • * *

    + * * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public interface ILogColorProvider { @@ -31,7 +31,6 @@ public interface ILogColorProvider { * @param pLevel {@link Level} - The log level for which to retrieve the color code. * @return The color code as a {@link String} for the specified log level. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ String getColor(Level pLevel); diff --git a/common/src/main/java/software/bluelib/interfaces/variant/IVariantEntity.java b/common/src/main/java/software/bluelib/interfaces/variant/IVariantEntity.java index f2a57fdd..8abb3471 100644 --- a/common/src/main/java/software/bluelib/interfaces/variant/IVariantEntity.java +++ b/common/src/main/java/software/bluelib/interfaces/variant/IVariantEntity.java @@ -21,14 +21,15 @@ *
  • {@link #getRandomVariant(List, String)} - Retrieves a random variant name from a provided list or defaults if the list is empty.
  • * *

    + * * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public interface IVariantEntity extends IVariantEntityBase { /** * A {@link RandomSource} instance used for generating random variants. + * * @co-author MeAlam, Dan * @since 1.0.0 */ @@ -42,20 +43,19 @@ public interface IVariantEntity extends IVariantEntityBase { *

    * * @param pVariantNamesList {@link List} - A {@link List} of variant names available for the entity. - * @param pDefaultVariant {@link String} - The default variant name to return if {@code pVariantNamesList} is empty. + * @param pDefaultVariant {@link String} - The default variant name to return if {@code pVariantNamesList} is empty. * @return A random variant name from the list, or the default variant if the list is empty. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ default String getRandomVariant(List pVariantNamesList, String pDefaultVariant) { if (pVariantNamesList.isEmpty()) { - BaseLogger.log(BaseLogLevel.INFO,"Variant names list is empty. Returning default variant: " + pDefaultVariant); + BaseLogger.log(BaseLogLevel.INFO, "Variant names list is empty. Returning default variant: " + pDefaultVariant); return pDefaultVariant; } int index = random.nextInt(pVariantNamesList.size()); String selectedVariant = pVariantNamesList.get(index); - BaseLogger.log(BaseLogLevel.SUCCESS,"Selected random variant: " + selectedVariant + " from list of size: " + pVariantNamesList.size()); + BaseLogger.log(BaseLogLevel.SUCCESS, "Selected random variant: " + selectedVariant + " from list of size: " + pVariantNamesList.size()); return selectedVariant; } } diff --git a/common/src/main/java/software/bluelib/interfaces/variant/base/IVariantEntityBase.java b/common/src/main/java/software/bluelib/interfaces/variant/base/IVariantEntityBase.java index 2e18ee26..d8c3f2e3 100644 --- a/common/src/main/java/software/bluelib/interfaces/variant/base/IVariantEntityBase.java +++ b/common/src/main/java/software/bluelib/interfaces/variant/base/IVariantEntityBase.java @@ -23,8 +23,8 @@ *
  • {@link #getEntityVariants(String)} - Retrieves a {@link List} of variant names for a specified entity.
  • * *

    + * * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public interface IVariantEntityBase { @@ -36,10 +36,9 @@ public interface IVariantEntityBase { *

    * * @param pModId {@link String} - The mod ID used to locate the texture. - * @param pPath {@link String} - The path to the texture within the mod. + * @param pPath {@link String} - The path to the texture within the mod. * @return A {@link ResourceLocation} pointing to the specified texture. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ default ResourceLocation getTextureLocation(String pModId, String pPath) { @@ -55,7 +54,6 @@ default ResourceLocation getTextureLocation(String pModId, String pPath) { * @param pEntityName {@link String} - The name of the entity whose variant names are to be retrieved. * @return A {@link List} containing the names of variants associated with the specified entity. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ default List getEntityVariants(String pEntityName) { @@ -63,7 +61,7 @@ default List getEntityVariants(String pEntityName) { List variantNames = variants.stream() .map(VariantParameter::getVariantName) .collect(Collectors.toList()); - BaseLogger.log(BaseLogLevel.SUCCESS,"Retrieved " + variantNames.size() + " variants for entity: " + pEntityName); + BaseLogger.log(BaseLogLevel.SUCCESS, "Retrieved " + variantNames.size() + " variants for entity: " + pEntityName); return variantNames; } } diff --git a/common/src/main/java/software/bluelib/json/JSONLoader.java b/common/src/main/java/software/bluelib/json/JSONLoader.java index f44a4c05..10b887ab 100644 --- a/common/src/main/java/software/bluelib/json/JSONLoader.java +++ b/common/src/main/java/software/bluelib/json/JSONLoader.java @@ -25,14 +25,15 @@ *
      *
    • {@link #loadJson(ResourceLocation, ResourceManager)} - Loads a JSON resource from the specified location.
    • *
    + * * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public class JSONLoader { /** * A {@code private static} {@link Gson} instance for parsing JSON data. + * * @co-author MeAlam, Dan */ private static final Gson gson = new Gson(); @@ -42,22 +43,22 @@ public class JSONLoader { * This method is typically used to load configuration files or other JSON-based resources * in a Minecraft mod environment. *

    + * * @param pResourceLocation {@link ResourceLocation} - The {@link ResourceLocation} of the JSON resource. - * @param pResourceManager {@link ResourceManager} - The {@link ResourceManager} used to load the resource. + * @param pResourceManager {@link ResourceManager} - The {@link ResourceManager} used to load the resource. * @return The loaded {@link JsonObject}. Returns an empty {@link JsonObject} if the resource is not found. * @throws RuntimeException if there is an error reading the resource. * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public JsonObject loadJson(ResourceLocation pResourceLocation, ResourceManager pResourceManager) { - BaseLogger.log(BaseLogLevel.INFO,"Attempting to load JSON resource: " + pResourceLocation); + BaseLogger.log(BaseLogLevel.INFO, "Attempting to load JSON resource: " + pResourceLocation); try { Optional resource = pResourceManager.getResource(pResourceLocation); if (resource.isEmpty()) { - BaseLogger.log(BaseLogLevel.ERROR,"Resource not found: " + pResourceLocation); + BaseLogger.log(BaseLogLevel.ERROR, "Resource not found: " + pResourceLocation); return new JsonObject(); } @@ -65,12 +66,12 @@ public JsonObject loadJson(ResourceLocation pResourceLocation, ResourceManager p InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { JsonObject jsonObject = gson.fromJson(reader, JsonObject.class); - BaseLogger.log(BaseLogLevel.SUCCESS,"Successfully loaded JSON resource: " + pResourceLocation); + BaseLogger.log(BaseLogLevel.SUCCESS, "Successfully loaded JSON resource: " + pResourceLocation); return jsonObject; } } catch (IOException pException) { RuntimeException exception = new RuntimeException("Failed to load JSON resource: " + pResourceLocation, pException); - BaseLogger.log(BaseLogLevel.ERROR,"Failed to load JSON resource: " + pResourceLocation, exception); + BaseLogger.log(BaseLogLevel.ERROR, "Failed to load JSON resource: " + pResourceLocation, exception); throw exception; } } diff --git a/common/src/main/java/software/bluelib/json/JSONMerger.java b/common/src/main/java/software/bluelib/json/JSONMerger.java index 5cde178c..d2adefde 100644 --- a/common/src/main/java/software/bluelib/json/JSONMerger.java +++ b/common/src/main/java/software/bluelib/json/JSONMerger.java @@ -23,8 +23,8 @@ *

  • {@link #mergeJsonObjects(JsonObject, JsonObject)} - Merges the data from the source JSON object into the target JSON object.
  • * *

    + * * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public class JSONMerger { @@ -40,7 +40,7 @@ public class JSONMerger { * @param pSource {@link JsonObject} - The source {@link JsonObject} to merge data from. This object is not modified by the operation. */ public void mergeJsonObjects(JsonObject pTarget, JsonObject pSource) { - BaseLogger.log(BaseLogLevel.INFO,"Starting JSON merge operation."); + BaseLogger.log(BaseLogLevel.INFO, "Starting JSON merge operation."); for (Map.Entry entry : pSource.entrySet()) { String key = entry.getKey(); @@ -57,17 +57,17 @@ public void mergeJsonObjects(JsonObject pTarget, JsonObject pSource) { targetArray.add(element); } - BaseLogger.log(BaseLogLevel.ERROR,"Merged array for key: " + key); + BaseLogger.log(BaseLogLevel.ERROR, "Merged array for key: " + key); } else { pTarget.add(key, sourceElement); - BaseLogger.log(BaseLogLevel.WARNING,"Overwriting value for key: " + key); + BaseLogger.log(BaseLogLevel.WARNING, "Overwriting value for key: " + key); } } else { pTarget.add(key, sourceElement); - BaseLogger.log(BaseLogLevel.SUCCESS,"Added new key: " + key); + BaseLogger.log(BaseLogLevel.SUCCESS, "Added new key: " + key); } } - BaseLogger.log(BaseLogLevel.SUCCESS,"JSON merge operation completed."); + BaseLogger.log(BaseLogLevel.SUCCESS, "JSON merge operation completed."); } } diff --git a/common/src/main/java/software/bluelib/mixin/variant/LivingEntityMixin.java b/common/src/main/java/software/bluelib/mixin/variant/LivingEntityMixin.java index 5298977c..7f6a67a4 100644 --- a/common/src/main/java/software/bluelib/mixin/variant/LivingEntityMixin.java +++ b/common/src/main/java/software/bluelib/mixin/variant/LivingEntityMixin.java @@ -39,6 +39,7 @@ public class LivingEntityMixin implements IVariantAccessor { /** * A {@link EntityDataAccessor} to hold the entity's variant name, which is synchronized * across clients and servers using {@link SynchedEntityData}. + * * @co-author MeAlam * @since 1.0.0 */ @@ -51,7 +52,7 @@ public class LivingEntityMixin implements IVariantAccessor { * the synchronized data that will hold the entity's variant information. * * @param pBuilder {@link SynchedEntityData.Builder} - The builder to define entity data. - * @param pCi {@link CallbackInfo} - Callback information for the injection process. + * @param pCi {@link CallbackInfo} - Callback information for the injection process. * @author MeAlam * @since 1.0.0 */ @@ -65,7 +66,7 @@ protected void defineSynchedData(SynchedEntityData.@NotNull Builder pBuilder, Ca * the entity's variant in NBT data when saving the entity. * * @param pCompound {@link CompoundTag} - The NBT tag to save the entity's variant information. - * @param pCi {@link CallbackInfo} - Callback information for the injection process. + * @param pCi {@link CallbackInfo} - Callback information for the injection process. * @author MeAlam * @since 1.0.0 */ @@ -79,7 +80,7 @@ public void addAdditionalSaveData(@NotNull CompoundTag pCompound, CallbackInfo p * the entity's variant from NBT data when loading the entity. * * @param pCompound {@link CompoundTag} - The NBT tag containing the entity's variant information. - * @param pCi {@link CallbackInfo} - Callback information for the injection process. + * @param pCi {@link CallbackInfo} - Callback information for the injection process. * @author MeAlam * @since 1.0.0 */ diff --git a/common/src/main/java/software/bluelib/utils/conversion/MathConverterUtils.java b/common/src/main/java/software/bluelib/utils/conversion/MathConverterUtils.java index 0d6f3707..7e98dd7c 100644 --- a/common/src/main/java/software/bluelib/utils/conversion/MathConverterUtils.java +++ b/common/src/main/java/software/bluelib/utils/conversion/MathConverterUtils.java @@ -23,6 +23,7 @@ *
  • {@link #stringToDate(String, String)} - Converts a string to a {@link Date} object.
  • *
  • {@link #dateToString(Date, String)} - Converts a {@link Date} object to a string.
  • * + * * @author MeAlam * @since 1.0.0 */ @@ -101,7 +102,7 @@ public static double milesToKilometers(double pMiles) { * A {@link Date} that converts a string to a {@link Date} object. * * @param pDateStr {@link String} - The date in string format (e.g., "yyyy-MM-dd"). - * @param pFormat {@link String} - The format of the input date string. + * @param pFormat {@link String} - The format of the input date string. * @return The corresponding {@code Date} object. * @throws ParseException if the string cannot be parsed. * @author MeAlam @@ -112,7 +113,7 @@ public static Date stringToDate(String pDateStr, String pFormat) throws ParseExc SimpleDateFormat formatter = new SimpleDateFormat(pFormat); return formatter.parse(pDateStr); } catch (ParseException pException) { - BaseLogger.log(BaseLogLevel.ERROR,"Error parsing date string: " + pDateStr + " with format: " + pFormat, pException); + BaseLogger.log(BaseLogLevel.ERROR, "Error parsing date string: " + pDateStr + " with format: " + pFormat, pException); throw pException; } } @@ -120,7 +121,7 @@ public static Date stringToDate(String pDateStr, String pFormat) throws ParseExc /** * A {@link String} that converts a {@link Date} object to a string in a specified format. * - * @param pDate {@link Date} - The date to be converted. + * @param pDate {@link Date} - The date to be converted. * @param pFormat {@link String} - The desired date format (e.g., "yyyy-MM-dd"). * @return The date as a string in the specified format. * @author MeAlam @@ -131,7 +132,7 @@ public static String dateToString(Date pDate, String pFormat) { SimpleDateFormat formatter = new SimpleDateFormat(pFormat); return formatter.format(pDate); } catch (Exception pException) { - BaseLogger.log(BaseLogLevel.ERROR,"Error formatting date: " + pDate.toString() + " with format: " + pFormat, pException); + BaseLogger.log(BaseLogLevel.ERROR, "Error formatting date: " + pDate.toString() + " with format: " + pFormat, pException); return pException.getMessage(); } } diff --git a/common/src/main/java/software/bluelib/utils/logging/BaseLogLevel.java b/common/src/main/java/software/bluelib/utils/logging/BaseLogLevel.java index de34f76b..8fb96380 100644 --- a/common/src/main/java/software/bluelib/utils/logging/BaseLogLevel.java +++ b/common/src/main/java/software/bluelib/utils/logging/BaseLogLevel.java @@ -16,40 +16,51 @@ *
  • {@link #SUCCESS} - Custom log level for indicating successful operations.
  • *
  • {@link #BLUELIB} - Custom log level specific to BlueLib.
  • * + * * @author MeAlam * @since 1.0.0 */ public class BaseLogLevel { /** * Standard informational log level. + * * @co-author MeAlam * @since 1.0.0 */ - public static final Level INFO = new Level("INFO", Level.INFO.intValue()) {}; + public static final Level INFO = new Level("INFO", Level.INFO.intValue()) { + }; /** * Log level for error messages. + * * @co-author MeAlam * @since 1.0.0 */ - public static final Level ERROR = new Level("ERROR", Level.SEVERE.intValue()) {}; + public static final Level ERROR = new Level("ERROR", Level.SEVERE.intValue()) { + }; /** * Log level for warning messages. + * * @co-author MeAlam * @since 1.0.0 */ - public static final Level WARNING = new Level("WARNING", Level.WARNING.intValue()) {}; + public static final Level WARNING = new Level("WARNING", Level.WARNING.intValue()) { + }; /** * Custom log level for indicating successful operations. + * * @co-author MeAlam * @since 1.0.0 */ - public static final Level SUCCESS = new Level("SUCCESS", Level.INFO.intValue() + 50) {}; + public static final Level SUCCESS = new Level("SUCCESS", Level.INFO.intValue() + 50) { + }; /** * Custom log level specific to BlueLib. + * * @co-author MeAlam * @since 1.0.0 */ - public static final Level BLUELIB = new Level("BlueLib Developer", Level.INFO.intValue() + 50) {}; + public static final Level BLUELIB = new Level("BlueLib Developer", Level.INFO.intValue() + 50) { + }; } diff --git a/common/src/main/java/software/bluelib/utils/logging/BaseLogger.java b/common/src/main/java/software/bluelib/utils/logging/BaseLogger.java index 4b2d3bc5..bc3cb296 100644 --- a/common/src/main/java/software/bluelib/utils/logging/BaseLogger.java +++ b/common/src/main/java/software/bluelib/utils/logging/BaseLogger.java @@ -23,13 +23,13 @@ * * * @author MeAlam - * @co-author Dan * @since 1.0.0 */ public class BaseLogger { /** * A {@link Logger} instance for logging messages. + * * @co-author MeAlam * @since 1.0.0 */ @@ -38,6 +38,7 @@ public class BaseLogger { //FIXME: Set to false before release /** * A {@link Boolean} to enable or disable BlueLib specific logging. + * * @co-author MeAlam * @since 1.0.0 */ @@ -45,6 +46,7 @@ public class BaseLogger { /** * A {@link Boolean} to enable or disable general logging. + * * @co-author MeAlam * @since 1.0.0 */ @@ -101,8 +103,8 @@ public static void setLoggingEnabled(boolean pEnabled) { /** * A {@code void} that logs a message with an associated {@link Throwable} if {@code BlueLib} logging is enabled. * - * @param pLogLevel {@link Level} - The logging level to use. - * @param pMessage {@link String} - The message to log. + * @param pLogLevel {@link Level} - The logging level to use. + * @param pMessage {@link String} - The message to log. * @param pThrowable {@link Throwable} - The throwable to log with the message. * @param pIsBlueLib {@link boolean} - Indicates if the message is {@code BlueLib} specific. * @co-author MeAlam @@ -117,8 +119,8 @@ public static void log(Level pLogLevel, String pMessage, Throwable pThrowable, b /** * A {@code void} that logs a message if BlueLib logging is enabled. * - * @param pLogLevel {@link Level} - The logging level to use. - * @param pMessage {@link String} - The message to log. + * @param pLogLevel {@link Level} - The logging level to use. + * @param pMessage {@link String} - The message to log. * @param pIsBlueLib {@link boolean} - Indicates if the message is {@code BlueLib} specific. * @co-author MeAlam * @since 1.0.0 @@ -132,8 +134,8 @@ public static void log(Level pLogLevel, String pMessage, boolean pIsBlueLib) { /** * A {@code void} that logs a message with an associated {@link Throwable} if general logging is enabled. * - * @param pLogLevel {@link Level} - The logging level to use. - * @param pMessage {@link String} - The message to log. + * @param pLogLevel {@link Level} - The logging level to use. + * @param pMessage {@link String} - The message to log. * @param pThrowable {@link Throwable} - The throwable to log with the message. * @co-author MeAlam * @since 1.0.0 @@ -148,7 +150,7 @@ public static void log(Level pLogLevel, String pMessage, Throwable pThrowable) { * A {@code void} that logs a message if general logging is enabled. * * @param pLogLevel {@link Level} - The logging level to use. - * @param pMessage {@link String} - The message to log. + * @param pMessage {@link String} - The message to log. * @co-author MeAlam * @since 1.0.0 */ diff --git a/common/src/main/java/software/bluelib/utils/logging/DefaultLogColorProvider.java b/common/src/main/java/software/bluelib/utils/logging/DefaultLogColorProvider.java index 81d5f0a0..ede066e1 100644 --- a/common/src/main/java/software/bluelib/utils/logging/DefaultLogColorProvider.java +++ b/common/src/main/java/software/bluelib/utils/logging/DefaultLogColorProvider.java @@ -18,6 +18,7 @@ *
  • {@link BaseLogLevel#SUCCESS} - Green color.
  • *
  • {@link BaseLogLevel#BLUELIB} - Green color.
  • * + * * @author MeAlam * @since 1.0.0 */ diff --git a/common/src/main/java/software/bluelib/utils/logging/LoggerConfig.java b/common/src/main/java/software/bluelib/utils/logging/LoggerConfig.java index 0c794f21..c9b679f3 100644 --- a/common/src/main/java/software/bluelib/utils/logging/LoggerConfig.java +++ b/common/src/main/java/software/bluelib/utils/logging/LoggerConfig.java @@ -28,6 +28,7 @@ public abstract class LoggerConfig { /** * ANSI color codes for console output. + * * @co-author MeAlam * @since 1.0.0 */ @@ -35,6 +36,7 @@ public abstract class LoggerConfig { /** * ANSI color codes for console output. + * * @co-author MeAlam * @since 1.0.0 */ @@ -42,6 +44,7 @@ public abstract class LoggerConfig { /** * ANSI color codes for console output. + * * @co-author MeAlam * @since 1.0.0 */ @@ -49,6 +52,7 @@ public abstract class LoggerConfig { /** * ANSI color codes for console output. + * * @co-author MeAlam * @since 1.0.0 */ @@ -56,6 +60,7 @@ public abstract class LoggerConfig { /** * ANSI color codes for console output. + * * @co-author MeAlam * @since 1.0.0 */ @@ -65,7 +70,7 @@ public abstract class LoggerConfig { * A {@link Logger} configuration method that sets up a {@link ConsoleHandler} * with custom color formatting based on log level using the provided {@link ILogColorProvider}. * - * @param pLogger {@link Logger} - The logger instance to be configured. + * @param pLogger {@link Logger} - The logger instance to be configured. * @param pColorProvider {@link ILogColorProvider} - Provides color codes for different log levels. * @author MeAlam * @since 1.0.0 diff --git a/common/src/main/java/software/bluelib/utils/math/AlgebraicUtils.java b/common/src/main/java/software/bluelib/utils/math/AlgebraicUtils.java index 2ed8a4e6..b4156484 100644 --- a/common/src/main/java/software/bluelib/utils/math/AlgebraicUtils.java +++ b/common/src/main/java/software/bluelib/utils/math/AlgebraicUtils.java @@ -20,6 +20,7 @@ *
  • {@link #calculateGCD(int, int)} - Calculates the greatest common divisor of two integers.
  • *
  • {@link #generatePowerSet(Set)} - Generates the power set of a given set.
  • * + * * @author MeAlam * @since 1.0.0 */ @@ -40,7 +41,7 @@ public static double[] solveQuadraticEquation(double pA, double pB, double pC) { double discriminant = pB * pB - 4 * pA * pC; if (discriminant < 0) { - BaseLogger.log(BaseLogLevel.WARNING,"No real roots found for the quadratic equation."); + BaseLogger.log(BaseLogLevel.WARNING, "No real roots found for the quadratic equation."); return new double[0]; } @@ -48,8 +49,8 @@ public static double[] solveQuadraticEquation(double pA, double pB, double pC) { double root1 = (-pB + sqrtDiscriminant) / (2 * pA); double root2 = (-pB - sqrtDiscriminant) / (2 * pA); - BaseLogger.log(BaseLogLevel.INFO,"Roots found: root1=" + root1 + ", root2=" + root2); - return new double[] { root1, root2 }; + BaseLogger.log(BaseLogLevel.INFO, "Roots found: root1=" + root1 + ", root2=" + root2); + return new double[]{root1, root2}; } /** @@ -64,7 +65,7 @@ public static double[] solveQuadraticEquation(double pA, double pB, double pC) { public static long factorial(int pNumber) { if (pNumber < 0) { IllegalArgumentException exception = new IllegalArgumentException("Number must be non-negative."); - BaseLogger.log(BaseLogLevel.INFO,"Attempted to calculate factorial of a negative number: " + pNumber, exception); + BaseLogger.log(BaseLogLevel.INFO, "Attempted to calculate factorial of a negative number: " + pNumber, exception); throw exception; } @@ -73,7 +74,7 @@ public static long factorial(int pNumber) { result *= i; } - BaseLogger.log(BaseLogLevel.SUCCESS,"Factorial of " + pNumber + " is " + result); + BaseLogger.log(BaseLogLevel.SUCCESS, "Factorial of " + pNumber + " is " + result); return result; } @@ -94,7 +95,7 @@ public static int calculateGCD(int pA, int pB) { pA = temp; } - BaseLogger.log(BaseLogLevel.SUCCESS,"GCD found: " + pA); + BaseLogger.log(BaseLogLevel.SUCCESS, "GCD found: " + pA); return pA; } @@ -102,7 +103,7 @@ public static int calculateGCD(int pA, int pB) { * A {@link List} that generates the power set (all subsets) of a given set. * * @param pSet {@link Set} - The input set. - * @param The type of elements in the set. + * @param The type of elements in the set. * @return A list of all subsets of the input set. * @author MeAlam * @since 1.0.0 @@ -121,7 +122,7 @@ public static List> generatePowerSet(Set pSet) { powerSet.addAll(newSubsets); } - BaseLogger.log(BaseLogLevel.SUCCESS,"Power set generated with " + powerSet.size() + " subsets."); + BaseLogger.log(BaseLogLevel.SUCCESS, "Power set generated with " + powerSet.size() + " subsets."); return powerSet; } } diff --git a/common/src/main/java/software/bluelib/utils/math/GeometricUtils.java b/common/src/main/java/software/bluelib/utils/math/GeometricUtils.java index a1bca98f..e71ba71e 100644 --- a/common/src/main/java/software/bluelib/utils/math/GeometricUtils.java +++ b/common/src/main/java/software/bluelib/utils/math/GeometricUtils.java @@ -23,6 +23,7 @@ *
  • {@link #calculateCylinderVolume(double, double)} - Calculates the volume of a cylinder given its radius and height.
  • *
  • {@link #calculateConeSurfaceArea(double, double)} - Calculates the surface area of a cone given its radius and slant height.
  • * + * * @author MeAlam * @since 1.0.0 */ @@ -76,7 +77,7 @@ public static double calculateDistance3D(double pX1, double pY1, double pZ1, dou public static double calculateCircleArea(double pRadius) { if (pRadius < 0) { Throwable throwable = new IllegalArgumentException("Radius must be non-negative."); - BaseLogger.log(BaseLogLevel.ERROR,"Error calculating circle area", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error calculating circle area", throwable); return Double.NaN; } return Math.PI * pRadius * pRadius; @@ -93,7 +94,7 @@ public static double calculateCircleArea(double pRadius) { public static double calculateCircleCircumference(double pRadius) { if (pRadius < 0) { Throwable throwable = new IllegalArgumentException("Radius must be non-negative."); - BaseLogger.log(BaseLogLevel.ERROR,"Error calculating circle circumference", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error calculating circle circumference", throwable); return Double.NaN; } return 2 * Math.PI * pRadius; @@ -102,7 +103,7 @@ public static double calculateCircleCircumference(double pRadius) { /** * A {@link Double} that calculates the area of a rectangle given its width and height. * - * @param pWidth {@link Double} - The width of the rectangle. + * @param pWidth {@link Double} - The width of the rectangle. * @param pHeight {@link Double} - The height of the rectangle. * @return The area of the rectangle. * @author MeAlam @@ -111,7 +112,7 @@ public static double calculateCircleCircumference(double pRadius) { public static double calculateRectangleArea(double pWidth, double pHeight) { if (pWidth < 0 || pHeight < 0) { Throwable throwable = new IllegalArgumentException("Width and height must be non-negative."); - BaseLogger.log(BaseLogLevel.ERROR,"Error calculating rectangle area", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error calculating rectangle area", throwable); return Double.NaN; } return pWidth * pHeight; @@ -120,7 +121,7 @@ public static double calculateRectangleArea(double pWidth, double pHeight) { /** * A {@link Double} that calculates the perimeter of a rectangle given its width and height. * - * @param pWidth {@link Double} - The width of the rectangle. + * @param pWidth {@link Double} - The width of the rectangle. * @param pHeight {@link Double} - The height of the rectangle. * @return The perimeter of the rectangle. * @author MeAlam @@ -129,7 +130,7 @@ public static double calculateRectangleArea(double pWidth, double pHeight) { public static double calculateRectanglePerimeter(double pWidth, double pHeight) { if (pWidth < 0 || pHeight < 0) { Throwable throwable = new IllegalArgumentException("Width and height must be non-negative."); - BaseLogger.log(BaseLogLevel.ERROR,"Error calculating rectangle perimeter", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error calculating rectangle perimeter", throwable); return Double.NaN; } return 2 * (pWidth + pHeight); @@ -138,7 +139,7 @@ public static double calculateRectanglePerimeter(double pWidth, double pHeight) /** * A {@link Double} that calculates the area of a triangle given its base and height. * - * @param pBase {@link Double} - The base of the triangle. + * @param pBase {@link Double} - The base of the triangle. * @param pHeight {@link Double} - The height of the triangle. * @return The area of the triangle. * @since 1.0.0 @@ -146,7 +147,7 @@ public static double calculateRectanglePerimeter(double pWidth, double pHeight) public static double calculateTriangleArea(double pBase, double pHeight) { if (pBase < 0 || pHeight < 0) { Throwable throwable = new IllegalArgumentException("Base and height must be non-negative."); - BaseLogger.log(BaseLogLevel.ERROR,"Error calculating triangle area", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error calculating triangle area", throwable); return Double.NaN; } return 0.5 * pBase * pHeight; @@ -164,7 +165,7 @@ public static double calculateTriangleArea(double pBase, double pHeight) { public static double calculateTrianglePerimeter(double pSide1, double pSide2, double pSide3) { if (pSide1 < 0 || pSide2 < 0 || pSide3 < 0) { Throwable throwable = new IllegalArgumentException("Sides must be non-negative."); - BaseLogger.log(BaseLogLevel.ERROR,"Error calculating triangle perimeter", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error calculating triangle perimeter", throwable); return Double.NaN; } return pSide1 + pSide2 + pSide3; @@ -181,7 +182,7 @@ public static double calculateTrianglePerimeter(double pSide1, double pSide2, do public static double calculateSphereVolume(double pRadius) { if (pRadius < 0) { Throwable throwable = new IllegalArgumentException("Radius must be non-negative."); - BaseLogger.log(BaseLogLevel.ERROR,"Error calculating sphere volume", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error calculating sphere volume", throwable); return Double.NaN; } return (4.0 / 3.0) * Math.PI * Math.pow(pRadius, 3); @@ -198,7 +199,7 @@ public static double calculateSphereVolume(double pRadius) { public static double calculateCubeSurfaceArea(double pSideLength) { if (pSideLength < 0) { Throwable throwable = new IllegalArgumentException("Side length must be non-negative."); - BaseLogger.log(BaseLogLevel.ERROR,"Error calculating cube surface area", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error calculating cube surface area", throwable); return Double.NaN; } return 6 * Math.pow(pSideLength, 2); @@ -216,7 +217,7 @@ public static double calculateCubeSurfaceArea(double pSideLength) { public static double calculateCylinderVolume(double pRadius, double pHeight) { if (pRadius < 0 || pHeight < 0) { Throwable throwable = new IllegalArgumentException("Radius and height must be non-negative."); - BaseLogger.log(BaseLogLevel.ERROR,"Error calculating cylinder volume", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error calculating cylinder volume", throwable); return Double.NaN; } return Math.PI * Math.pow(pRadius, 2) * pHeight; @@ -225,7 +226,7 @@ public static double calculateCylinderVolume(double pRadius, double pHeight) { /** * A {@link Double} that calculates the surface area of a cone given its radius and slant height. * - * @param pRadius {@link Double} - The radius of the base of the cone. + * @param pRadius {@link Double} - The radius of the base of the cone. * @param pSlantHeight {@link Double} - The slant height of the cone. * @return The surface area of the cone. * @author MeAlam @@ -234,7 +235,7 @@ public static double calculateCylinderVolume(double pRadius, double pHeight) { public static double calculateConeSurfaceArea(double pRadius, double pSlantHeight) { if (pRadius < 0 || pSlantHeight < 0) { Throwable throwable = new IllegalArgumentException("Radius and slant height must be non-negative."); - BaseLogger.log(BaseLogLevel.ERROR,"Error calculating cone surface area", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error calculating cone surface area", throwable); return Double.NaN; } return Math.PI * pRadius * (pRadius + pSlantHeight); diff --git a/common/src/main/java/software/bluelib/utils/math/MatrixUtils.java b/common/src/main/java/software/bluelib/utils/math/MatrixUtils.java index 6f98d358..cde59e87 100644 --- a/common/src/main/java/software/bluelib/utils/math/MatrixUtils.java +++ b/common/src/main/java/software/bluelib/utils/math/MatrixUtils.java @@ -15,6 +15,7 @@ *
  • {@link #calculate2x2MatrixDeterminant(double[][])} - Calculates the determinant of a 2x2 matrix.
  • *
  • {@link #invert2x2Matrix(double[][])} - Calculates the inverse of a 2x2 matrix.
  • * + * * @author MeAlam * @since 1.0.0 */ @@ -36,7 +37,7 @@ public static double[][] multiplyMatrices(double[][] pMatrixA, double[][] pMatri int colsB = pMatrixB[0].length; if (colsA != pMatrixB.length) { Throwable throwable = new IllegalArgumentException("Number of columns in the first matrix must be equal to the number of rows in the second matrix."); - BaseLogger.log(BaseLogLevel.ERROR,"Error performing matrix multiplication", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error performing matrix multiplication", throwable); return new double[0][0]; } double[][] result = new double[rowsA][colsB]; @@ -82,7 +83,7 @@ public static double[][] transposeMatrix(double[][] pMatrix) { public static double calculate2x2MatrixDeterminant(double[][] pMatrix) { if (pMatrix.length != 2 || pMatrix[0].length != 2) { Throwable throwable = new IllegalArgumentException("Matrix must be 2x2."); - BaseLogger.log(BaseLogLevel.ERROR,"Error calculating 2x2 matrix determinant", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error calculating 2x2 matrix determinant", throwable); return Double.NaN; } return pMatrix[0][0] * pMatrix[1][1] - pMatrix[0][1] * pMatrix[1][0]; @@ -100,13 +101,13 @@ public static double calculate2x2MatrixDeterminant(double[][] pMatrix) { public static double[][] invert2x2Matrix(double[][] pMatrix) { if (pMatrix.length != 2 || pMatrix[0].length != 2) { Throwable throwable = new IllegalArgumentException("Matrix must be 2x2."); - BaseLogger.log(BaseLogLevel.ERROR,"Error inverting 2x2 matrix", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error inverting 2x2 matrix", throwable); return new double[0][0]; } double determinant = calculate2x2MatrixDeterminant(pMatrix); if (determinant == 0) { Throwable throwable = new IllegalArgumentException("Matrix is not invertible."); - BaseLogger.log(BaseLogLevel.ERROR,"Error inverting 2x2 matrix", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error inverting 2x2 matrix", throwable); return new double[0][0]; } double[][] inverse = new double[2][2]; diff --git a/common/src/main/java/software/bluelib/utils/math/MiscUtils.java b/common/src/main/java/software/bluelib/utils/math/MiscUtils.java index b1bbd8ad..8f576256 100644 --- a/common/src/main/java/software/bluelib/utils/math/MiscUtils.java +++ b/common/src/main/java/software/bluelib/utils/math/MiscUtils.java @@ -15,6 +15,7 @@ *
  • {@link #calculateLevenshteinDistance(String, String)} - Calculates the Levenshtein distance between two strings.
  • *
  • {@link #hexToRGB(String)} - Converts a hexadecimal color code to an RGB array.
  • * + * * @author MeAlam * @since 1.0.0 */ @@ -36,7 +37,7 @@ public static boolean isValidEmail(String pEmail) { /** * A {@link Integer} that converts a string to an integer, returning a default value if the string is not a valid integer. * - * @param pString {@link String} - The string to be converted. + * @param pString {@link String} - The string to be converted. * @param pDefaultValue {@link Integer} - The default value to return if the string is not a valid integer. * @return The integer value of the string, or {@code pDefaultValue} if the string is not a valid integer. * @author MeAlam @@ -46,7 +47,7 @@ public static int stringToIntWithDefault(String pString, int pDefaultValue) { try { return Integer.parseInt(pString); } catch (NumberFormatException pException) { - BaseLogger.log(BaseLogLevel.ERROR,"Error converting string to integer", pException); + BaseLogger.log(BaseLogLevel.ERROR, "Error converting string to integer", pException); return pDefaultValue; } } @@ -92,7 +93,7 @@ public static int calculateLevenshteinDistance(String pStr1, String pStr2) { public static int[] hexToRGB(String pHex) { if (pHex == null || pHex.isEmpty()) { Throwable throwable = new IllegalArgumentException("Hex color code cannot be null or empty."); - BaseLogger.log(BaseLogLevel.ERROR,"Error converting hex to RGB", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error converting hex to RGB", throwable); return new int[]{0, 0, 0}; } if (pHex.charAt(0) == '#') { @@ -100,7 +101,7 @@ public static int[] hexToRGB(String pHex) { } if (pHex.length() != 6) { Throwable throwable = new IllegalArgumentException("Invalid hex color code."); - BaseLogger.log(BaseLogLevel.ERROR,"Error converting hex to RGB", throwable); + BaseLogger.log(BaseLogLevel.ERROR, "Error converting hex to RGB", throwable); return new int[]{0, 0, 0}; } try { @@ -109,7 +110,7 @@ public static int[] hexToRGB(String pHex) { int b = Integer.parseInt(pHex.substring(4, 6), 16); return new int[]{r, g, b}; } catch (NumberFormatException pException) { - BaseLogger.log(BaseLogLevel.ERROR,"Error parsing hex color code to RGB", pException); + BaseLogger.log(BaseLogLevel.ERROR, "Error parsing hex color code to RGB", pException); return new int[]{0, 0, 0}; } } diff --git a/common/src/main/java/software/bluelib/utils/math/RandomGenUtils.java b/common/src/main/java/software/bluelib/utils/math/RandomGenUtils.java index 1d0ebf7a..6fd69180 100644 --- a/common/src/main/java/software/bluelib/utils/math/RandomGenUtils.java +++ b/common/src/main/java/software/bluelib/utils/math/RandomGenUtils.java @@ -27,6 +27,7 @@ * or minimum values greater than maximum values) and returns default values (e.g., `0` for integers and `"unknown"` for strings) * in such cases. *

    + * * @author MeAlam * @since 1.0.0 */ @@ -44,10 +45,10 @@ public class RandomGenUtils { public static int generateRandomInt(int pMin, int pMax) { if (pMin > pMax) { Throwable throwable = new IllegalArgumentException("Minimum value must not be greater than maximum value."); - BaseLogger.log(BaseLogLevel.WARNING,"Error generating random integer", throwable); + BaseLogger.log(BaseLogLevel.WARNING, "Error generating random integer", throwable); return 0; } - return pMin + (int)(Math.random() * (pMax - pMin + 1)); + return pMin + (int) (Math.random() * (pMax - pMin + 1)); } /** @@ -62,7 +63,7 @@ public static int generateRandomInt(int pMin, int pMax) { public static double generateRandomDouble(double pMin, double pMax) { if (pMin > pMax) { Throwable throwable = new IllegalArgumentException("Minimum value must not be greater than maximum value."); - BaseLogger.log(BaseLogLevel.WARNING,"Error generating random double", throwable); + BaseLogger.log(BaseLogLevel.WARNING, "Error generating random double", throwable); return 0; } return pMin + Math.random() * (pMax - pMin); @@ -91,7 +92,7 @@ public static boolean generateRandomBoolean() { public static String generateRandomString(int pLength) { if (pLength < 0) { Throwable throwable = new IllegalArgumentException("Length must be non-negative."); - BaseLogger.log(BaseLogLevel.WARNING,"Error generating random string", throwable); + BaseLogger.log(BaseLogLevel.WARNING, "Error generating random string", throwable); return "unknown"; } String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; @@ -115,7 +116,7 @@ public static String generateRandomString(int pLength) { public static String generateRandomStringWithPrefix(String pPrefix, int pLength) { if (pLength < 0) { Throwable throwable = new IllegalArgumentException("Length must be non-negative."); - BaseLogger.log(BaseLogLevel.WARNING,"Error generating random string with prefix", throwable); + BaseLogger.log(BaseLogLevel.WARNING, "Error generating random string with prefix", throwable); return "unknown"; } return pPrefix + generateRandomString(pLength - pPrefix.length()); diff --git a/common/src/main/java/software/bluelib/utils/math/StatisticalUtils.java b/common/src/main/java/software/bluelib/utils/math/StatisticalUtils.java index e8690b26..144ba773 100644 --- a/common/src/main/java/software/bluelib/utils/math/StatisticalUtils.java +++ b/common/src/main/java/software/bluelib/utils/math/StatisticalUtils.java @@ -32,6 +32,7 @@ * Each method logs a success message with the computed value or a warning if the input array is empty. * The logging is done via {@link BaseLogger}, ensuring that any issues or results are recorded appropriately. *

    + * * @author MeAlam * @since 1.0.0 */ @@ -50,7 +51,7 @@ public class StatisticalUtils { */ public static double calculateMean(double[] pValues) { if (pValues.length == 0) { - BaseLogger.log(BaseLogLevel.WARNING,"Array is empty, mean calculation might fail."); + BaseLogger.log(BaseLogLevel.WARNING, "Array is empty, mean calculation might fail."); return 0; } @@ -59,7 +60,7 @@ public static double calculateMean(double[] pValues) { sum += value; } double mean = sum / pValues.length; - BaseLogger.log(BaseLogLevel.SUCCESS,"Mean successfully calculated: " + mean); + BaseLogger.log(BaseLogLevel.SUCCESS, "Mean successfully calculated: " + mean); return mean; } @@ -76,7 +77,7 @@ public static double calculateMean(double[] pValues) { */ public static double calculateMedian(double[] pValues) { if (pValues.length == 0) { - BaseLogger.log(BaseLogLevel.WARNING,"Array is empty, median calculation might fail."); + BaseLogger.log(BaseLogLevel.WARNING, "Array is empty, median calculation might fail."); return 0; } @@ -87,7 +88,7 @@ public static double calculateMedian(double[] pValues) { (sorted[middle - 1] + sorted[middle]) / 2.0 : sorted[middle]; - BaseLogger.log(BaseLogLevel.SUCCESS,"Median successfully calculated: " + median); + BaseLogger.log(BaseLogLevel.SUCCESS, "Median successfully calculated: " + median); return median; } @@ -104,7 +105,7 @@ public static double calculateMedian(double[] pValues) { */ public static double calculateMode(double[] pValues) { if (pValues.length == 0) { - BaseLogger.log(BaseLogLevel.WARNING,"Array is empty, mode calculation might fail."); + BaseLogger.log(BaseLogLevel.WARNING, "Array is empty, mode calculation might fail."); return 0; } @@ -122,7 +123,7 @@ public static double calculateMode(double[] pValues) { } } - BaseLogger.log(BaseLogLevel.SUCCESS,"Mode successfully calculated: " + mode); + BaseLogger.log(BaseLogLevel.SUCCESS, "Mode successfully calculated: " + mode); return mode; } @@ -139,7 +140,7 @@ public static double calculateMode(double[] pValues) { */ public static double calculateStandardDeviation(double[] pValues) { if (pValues.length == 0) { - BaseLogger.log(BaseLogLevel.WARNING,"Array is empty, standard deviation calculation might fail."); + BaseLogger.log(BaseLogLevel.WARNING, "Array is empty, standard deviation calculation might fail."); return 0; } @@ -149,7 +150,7 @@ public static double calculateStandardDeviation(double[] pValues) { sumSquaredDifferences += Math.pow(value - mean, 2); } double stdDev = Math.sqrt(sumSquaredDifferences / pValues.length); - BaseLogger.log(BaseLogLevel.SUCCESS,"Standard deviation successfully calculated: " + stdDev); + BaseLogger.log(BaseLogLevel.SUCCESS, "Standard deviation successfully calculated: " + stdDev); return stdDev; } @@ -166,7 +167,7 @@ public static double calculateStandardDeviation(double[] pValues) { */ public static double calculateVariance(double[] pValues) { if (pValues.length == 0) { - BaseLogger.log(BaseLogLevel.WARNING,"Array is empty, variance calculation might fail."); + BaseLogger.log(BaseLogLevel.WARNING, "Array is empty, variance calculation might fail."); return 0; } @@ -176,7 +177,7 @@ public static double calculateVariance(double[] pValues) { sumSquaredDifferences += Math.pow(value - mean, 2); } double variance = sumSquaredDifferences / pValues.length; - BaseLogger.log(BaseLogLevel.SUCCESS,"Variance successfully calculated: " + variance); + BaseLogger.log(BaseLogLevel.SUCCESS, "Variance successfully calculated: " + variance); return variance; } @@ -193,14 +194,14 @@ public static double calculateVariance(double[] pValues) { */ public static double calculateRange(double[] pValues) { if (pValues.length == 0) { - BaseLogger.log(BaseLogLevel.WARNING,"Array is empty, range calculation might fail."); + BaseLogger.log(BaseLogLevel.WARNING, "Array is empty, range calculation might fail."); return 0; } double max = Arrays.stream(pValues).max().orElseThrow(); double min = Arrays.stream(pValues).min().orElseThrow(); double range = max - min; - BaseLogger.log(BaseLogLevel.SUCCESS,"Range successfully calculated: " + range); + BaseLogger.log(BaseLogLevel.SUCCESS, "Range successfully calculated: " + range); return range; } @@ -217,14 +218,14 @@ public static double calculateRange(double[] pValues) { */ public static double calculateCoefficientOfVariation(double[] pValues) { if (pValues.length == 0) { - BaseLogger.log(BaseLogLevel.WARNING,"Array is empty, coefficient of variation calculation might fail."); + BaseLogger.log(BaseLogLevel.WARNING, "Array is empty, coefficient of variation calculation might fail."); return 0; } double mean = calculateMean(pValues); double stdDev = calculateStandardDeviation(pValues); double coefficient = (stdDev / mean) * 100; - BaseLogger.log(BaseLogLevel.SUCCESS,"Coefficient of variation successfully calculated: " + coefficient); + BaseLogger.log(BaseLogLevel.SUCCESS, "Coefficient of variation successfully calculated: " + coefficient); return coefficient; } } diff --git a/common/src/main/java/software/bluelib/utils/minecraft/ChunkUtils.java b/common/src/main/java/software/bluelib/utils/minecraft/ChunkUtils.java index f98a62b4..5d6f7efb 100644 --- a/common/src/main/java/software/bluelib/utils/minecraft/ChunkUtils.java +++ b/common/src/main/java/software/bluelib/utils/minecraft/ChunkUtils.java @@ -32,8 +32,9 @@ *
  • {@link #getChunkBlockCount(Level, ChunkPos)} - Counts the number of non-air blocks in the specified chunk.
  • * *

    - * @since 1.0.0 + * * @author MeAlam + * @since 1.0.0 */ public class ChunkUtils { @@ -44,7 +45,7 @@ public class ChunkUtils { * and an error message if an exception occurs. *

    * - * @param pLevel {@link Level} - The game world level. + * @param pLevel {@link Level} - The game world level. * @param pChunkPos {@link ChunkPos} - The position of the chunk. * @return The {@link Biome} associated with the specified chunk. * @throws RuntimeException if there is an error retrieving the biome. @@ -52,10 +53,10 @@ public class ChunkUtils { public static Biome getBiomeOfChunk(Level pLevel, ChunkPos pChunkPos) { try { Biome biome = pLevel.getBiome(pChunkPos.getWorldPosition()).value(); - BaseLogger.log(BaseLogLevel.INFO,"Retrieved biome for chunk at position " + pChunkPos + ": " + biome); + BaseLogger.log(BaseLogLevel.INFO, "Retrieved biome for chunk at position " + pChunkPos + ": " + biome); return biome; } catch (Exception pException) { - BaseLogger.log(BaseLogLevel.ERROR,"Error retrieving biome for chunk at position " + pChunkPos, pException); + BaseLogger.log(BaseLogLevel.ERROR, "Error retrieving biome for chunk at position " + pChunkPos, pException); throw pException; } } @@ -67,7 +68,7 @@ public static Biome getBiomeOfChunk(Level pLevel, ChunkPos pChunkPos) { * Example: "minecraft:plains", "minecraft:desert" *

    * - * @param pLevel {@link Level} - The game world level. + * @param pLevel {@link Level} - The game world level. * @param pChunkPos {@link ChunkPos} - The position of the chunk. * @return The registry name of the chunk's biome as a {@link String}. * @throws RuntimeException if there is an error retrieving the biome registry name. @@ -79,11 +80,11 @@ public static String getBiomeRegistryNameOfChunk(Level pLevel, ChunkPos pChunkPo if (biomeKey == null) { NullPointerException exception = new NullPointerException("Biome at chunk position " + pChunkPos + " is null"); - BaseLogger.log(BaseLogLevel.ERROR,"Error retrieving biome registry name of chunk at " + pChunkPos, exception); + BaseLogger.log(BaseLogLevel.ERROR, "Error retrieving biome registry name of chunk at " + pChunkPos, exception); return exception.getMessage(); } - BaseLogger.log(BaseLogLevel.SUCCESS,"Retrieved biome registry name for chunk at position " + pChunkPos + ": " + biomeKey); + BaseLogger.log(BaseLogLevel.SUCCESS, "Retrieved biome registry name for chunk at position " + pChunkPos + ": " + biomeKey); return biomeKey.toString(); } @@ -94,7 +95,7 @@ public static String getBiomeRegistryNameOfChunk(Level pLevel, ChunkPos pChunkPo * Example: "plains", "desert" *

    * - * @param pLevel {@link Level} - The game world level. + * @param pLevel {@link Level} - The game world level. * @param pChunkPos {@link ChunkPos} - The position of the chunk. * @return The simple name of the chunk's biome. */ @@ -110,7 +111,7 @@ public static String getBiomeSimpleNameOfChunk(Level pLevel, ChunkPos pChunkPos) * and an error message if an exception occurs. *

    * - * @param pLevel {@link Level} - The game world level. + * @param pLevel {@link Level} - The game world level. * @param pChunkPos {@link ChunkPos} - The position of the chunk. * @return A collection of tile entities present in the specified chunk. * @throws RuntimeException if there is an error retrieving tile entities. @@ -119,10 +120,10 @@ public static Collection getChunkTileEntities(Level pLevel, ChunkPo try { LevelChunk chunk = pLevel.getChunk(pChunkPos.x, pChunkPos.z); Collection tileEntities = chunk.getBlockEntities().values(); - BaseLogger.log(BaseLogLevel.INFO,"Retrieved " + tileEntities.size() + " tile entities for chunk at position " + pChunkPos); + BaseLogger.log(BaseLogLevel.INFO, "Retrieved " + tileEntities.size() + " tile entities for chunk at position " + pChunkPos); return tileEntities; } catch (Exception pException) { - BaseLogger.log(BaseLogLevel.ERROR,"Error retrieving tile entities for chunk at position " + pChunkPos, pException); + BaseLogger.log(BaseLogLevel.ERROR, "Error retrieving tile entities for chunk at position " + pChunkPos, pException); throw pException; } } @@ -134,7 +135,7 @@ public static Collection getChunkTileEntities(Level pLevel, ChunkPo * Example: "minecraft:chest, minecraft:furnace" *

    * - * @param pLevel {@link Level} - The game world level. + * @param pLevel {@link Level} - The game world level. * @param pChunkPos {@link ChunkPos} - The position of the chunk. * @return A comma-separated string of tile entity registry names in the chunk. * @throws RuntimeException if there is an error retrieving tile entity registry names. @@ -152,10 +153,10 @@ public static String getChunkTileEntitiesRegistryNames(Level pLevel, ChunkPos pC }) .collect(Collectors.joining(", ")); - BaseLogger.log(BaseLogLevel.INFO,"Tile entities for chunk at position " + pChunkPos + ": " + registryNames); + BaseLogger.log(BaseLogLevel.INFO, "Tile entities for chunk at position " + pChunkPos + ": " + registryNames); return registryNames; } catch (Exception pException) { - BaseLogger.log(BaseLogLevel.ERROR,"Error retrieving tile entity registry names for chunk at position " + pChunkPos, pException); + BaseLogger.log(BaseLogLevel.ERROR, "Error retrieving tile entity registry names for chunk at position " + pChunkPos, pException); throw pException; } } @@ -166,7 +167,7 @@ public static String getChunkTileEntitiesRegistryNames(Level pLevel, ChunkPos pC * Example: "chest, furnace" *

    * - * @param pLevel {@link Level} - The game world level. + * @param pLevel {@link Level} - The game world level. * @param pChunkPos {@link ChunkPos} - The position of the chunk. * @return A comma-separated string of tile entity simple names in the chunk. */ @@ -185,7 +186,7 @@ public static String getChunkTileEntitiesSimpleNames(Level pLevel, ChunkPos pChu * and an error message if an exception occurs. *

    * - * @param pLevel {@link Level} - The game world level. + * @param pLevel {@link Level} - The game world level. * @param pChunkPos {@link ChunkPos} - The position of the chunk. * @return The number of non-air blocks in the specified chunk. * @throws RuntimeException if there is an error counting blocks. @@ -206,25 +207,25 @@ public static int getChunkBlockCount(Level pLevel, ChunkPos pChunkPos) { } } - BaseLogger.log(BaseLogLevel.INFO,"Non-air block count for chunk at position " + pChunkPos + ": " + blockCount); + BaseLogger.log(BaseLogLevel.INFO, "Non-air block count for chunk at position " + pChunkPos + ": " + blockCount); return blockCount; } catch (Exception pException) { - BaseLogger.log(BaseLogLevel.ERROR,"Error counting blocks for chunk at position " + pChunkPos, pException); + BaseLogger.log(BaseLogLevel.ERROR, "Error counting blocks for chunk at position " + pChunkPos, pException); throw pException; } } /** FIXME: This method is not working as expected. It is not returning correctly. - public static boolean isChunkLoaded(final LevelAccessor pWorld, final int pX, final int pZ) { - try { - boolean isLoaded = pWorld.getChunk(pX, pZ, ChunkStatus.FULL, false) != null; - BaseLogger.bluelibLogSuccess("Chunk at (" + pX + ", " + pZ + ") is loaded: " + isLoaded); - return isLoaded; - } catch (Exception e) { - BaseLogger.logError("Error checking if chunk at (" + pX + ", " + pZ + ") is loaded", e); - return false; - } - } + public static boolean isChunkLoaded(final LevelAccessor pWorld, final int pX, final int pZ) { + try { + boolean isLoaded = pWorld.getChunk(pX, pZ, ChunkStatus.FULL, false) != null; + BaseLogger.bluelibLogSuccess("Chunk at (" + pX + ", " + pZ + ") is loaded: " + isLoaded); + return isLoaded; + } catch (Exception e) { + BaseLogger.logError("Error checking if chunk at (" + pX + ", " + pZ + ") is loaded", e); + return false; + } + } */ diff --git a/common/src/main/java/software/bluelib/utils/variant/ParameterUtils.java b/common/src/main/java/software/bluelib/utils/variant/ParameterUtils.java index 020bd929..495a71bd 100644 --- a/common/src/main/java/software/bluelib/utils/variant/ParameterUtils.java +++ b/common/src/main/java/software/bluelib/utils/variant/ParameterUtils.java @@ -30,11 +30,10 @@ * *

    * - * @since 1.0.0 * @author MeAlam - * @co-author Dan * @version 1.0.0 - * @see software.bluelib.entity.variant.VariantParameter + * @see VariantParameter + * @since 1.0.0 */ public class ParameterUtils { @@ -45,8 +44,8 @@ public class ParameterUtils { * representing custom parameters for that variant. *

    * - * @since 1.0.0 * @co-author MeAlam, Dan + * @since 1.0.0 */ private static final Map> variantParametersMap = new HashMap<>(); @@ -56,12 +55,11 @@ public class ParameterUtils { * If the parameter is not found, {@code null} is returned. *

    * - * @param pVariantName {@link String} The name of the variant. + * @param pVariantName {@link String} The name of the variant. * @param pParameterKey {@link String} The key of the parameter to retrieve. * @return {@link String} The value of the custom parameter for the specified variant or {@code null} if not found. - * @since 1.0.0 * @author MeAlam - * @co-author Dan + * @since 1.0.0 */ public static String getParameter(String pVariantName, String pParameterKey) { return variantParametersMap.getOrDefault(pVariantName, new HashMap<>()).getOrDefault(pParameterKey, "null"); @@ -81,44 +79,42 @@ public static String getParameter(String pVariantName, String pParameterKey) { * *

    * - * @since 1.0.0 * @author MeAlam - * @co-author Dan + * @since 1.0.0 */ public static class ParameterBuilder { /** * The name of the variant being associated with custom parameters. * - * @since 1.0.0 * @co-author MeAlam, Dan + * @since 1.0.0 */ private final String variantName; /** * The name of the entity being associated with custom parameters. * - * @since 1.0.0 * @co-author MeAlam, Dan + * @since 1.0.0 */ private final String entityName; /** * Stores custom parameters being built for the variant. * - * @since 1.0.0 * @co-author MeAlam, Dan + * @since 1.0.0 */ private final Map parameters = new HashMap<>(); /** * Constructor to initialize the builder for a specific entity and variant. * - * @param pEntityName {@link String} The name of the entity. + * @param pEntityName {@link String} The name of the entity. * @param pVariantName {@link String} The name of the variant. - * @since 1.0.0 * @author MeAlam - * @co-author Dan + * @since 1.0.0 */ private ParameterBuilder(String pEntityName, String pVariantName) { this.variantName = pVariantName; @@ -128,12 +124,11 @@ private ParameterBuilder(String pEntityName, String pVariantName) { /** * A {@link ParameterBuilder} that creates a new instance of {@link ParameterBuilder} for the specified entity and variant. * - * @param pEntityName {@link String} The name of the entity. + * @param pEntityName {@link String} The name of the entity. * @param pVariantName {@link String} The name of the variant. * @return {@link ParameterBuilder} A new instance for chaining. - * @since 1.0.0 * @author MeAlam - * @co-author Dan + * @since 1.0.0 */ public static ParameterBuilder forVariant(String pEntityName, String pVariantName) { return new ParameterBuilder(pEntityName, pVariantName); @@ -147,9 +142,8 @@ public static ParameterBuilder forVariant(String pEntityName, String pVariantNam * * @param pParameter {@link String} The parameter key. * @return {@link ParameterBuilder} The builder instance for chaining. - * @since 1.0.0 * @author MeAlam - * @co-author Dan + * @since 1.0.0 */ public ParameterBuilder withParameter(String pParameter) { parameters.put(pParameter, "null"); @@ -164,9 +158,8 @@ public ParameterBuilder withParameter(String pParameter) { * * @return {@link ParameterBuilder} The builder instance for chaining. * @throws NoSuchElementException if the variant or entity is not found in the database. - * @since 1.0.0 * @author MeAlam - * @co-author Dan + * @since 1.0.0 */ public ParameterBuilder connect() { VariantParameter variant = VariantLoader.getVariantByName(entityName, variantName);