From 46751586a44ef0db714ba4a7df07f43f0f2d1aee Mon Sep 17 00:00:00 2001 From: wtlgo Date: Fri, 3 Mar 2023 10:39:34 +0300 Subject: [PATCH] Add documentation --- .../mcnp/chat/contract/IChatPluginFactory.kt | 40 +++++++++++++++++++ .../mikchan/mcnp/chat/contract/keys/IKey.kt | 10 +++++ .../mikchan/mcnp/chat/contract/keys/IKeys.kt | 6 +++ .../mcnp/chat/contract/log/IChatLogger.kt | 33 +++++++++++++++ 4 files changed, 89 insertions(+) diff --git a/src/main/java/dev/mikchan/mcnp/chat/contract/IChatPluginFactory.kt b/src/main/java/dev/mikchan/mcnp/chat/contract/IChatPluginFactory.kt index bd2ebac..50ea6da 100644 --- a/src/main/java/dev/mikchan/mcnp/chat/contract/IChatPluginFactory.kt +++ b/src/main/java/dev/mikchan/mcnp/chat/contract/IChatPluginFactory.kt @@ -12,12 +12,52 @@ import dev.mikchan.mcnp.chat.contract.users.IUserManager * An abstract factory */ interface IChatPluginFactory { + /** + * Creates a configuration + * + * @return A new configuration object + */ fun createConfig(): IConfig + + /** + * Creates a command manager + * + * @return A new command manager + */ fun createCommandManager(): ICommandManager + + /** + * Creates an event manager + * + * @return A new event manager + */ fun createEventManager(): IEventManager + + /** + * Creates a formatter + * + * @return A new formatter + */ fun createFormatter(): IFormatter + + /** + * Creates a key store + * + * @return A new key store + */ fun createKeys(): IKeys + + /** + * Creates a user manager + * + * @return A new user manager + */ fun createUserManager(): IUserManager + /** + * Creates a chat logger + * + * @return A new chat logger + */ fun createChatLogger(): IChatLogger } diff --git a/src/main/java/dev/mikchan/mcnp/chat/contract/keys/IKey.kt b/src/main/java/dev/mikchan/mcnp/chat/contract/keys/IKey.kt index 3f40fdb..51ae3ad 100644 --- a/src/main/java/dev/mikchan/mcnp/chat/contract/keys/IKey.kt +++ b/src/main/java/dev/mikchan/mcnp/chat/contract/keys/IKey.kt @@ -3,7 +3,17 @@ package dev.mikchan.mcnp.chat.contract.keys import org.bukkit.NamespacedKey import org.bukkit.persistence.PersistentDataType +/** + * Key representation + */ interface IKey { + /** + * The key name + */ val key: NamespacedKey + + /** + * The key type + */ val type: PersistentDataType } diff --git a/src/main/java/dev/mikchan/mcnp/chat/contract/keys/IKeys.kt b/src/main/java/dev/mikchan/mcnp/chat/contract/keys/IKeys.kt index 6f2af76..bdb6338 100644 --- a/src/main/java/dev/mikchan/mcnp/chat/contract/keys/IKeys.kt +++ b/src/main/java/dev/mikchan/mcnp/chat/contract/keys/IKeys.kt @@ -1,5 +1,11 @@ package dev.mikchan.mcnp.chat.contract.keys +/** + * Namespaced keys collection interface + */ interface IKeys { + /** + * Namespaced key related to spy feature + */ val spy: IKey } diff --git a/src/main/java/dev/mikchan/mcnp/chat/contract/log/IChatLogger.kt b/src/main/java/dev/mikchan/mcnp/chat/contract/log/IChatLogger.kt index 0f2520d..4cf323d 100644 --- a/src/main/java/dev/mikchan/mcnp/chat/contract/log/IChatLogger.kt +++ b/src/main/java/dev/mikchan/mcnp/chat/contract/log/IChatLogger.kt @@ -2,9 +2,42 @@ package dev.mikchan.mcnp.chat.contract.log import org.bukkit.entity.Player +/** + * A chat logger interface + */ interface IChatLogger { + /** + * Logs global message + * + * @param player The player who sent the message + * @param message The message + */ fun logGlobal(player: Player, message: String) + + /** + * Logs local message + * + * @param player The player who sent the message + * @param message The message + */ fun logLocal(player: Player, message: String) + + /** + * Logs private message + * + * @param from The player who sent the message + * @param to The player who receives the message + * @param message The message + */ fun logPrivate(from: Player, to: Player, message: String) + + /** + * Logs console private message + * + * @param player The player which is related to this log + * @param fromConsole If `true` logs a `Console -> Player` type of message, + * and if `false` logs `Player -> Console` + * @param message The message + */ fun logConsole(player: Player, fromConsole: Boolean, message: String) }