Skip to content

Commit

Permalink
Add documentation on all public interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
wtlgo committed Jul 23, 2022
1 parent 7c09440 commit d89d354
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 2 deletions.
15 changes: 13 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id "java"
id "org.jetbrains.kotlin.jvm" version "1.7.10"
id 'org.jetbrains.dokka' version "1.7.10"
id 'maven-publish'
id "com.github.johnrengelman.shadow" version "7.1.2"
}
Expand Down Expand Up @@ -97,8 +98,14 @@ compileTestKotlin {
}
}

if (file("local.gradle").exists()) {
apply from: "local.gradle"
dokkaHtml {
outputDirectory.set(file("${buildDir}/dokka"))
}

javadocJar {
archiveClassifier.set("javadoc")
dependsOn("dokkaHtml")
from("$buildDir/dokka")
}

shadowJar {
Expand Down Expand Up @@ -135,3 +142,7 @@ publishing {
}
}
}

if (file("local.gradle").exists()) {
apply from: "local.gradle"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import org.bstats.bukkit.Metrics
import org.bukkit.event.HandlerList
import org.bukkit.plugin.java.JavaPlugin

/**
* The main plugin class
*/
@Suppress("unused")
class MaintenanceModePlugin : JavaPlugin(), IConfigListener {
companion object {
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/dev/mikchan/mcnp/maintenance/config/IConfig.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
package dev.mikchan.mcnp.maintenance.config

/**
* The config interface
*/
interface IConfig {
/**
* Is the maintenance mode enabled
*/
var enabled: Boolean

/**
* The message player sees when tries to connect to the server, while [enabled] is `true`
*/
val kickMessage: String

/**
* Should the server also display a custom MOTD when pinged while in maintenance mode
*/
val enableCustomMotd: Boolean

/**
* The MOTD which is displayed if [enabled] and [enableCustomMotd] are `true`
*/
val customMotd: String

/**
* Subscribes a new config listener.
*
* Whenever config is updated, [IConfigListener.handleUpdate] will be called on every listener.
*
* @param listener A listener to subscribe.
*/
fun subscribe(listener: IConfigListener)

/**
* Reloads the config from the file.
*/
fun reload()
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
package dev.mikchan.mcnp.maintenance.config

/**
* A config listener interface.
*
* Listens to config updates.
*/
interface IConfigListener {
/**
* This method is called whenever config is updated.
*
* @param config A new state of config.
*/
fun handleUpdate(config: IConfig)
}

0 comments on commit d89d354

Please sign in to comment.