Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
wtlgo committed Mar 3, 2023
1 parent 4a08b99 commit 4675158
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/main/java/dev/mikchan/mcnp/chat/contract/IChatPluginFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
10 changes: 10 additions & 0 deletions src/main/java/dev/mikchan/mcnp/chat/contract/keys/IKey.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ package dev.mikchan.mcnp.chat.contract.keys
import org.bukkit.NamespacedKey
import org.bukkit.persistence.PersistentDataType

/**
* Key representation
*/
interface IKey<T> {
/**
* The key name
*/
val key: NamespacedKey

/**
* The key type
*/
val type: PersistentDataType<T, T>
}
6 changes: 6 additions & 0 deletions src/main/java/dev/mikchan/mcnp/chat/contract/keys/IKeys.kt
Original file line number Diff line number Diff line change
@@ -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<Byte>
}
33 changes: 33 additions & 0 deletions src/main/java/dev/mikchan/mcnp/chat/contract/log/IChatLogger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 4675158

Please # to comment.