KDoc Formatting
This commit is contained in:
@@ -121,8 +121,8 @@ fun CommandBase.addSubcommand(
|
||||
}
|
||||
|
||||
/**
|
||||
* Kotlin builder for commands.
|
||||
* Inherits plugin, permission, players only.
|
||||
* Kotlin builder for commands. Inherits plugin, permission, players
|
||||
* only.
|
||||
*
|
||||
* @param name The command name.
|
||||
* @param init The builder.
|
||||
|
||||
@@ -4,9 +4,7 @@ package com.willfp.eco.core.config
|
||||
|
||||
import com.willfp.eco.core.config.interfaces.Config
|
||||
|
||||
/**
|
||||
* Helper class to create configs with a kotlin DSL.
|
||||
*/
|
||||
/** Helper class to create configs with a kotlin DSL. */
|
||||
class DSLConfig internal constructor(type: ConfigType) : TransientConfig(emptyMap(), type) {
|
||||
/**
|
||||
* Map a key to a value.
|
||||
|
||||
@@ -5,47 +5,33 @@ package com.willfp.eco.core.data
|
||||
import org.bukkit.persistence.PersistentDataContainer
|
||||
import org.bukkit.persistence.PersistentDataType
|
||||
|
||||
/**
|
||||
* @see ExtendedPersistentDataContainer.set
|
||||
*/
|
||||
/** @see ExtendedPersistentDataContainer.set */
|
||||
fun <T : Any, Z : Any> PersistentDataContainer.set(key: String, dataType: PersistentDataType<T, Z>, value: Z) =
|
||||
ExtendedPersistentDataContainer.extend(this).set(key, dataType, value)
|
||||
|
||||
/**
|
||||
* @see ExtendedPersistentDataContainer.has
|
||||
*/
|
||||
/** @see ExtendedPersistentDataContainer.has */
|
||||
fun <T : Any, Z : Any> PersistentDataContainer.has(key: String, dataType: PersistentDataType<T, Z>): Boolean =
|
||||
ExtendedPersistentDataContainer.extend(this).has(key, dataType)
|
||||
|
||||
/**
|
||||
* @see ExtendedPersistentDataContainer.get
|
||||
*/
|
||||
/** @see ExtendedPersistentDataContainer.get */
|
||||
fun <T : Any, Z : Any> PersistentDataContainer.get(key: String, dataType: PersistentDataType<T, Z>): Z? =
|
||||
ExtendedPersistentDataContainer.extend(this).get(key, dataType)
|
||||
|
||||
/**
|
||||
* @see ExtendedPersistentDataContainer.getOrDefault
|
||||
*/
|
||||
/** @see ExtendedPersistentDataContainer.getOrDefault */
|
||||
fun <T : Any, Z : Any> PersistentDataContainer.getOrDefault(
|
||||
key: String,
|
||||
dataType: PersistentDataType<T, Z>,
|
||||
defaultValue: Z
|
||||
): Z = ExtendedPersistentDataContainer.extend(this).getOrDefault(key, dataType, defaultValue)
|
||||
|
||||
/**
|
||||
* @see ExtendedPersistentDataContainer.getAllKeys
|
||||
*/
|
||||
/** @see ExtendedPersistentDataContainer.getAllKeys */
|
||||
fun PersistentDataContainer.getAllKeys(): Set<String> =
|
||||
ExtendedPersistentDataContainer.extend(this).allKeys
|
||||
|
||||
/**
|
||||
* @see ExtendedPersistentDataContainer.remove
|
||||
*/
|
||||
/** @see ExtendedPersistentDataContainer.remove */
|
||||
fun PersistentDataContainer.remove(key: String) =
|
||||
ExtendedPersistentDataContainer.extend(this).remove(key)
|
||||
|
||||
/**
|
||||
* Create a new PDC without the need for an adapter context.
|
||||
*/
|
||||
/** Create a new PDC without the need for an adapter context. */
|
||||
fun newPersistentDataContainer() =
|
||||
ExtendedPersistentDataContainer.create().base
|
||||
|
||||
@@ -5,14 +5,10 @@ package com.willfp.eco.core.data
|
||||
import org.bukkit.OfflinePlayer
|
||||
import org.bukkit.Server
|
||||
|
||||
/**
|
||||
* @see PlayerProfile.load
|
||||
*/
|
||||
/** @see PlayerProfile.load */
|
||||
val OfflinePlayer.profile: PlayerProfile
|
||||
get() = PlayerProfile.load(this)
|
||||
|
||||
/**
|
||||
* @see ServerProfile.load
|
||||
*/
|
||||
/** @see ServerProfile.load */
|
||||
val Server.profile: ServerProfile
|
||||
get() = ServerProfile.load()
|
||||
|
||||
@@ -5,8 +5,6 @@ package com.willfp.eco.core.entities
|
||||
import com.willfp.eco.core.entities.ai.EntityController
|
||||
import org.bukkit.entity.Mob
|
||||
|
||||
/**
|
||||
* @see EntityController.getFor
|
||||
*/
|
||||
/** @see EntityController.getFor */
|
||||
val <T : Mob> T.controller: EntityController<T>
|
||||
get() = EntityController.getFor(this)
|
||||
|
||||
@@ -4,8 +4,6 @@ package com.willfp.eco.core.fast
|
||||
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
||||
/**
|
||||
* @see FastItemStack.wrap
|
||||
*/
|
||||
/** @see FastItemStack.wrap */
|
||||
fun ItemStack.fast(): FastItemStack =
|
||||
FastItemStack.wrap(this)
|
||||
|
||||
@@ -4,9 +4,7 @@ package com.willfp.eco.core.integrations.economy
|
||||
|
||||
import org.bukkit.OfflinePlayer
|
||||
|
||||
/**
|
||||
* @see EconomyManager
|
||||
*/
|
||||
/** @see EconomyManager */
|
||||
var OfflinePlayer.balance: Double
|
||||
get() = EconomyManager.getBalance(this)
|
||||
set(value) {
|
||||
|
||||
@@ -6,21 +6,15 @@ import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.inventory.meta.ItemMeta
|
||||
import org.bukkit.persistence.PersistentDataContainer
|
||||
|
||||
/**
|
||||
* @see Items.toLookupString
|
||||
*/
|
||||
/** @see Items.toLookupString */
|
||||
fun ItemStack?.toLookupString(): String =
|
||||
Items.toLookupString(this)
|
||||
|
||||
/**
|
||||
* @see Items.mergeFrom
|
||||
*/
|
||||
/** @see Items.mergeFrom */
|
||||
fun ItemStack.mergeFrom(other: ItemStack): ItemStack =
|
||||
Items.mergeFrom(other, this)
|
||||
|
||||
/**
|
||||
* @see Items.mergeFrom
|
||||
*/
|
||||
/** @see Items.mergeFrom */
|
||||
fun ItemMeta.mergeFrom(other: ItemMeta): ItemMeta =
|
||||
Items.mergeFrom(other, this)
|
||||
|
||||
@@ -34,8 +28,6 @@ var ItemStack.baseNBT: PersistentDataContainer
|
||||
Items.setBaseNBT(this, value)
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Items.setBaseNBT
|
||||
*/
|
||||
/** @see Items.setBaseNBT */
|
||||
fun ItemStack.clearNBT() =
|
||||
Items.setBaseNBT(this, null)
|
||||
|
||||
@@ -5,8 +5,6 @@ package com.willfp.eco.util
|
||||
import org.bukkit.entity.Arrow
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
||||
/**
|
||||
* @see ArrowUtils.getBow
|
||||
*/
|
||||
/** @see ArrowUtils.getBow */
|
||||
val Arrow.bow: ItemStack?
|
||||
get() = ArrowUtils.getBow(this)
|
||||
|
||||
@@ -4,8 +4,6 @@ package com.willfp.eco.util
|
||||
|
||||
import org.bukkit.block.Block
|
||||
|
||||
/**
|
||||
* @see ArrowUtils.getBow
|
||||
*/
|
||||
/** @see ArrowUtils.getBow */
|
||||
val Block.isPlayerPlaced: Boolean
|
||||
get() = BlockUtils.isPlayerPlaced(this)
|
||||
|
||||
@@ -5,14 +5,10 @@ package com.willfp.eco.util
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
||||
/**
|
||||
* @see DurabilityUtils.damageItem
|
||||
*/
|
||||
/** @see DurabilityUtils.damageItem */
|
||||
fun ItemStack.damage(damage: Int) =
|
||||
DurabilityUtils.damageItem(this, damage)
|
||||
|
||||
/**
|
||||
* @see DurabilityUtils.damageItem
|
||||
*/
|
||||
/** @see DurabilityUtils.damageItem */
|
||||
fun ItemStack.damage(damage: Int, player: Player) =
|
||||
DurabilityUtils.damageItem(player, this, damage)
|
||||
|
||||
@@ -4,26 +4,18 @@ package com.willfp.eco.util
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
|
||||
/**
|
||||
* @see NamespacedKeyUtils.fromString
|
||||
*/
|
||||
/** @see NamespacedKeyUtils.fromString */
|
||||
fun namespacedKeyOf(string: String) =
|
||||
NamespacedKeyUtils.fromString(string)
|
||||
|
||||
/**
|
||||
* @see NamespacedKeyUtils.fromString
|
||||
*/
|
||||
/** @see NamespacedKeyUtils.fromString */
|
||||
fun safeNamespacedKeyOf(string: String) =
|
||||
NamespacedKeyUtils.fromStringOrNull(string)
|
||||
|
||||
/**
|
||||
* @see NamespacedKeyUtils.create
|
||||
*/
|
||||
/** @see NamespacedKeyUtils.create */
|
||||
fun namespacedKeyOf(namespace: String, key: String) =
|
||||
NamespacedKeyUtils.create(namespace, key)
|
||||
|
||||
/**
|
||||
* @see EcoPlugin.namespacedKeyFactory
|
||||
*/
|
||||
/** @see EcoPlugin.namespacedKeyFactory */
|
||||
fun namespacedKeyOf(plugin: EcoPlugin, key: String) =
|
||||
plugin.namespacedKeyFactory.create(key)
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
package com.willfp.eco.util
|
||||
|
||||
/**
|
||||
* @see NumberUtils.toNumeral
|
||||
*/
|
||||
/** @see NumberUtils.toNumeral */
|
||||
fun Number.toNumeral(): String =
|
||||
NumberUtils.toNumeral(this.toInt())
|
||||
|
||||
@@ -8,32 +8,22 @@ import org.bukkit.command.CommandSender
|
||||
import org.bukkit.entity.Entity
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
/**
|
||||
* @see PlayerUtils.getSavedDisplayName
|
||||
*/
|
||||
/** @see PlayerUtils.getSavedDisplayName */
|
||||
val OfflinePlayer.savedDisplayName: String
|
||||
get() = PlayerUtils.getSavedDisplayName(this)
|
||||
|
||||
/**
|
||||
* @see PlayerUtils.getAudience
|
||||
*/
|
||||
/** @see PlayerUtils.getAudience */
|
||||
fun Player.asAudience(): Audience =
|
||||
PlayerUtils.getAudience(this)
|
||||
|
||||
/**
|
||||
* @see PlayerUtils.getAudience
|
||||
*/
|
||||
/** @see PlayerUtils.getAudience */
|
||||
fun CommandSender.asAudience(): Audience =
|
||||
PlayerUtils.getAudience(this)
|
||||
|
||||
/**
|
||||
* @see PlayerUtils.runExempted
|
||||
*/
|
||||
/** @see PlayerUtils.runExempted */
|
||||
fun Player.runExempted(action: () -> Unit) =
|
||||
PlayerUtils.runExempted(this, action)
|
||||
|
||||
/**
|
||||
* @see PlayerUtils.tryAsPlayer
|
||||
*/
|
||||
/** @see PlayerUtils.tryAsPlayer */
|
||||
fun Entity?.tryAsPlayer(): Player? =
|
||||
PlayerUtils.tryAsPlayer(this)
|
||||
|
||||
@@ -4,8 +4,6 @@ package com.willfp.eco.util
|
||||
|
||||
import org.bukkit.potion.PotionData
|
||||
|
||||
/**
|
||||
* @see PotionData.duration
|
||||
*/
|
||||
/** @see PotionData.duration */
|
||||
val PotionData.duration: Int
|
||||
get() = PotionUtils.getDuration(this)
|
||||
|
||||
@@ -4,8 +4,6 @@ package com.willfp.eco.util
|
||||
|
||||
import org.bukkit.Server
|
||||
|
||||
/**
|
||||
* @see ServerUtils.getTps
|
||||
*/
|
||||
/** @see ServerUtils.getTps */
|
||||
val Server.tps: Double
|
||||
get() = ServerUtils.getTps()
|
||||
|
||||
@@ -5,33 +5,23 @@ package com.willfp.eco.util
|
||||
import net.kyori.adventure.text.Component
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
/**
|
||||
* @see StringUtils.toComponent
|
||||
*/
|
||||
/** @see StringUtils.toComponent */
|
||||
fun String.toComponent(): Component =
|
||||
StringUtils.toComponent(this)
|
||||
|
||||
/**
|
||||
* @see StringUtils.jsonToComponent
|
||||
*/
|
||||
/** @see StringUtils.jsonToComponent */
|
||||
fun String.jsonToComponent(): Component =
|
||||
StringUtils.jsonToComponent(this)
|
||||
|
||||
/**
|
||||
* @see StringUtils.toLegacy
|
||||
*/
|
||||
/** @see StringUtils.toLegacy */
|
||||
fun Component.toLegacy(): String =
|
||||
StringUtils.toLegacy(this)
|
||||
|
||||
/**
|
||||
* @see StringUtils.componentToJson
|
||||
*/
|
||||
/** @see StringUtils.componentToJson */
|
||||
fun Component.toJSON(): String =
|
||||
StringUtils.componentToJson(this)
|
||||
|
||||
/**
|
||||
* @see StringUtils.format
|
||||
*/
|
||||
/** @see StringUtils.format */
|
||||
fun String.formatEco(
|
||||
player: Player? = null,
|
||||
formatPlaceholders: Boolean = false
|
||||
@@ -41,9 +31,7 @@ fun String.formatEco(
|
||||
if (formatPlaceholders) StringUtils.FormatOption.WITH_PLACEHOLDERS else StringUtils.FormatOption.WITHOUT_PLACEHOLDERS
|
||||
)
|
||||
|
||||
/**
|
||||
* @see StringUtils.formatList
|
||||
*/
|
||||
/** @see StringUtils.formatList */
|
||||
fun List<String>.formatEco(
|
||||
player: Player? = null,
|
||||
formatPlaceholders: Boolean = false
|
||||
@@ -53,14 +41,10 @@ fun List<String>.formatEco(
|
||||
if (formatPlaceholders) StringUtils.FormatOption.WITH_PLACEHOLDERS else StringUtils.FormatOption.WITHOUT_PLACEHOLDERS
|
||||
)
|
||||
|
||||
/**
|
||||
* @see StringUtils.splitAround
|
||||
*/
|
||||
/** @see StringUtils.splitAround */
|
||||
fun String.splitAround(separator: String): Array<String> =
|
||||
StringUtils.splitAround(this, separator)
|
||||
|
||||
/**
|
||||
* @see StringUtils.toNiceString
|
||||
*/
|
||||
/** @see StringUtils.toNiceString */
|
||||
fun Any?.toNiceString(): String =
|
||||
StringUtils.toNiceString(this)
|
||||
|
||||
@@ -4,14 +4,10 @@ package com.willfp.eco.util
|
||||
|
||||
import org.bukkit.util.Vector
|
||||
|
||||
/**
|
||||
* @see VectorUtils.isFinite
|
||||
*/
|
||||
/** @see VectorUtils.isFinite */
|
||||
val Vector.isFinite: Boolean
|
||||
get() = VectorUtils.isFinite(this)
|
||||
|
||||
/**
|
||||
* @see VectorUtils.simplifyVector
|
||||
*/
|
||||
/** @see VectorUtils.simplifyVector */
|
||||
fun Vector.simplify(): Vector =
|
||||
VectorUtils.simplifyVector(this)
|
||||
|
||||
Reference in New Issue
Block a user