From aa223df4808009ebffdf94418f9c86de9b79dedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beatrice=20Dellac=C3=A0?= Date: Fri, 26 Aug 2022 16:25:41 +0200 Subject: [PATCH] Implement JavaDocs JavaDocs can be generated with mvn javadoc:javadoc and will be available in target/site/apidocs. --- pom.xml | 51 +++++++++++-------- .../wtf/beatrice/hidekobot/utils/Logger.java | 24 +++++++-- .../beatrice/hidekobot/utils/RandomUtil.java | 8 +++ 3 files changed, 58 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index 8770d30..4c9baf2 100644 --- a/pom.xml +++ b/pom.xml @@ -33,28 +33,35 @@ - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - - wtf.beatrice.hidekobot.HidekoBot - - - - jar-with-dependencies - - - - - + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + + + wtf.beatrice.hidekobot.HidekoBot + + + + jar-with-dependencies + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.1 + diff --git a/src/main/java/wtf/beatrice/hidekobot/utils/Logger.java b/src/main/java/wtf/beatrice/hidekobot/utils/Logger.java index f819d4a..55bbf6c 100644 --- a/src/main/java/wtf/beatrice/hidekobot/utils/Logger.java +++ b/src/main/java/wtf/beatrice/hidekobot/utils/Logger.java @@ -30,7 +30,11 @@ public class Logger className = logClass.getSimpleName(); } - // log a message to console, with our chosen format + /** + * Logs a message to console, following a specific format. + * + * @param message the message to log + */ public void log(String message) { LocalDateTime now = LocalDateTime.now(); @@ -43,7 +47,12 @@ public class Logger .replace("%message%", message)); } - // log a message to console after delaying it (in seconds). + /** + * Logs a message to console, after delaying it. + * + * @param message the message to log + * @param delay the time to wait before logging, in seconds + */ public void log(String message, int delay) { // create a new scheduled executor with an anonymous runnable... @@ -52,12 +61,21 @@ public class Logger } - // avoid formatting the text and print whatever is passed. + /** + * Prints a message to console without any formatting. + * + * @param message the message to log + */ public void logRaw(String message) { System.out.println(message); } + /** + * Returns ASCII art saying the bot name. + * + * @return a String containing the logo + */ public String getLogo() { return logo; diff --git a/src/main/java/wtf/beatrice/hidekobot/utils/RandomUtil.java b/src/main/java/wtf/beatrice/hidekobot/utils/RandomUtil.java index 1a71c20..d8de632 100644 --- a/src/main/java/wtf/beatrice/hidekobot/utils/RandomUtil.java +++ b/src/main/java/wtf/beatrice/hidekobot/utils/RandomUtil.java @@ -6,6 +6,14 @@ public class RandomUtil { private static final Random random = new Random(); + + /** + * Returns a random integer picked in a range. + * + * @param min the minimum value (inclusive) + * @param max the maximum value (inclusive) + * @return a random number in range [min; max] + */ public static int getRandomNumber(int min, int max) { if(min == max) return min; // dumbass