-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation on all public interfaces
- Loading branch information
Showing
4 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/dev/mikchan/mcnp/maintenance/config/IConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/dev/mikchan/mcnp/maintenance/config/IConfigListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |