Skip to content
This repository was archived by the owner on Feb 16, 2022. It is now read-only.

Commit 365e554

Browse files
committed
doc(api): dokkaを導入。足りていない説明を追記
1 parent a650bbc commit 365e554

File tree

7 files changed

+40
-22
lines changed

7 files changed

+40
-22
lines changed

api/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import org.jetbrains.dokka.gradle.DokkaTask
23

34
plugins {
5+
id("org.jetbrains.dokka") version "1.4.20"
46
`maven-publish`
57
signing
68
}
79

10+
repositories {
11+
jcenter()
12+
}
13+
814
group = "com.github.sya-ri.spigot.api"
915
version = "1.0.1"
1016

api/src/main/kotlin/com/github/syari/spigot/api/EasySpigotAPI.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.github.syari.spigot.api
33
import org.bukkit.plugin.java.JavaPlugin
44

55
/**
6+
* メインクラス
67
* @since 1.0.0
78
*/
89
@Suppress("unused")

api/src/main/kotlin/com/github/syari/spigot/api/event/register/EventRegister.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@ package com.github.syari.spigot.api.event.register
33
import org.bukkit.plugin.java.JavaPlugin
44

55
/**
6+
* 継承することでイベントの登録を行える。
67
* @since 1.0.0
78
*/
89
interface EventRegister {
910
/**
10-
* この関数内でイベントの登録をする
11+
* この関数内でイベントの登録をする
1112
* @since 1.0.0
1213
*/
1314
fun Events.register()
1415

16+
/**
17+
* @see EventRegister.registerEvents
18+
*/
1519
companion object {
1620
/**
17-
* [JavaPlugin.onEnable] 内で呼び出すことでイベントの登録をする
21+
* [JavaPlugin.onEnable] 内で呼び出すことでイベントの登録をする
1822
* ```
1923
* override fun onEnable() {
2024
* registerEvents(...)

api/src/main/kotlin/com/github/syari/spigot/api/event/register/Events.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import org.bukkit.event.Listener
77
import org.bukkit.plugin.java.JavaPlugin
88

99
/**
10+
* [EventRegister.register] で使われている。イベントの定義を行える。
1011
* @since 1.0.0
1112
*/
1213
class Events internal constructor(val plugin: JavaPlugin) : Listener {
1314
/**
14-
* イベントを定義する
15+
* イベントを定義する
1516
* @since 1.0.0
1617
*/
1718
inline fun <reified T : Event> event(
@@ -32,7 +33,7 @@ class Events internal constructor(val plugin: JavaPlugin) : Listener {
3233
}
3334

3435
/**
35-
* 条件に一致した時に特定のイベントをキャンセルする
36+
* 条件に一致した時に特定のイベントをキャンセルする
3637
* @since 1.0.0
3738
*/
3839
inline fun <reified T> cancelEventIf(
@@ -45,7 +46,7 @@ class Events internal constructor(val plugin: JavaPlugin) : Listener {
4546
}
4647

4748
/**
48-
* 条件に一致しなかった時に特定のイベントをキャンセルする
49+
* 条件に一致しなかった時に特定のイベントをキャンセルする
4950
* @since 1.0.0
5051
*/
5152
inline fun <reified T> cancelEventIfNot(

api/src/main/kotlin/com/github/syari/spigot/api/util/uuid/UUIDEntity.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,44 @@ import org.bukkit.entity.Entity
55
import java.util.UUID
66

77
/**
8-
* [Entity] が持つ [UUID] を操作しやすくしたクラス
8+
* [Entity] が持つ [UUID] を操作しやすくしたクラス
99
*
10-
* 変数に保存する際には [Entity] ではなく [UUID] で保存することを推奨する
10+
* 変数に保存する際には [Entity] ではなく [UUID] で保存することを推奨する
1111
* @since 1.1.0
1212
*/
1313
data class UUIDEntity(val uniqueId: UUID) : Comparable<UUIDEntity> {
1414
/**
15-
* [Entity] として取得する
15+
* [Entity] として取得する
1616
* @since 1.1.0
1717
*/
1818
val entity: Entity?
1919
get() = Bukkit.getEntity(uniqueId)
2020

2121
/**
22-
* [UUIDEntity.uniqueId] を文字列として取得する
22+
* [UUIDEntity.uniqueId] を文字列として取得する
2323
* @see [UUID.toString]
2424
* @since 1.1.0
2525
*/
2626
override fun toString() = uniqueId.toString()
2727

2828
/**
29-
* [UUIDEntity.uniqueId] を比較する
29+
* [UUIDEntity.uniqueId] を比較する
3030
* @see [UUID.compareTo]
3131
* @since 1.1.0
3232
*/
3333
override fun compareTo(other: UUIDEntity) = uniqueId.compareTo(other.uniqueId)
3434

35+
/**
36+
* @see UUIDEntity.from
37+
*/
3538
companion object {
3639
/**
37-
* [Entity] を [UUIDEntity] に変換する
40+
* [Entity] を [UUIDEntity] に変換する
3841
*/
3942
fun from(entity: Entity) = UUIDEntity(entity.uniqueId)
4043

4144
/**
42-
* [UUID] を表す文字列から [UUIDEntity] に変換する
45+
* [UUID] を表す文字列から [UUIDEntity] に変換する
4346
*/
4447
fun from(uniqueId: String) = uuidOrNull(uniqueId)?.let(::UUIDEntity)
4548
}

api/src/main/kotlin/com/github/syari/spigot/api/util/uuid/UUIDPlayer.kt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,51 @@ import org.bukkit.entity.Player
66
import java.util.UUID
77

88
/**
9-
* [Player] が持つ [UUID] を操作しやすくしたクラス
9+
* [Player] が持つ [UUID] を操作しやすくしたクラス
1010
*
11-
* 変数に保存する際には [Player] や [OfflinePlayer] ではなく [UUID] で保存することを推奨する
11+
* 変数に保存する際には [Player] や [OfflinePlayer] ではなく [UUID] で保存することを推奨する
1212
* @since 1.1.0
1313
*/
1414
data class UUIDPlayer(val uniqueId: UUID) : Comparable<UUIDPlayer> {
1515
/**
16-
* [Player] として取得する
16+
* [Player] として取得する
1717
* @since 1.1.0
1818
*/
1919
val player: Player?
2020
get() = Bukkit.getPlayer(uniqueId)
2121

2222
/**
23-
* [OfflinePlayer] として取得する
23+
* [OfflinePlayer] として取得する
2424
* @since 1.1.0
2525
*/
2626
val offlinePlayer: OfflinePlayer
2727
get() = Bukkit.getOfflinePlayer(uniqueId)
2828

2929
/**
30-
* [UUIDPlayer.uniqueId] を文字列として取得する
30+
* [UUIDPlayer.uniqueId] を文字列として取得する
3131
* @see [UUID.toString]
3232
* @since 1.1.0
3333
*/
3434
override fun toString() = uniqueId.toString()
3535

3636
/**
37-
* [UUIDPlayer.uniqueId] を比較する
37+
* [UUIDPlayer.uniqueId] を比較する
3838
* @see [UUID.compareTo]
3939
* @since 1.1.0
4040
*/
4141
override fun compareTo(other: UUIDPlayer) = uniqueId.compareTo(other.uniqueId)
4242

43+
/**
44+
* @see UUIDPlayer.from
45+
*/
4346
companion object {
4447
/**
45-
* [OfflinePlayer] を [UUIDPlayer] に変換する
48+
* [OfflinePlayer] を [UUIDPlayer] に変換する
4649
*/
4750
fun from(player: OfflinePlayer) = UUIDPlayer(player.uniqueId)
4851

4952
/**
50-
* [UUID] を表す文字列から [UUIDPlayer] に変換する
53+
* [UUID] を表す文字列から [UUIDPlayer] に変換する
5154
*/
5255
fun from(uniqueId: String) = uuidOrNull(uniqueId)?.let(::UUIDPlayer)
5356
}

api/src/main/kotlin/com/github/syari/spigot/api/util/uuid/extension.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ package com.github.syari.spigot.api.util.uuid
33
import java.util.UUID
44

55
/**
6-
* [UUID.fromString] を実行する
6+
* [UUID.fromString] を実行する
77
* @since 1.1.0
88
*/
99
fun uuid(name: String): UUID = UUID.fromString(name)
1010

1111
/**
12-
* [uuid] を実行するが、例外が発生した場合は null を返す
12+
* [uuid] を実行するが、例外が発生した場合は null を返す
1313
* @since 1.1.0
1414
*/
1515
fun uuidOrNull(name: String): UUID? = try {

0 commit comments

Comments
 (0)