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> </dependencies>
<build> <build>
<plugins><plugin> <plugins>
<groupId>org.apache.maven.plugins</groupId> <plugin>
<artifactId>maven-assembly-plugin</artifactId> <groupId>org.apache.maven.plugins</groupId>
<executions> <artifactId>maven-assembly-plugin</artifactId>
<execution> <executions>
<phase>package</phase> <execution>
<goals> <phase>package</phase>
<goal>single</goal> <goals>
</goals> <goal>single</goal>
<configuration> </goals>
<archive> <configuration>
<manifest> <archive>
<mainClass>wtf.beatrice.hidekobot.HidekoBot</mainClass> <manifest>
</manifest> <mainClass>wtf.beatrice.hidekobot.HidekoBot</mainClass>
</archive> </manifest>
<descriptorRefs> </archive>
<descriptorRef>jar-with-dependencies</descriptorRef> <descriptorRefs>
</descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef>
</configuration> </descriptorRefs>
</execution> </configuration>
</executions> </execution>
</plugin> </executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -30,7 +30,11 @@ public class Logger
className = logClass.getSimpleName(); 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) public void log(String message)
{ {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
@ -43,7 +47,12 @@ public class Logger
.replace("%message%", message)); .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) public void log(String message, int delay)
{ {
// create a new scheduled executor with an anonymous runnable... // 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) public void logRaw(String message)
{ {
System.out.println(message); System.out.println(message);
} }
/**
* Returns ASCII art saying the bot name.
*
* @return a String containing the logo
*/
public String getLogo() public String getLogo()
{ {
return logo; return logo;

View File

@ -6,6 +6,14 @@ public class RandomUtil
{ {
private static final Random random = new Random(); 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) public static int getRandomNumber(int min, int max)
{ {
if(min == max) return min; // dumbass if(min == max) return min; // dumbass