Implement JavaDocs
continuous-integration/drone/push Build is passing Details

JavaDocs can be generated with mvn javadoc:javadoc and will be available in target/site/apidocs.
This commit is contained in:
Bea 2022-08-26 16:25:41 +02:00
parent 70570624e1
commit aa223df480
3 changed files with 58 additions and 25 deletions

51
pom.xml
View File

@ -33,28 +33,35 @@
</dependencies>
<build>
<plugins><plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>wtf.beatrice.hidekobot.HidekoBot</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>wtf.beatrice.hidekobot.HidekoBot</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
</plugin>
</plugins>
</build>

View File

@ -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;

View File

@ -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