This repository was archived by the owner on Feb 16, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +40
-22
lines changed
src/main/kotlin/com/github/syari/spigot/api Expand file tree Collapse file tree 7 files changed +40
-22
lines changed Original file line number Diff line number Diff line change 1
1
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2
+ import org.jetbrains.dokka.gradle.DokkaTask
2
3
3
4
plugins {
5
+ id(" org.jetbrains.dokka" ) version " 1.4.20"
4
6
`maven- publish`
5
7
signing
6
8
}
7
9
10
+ repositories {
11
+ jcenter()
12
+ }
13
+
8
14
group = " com.github.sya-ri.spigot.api"
9
15
version = " 1.0.1"
10
16
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package com.github.syari.spigot.api
3
3
import org.bukkit.plugin.java.JavaPlugin
4
4
5
5
/* *
6
+ * メインクラス
6
7
* @since 1.0.0
7
8
*/
8
9
@Suppress(" unused" )
Original file line number Diff line number Diff line change @@ -3,18 +3,22 @@ package com.github.syari.spigot.api.event.register
3
3
import org.bukkit.plugin.java.JavaPlugin
4
4
5
5
/* *
6
+ * 継承することでイベントの登録を行える。
6
7
* @since 1.0.0
7
8
*/
8
9
interface EventRegister {
9
10
/* *
10
- * この関数内でイベントの登録をする
11
+ * この関数内でイベントの登録をする。
11
12
* @since 1.0.0
12
13
*/
13
14
fun Events.register ()
14
15
16
+ /* *
17
+ * @see EventRegister.registerEvents
18
+ */
15
19
companion object {
16
20
/* *
17
- * [JavaPlugin.onEnable] 内で呼び出すことでイベントの登録をする
21
+ * [JavaPlugin.onEnable] 内で呼び出すことでイベントの登録をする。
18
22
* ```
19
23
* override fun onEnable() {
20
24
* registerEvents(...)
Original file line number Diff line number Diff line change @@ -7,11 +7,12 @@ import org.bukkit.event.Listener
7
7
import org.bukkit.plugin.java.JavaPlugin
8
8
9
9
/* *
10
+ * [EventRegister.register] で使われている。イベントの定義を行える。
10
11
* @since 1.0.0
11
12
*/
12
13
class Events internal constructor(val plugin : JavaPlugin ) : Listener {
13
14
/* *
14
- * イベントを定義する
15
+ * イベントを定義する。
15
16
* @since 1.0.0
16
17
*/
17
18
inline fun <reified T : Event > event (
@@ -32,7 +33,7 @@ class Events internal constructor(val plugin: JavaPlugin) : Listener {
32
33
}
33
34
34
35
/* *
35
- * 条件に一致した時に特定のイベントをキャンセルする
36
+ * 条件に一致した時に特定のイベントをキャンセルする。
36
37
* @since 1.0.0
37
38
*/
38
39
inline fun <reified T > cancelEventIf (
@@ -45,7 +46,7 @@ class Events internal constructor(val plugin: JavaPlugin) : Listener {
45
46
}
46
47
47
48
/* *
48
- * 条件に一致しなかった時に特定のイベントをキャンセルする
49
+ * 条件に一致しなかった時に特定のイベントをキャンセルする。
49
50
* @since 1.0.0
50
51
*/
51
52
inline fun <reified T > cancelEventIfNot (
Original file line number Diff line number Diff line change @@ -5,41 +5,44 @@ import org.bukkit.entity.Entity
5
5
import java.util.UUID
6
6
7
7
/* *
8
- * [Entity] が持つ [UUID] を操作しやすくしたクラス
8
+ * [Entity] が持つ [UUID] を操作しやすくしたクラス。
9
9
*
10
- * 変数に保存する際には [Entity] ではなく [UUID] で保存することを推奨する
10
+ * 変数に保存する際には [Entity] ではなく [UUID] で保存することを推奨する。
11
11
* @since 1.1.0
12
12
*/
13
13
data class UUIDEntity (val uniqueId : UUID ) : Comparable<UUIDEntity> {
14
14
/* *
15
- * [Entity] として取得する
15
+ * [Entity] として取得する。
16
16
* @since 1.1.0
17
17
*/
18
18
val entity: Entity ?
19
19
get() = Bukkit .getEntity(uniqueId)
20
20
21
21
/* *
22
- * [UUIDEntity.uniqueId] を文字列として取得する
22
+ * [UUIDEntity.uniqueId] を文字列として取得する。
23
23
* @see [UUID.toString]
24
24
* @since 1.1.0
25
25
*/
26
26
override fun toString () = uniqueId.toString()
27
27
28
28
/* *
29
- * [UUIDEntity.uniqueId] を比較する
29
+ * [UUIDEntity.uniqueId] を比較する。
30
30
* @see [UUID.compareTo]
31
31
* @since 1.1.0
32
32
*/
33
33
override fun compareTo (other : UUIDEntity ) = uniqueId.compareTo(other.uniqueId)
34
34
35
+ /* *
36
+ * @see UUIDEntity.from
37
+ */
35
38
companion object {
36
39
/* *
37
- * [Entity] を [UUIDEntity] に変換する
40
+ * [Entity] を [UUIDEntity] に変換する。
38
41
*/
39
42
fun from (entity : Entity ) = UUIDEntity (entity.uniqueId)
40
43
41
44
/* *
42
- * [UUID] を表す文字列から [UUIDEntity] に変換する
45
+ * [UUID] を表す文字列から [UUIDEntity] に変換する。
43
46
*/
44
47
fun from (uniqueId : String ) = uuidOrNull(uniqueId)?.let (::UUIDEntity )
45
48
}
Original file line number Diff line number Diff line change @@ -6,48 +6,51 @@ import org.bukkit.entity.Player
6
6
import java.util.UUID
7
7
8
8
/* *
9
- * [Player] が持つ [UUID] を操作しやすくしたクラス
9
+ * [Player] が持つ [UUID] を操作しやすくしたクラス。
10
10
*
11
- * 変数に保存する際には [Player] や [OfflinePlayer] ではなく [UUID] で保存することを推奨する
11
+ * 変数に保存する際には [Player] や [OfflinePlayer] ではなく [UUID] で保存することを推奨する。
12
12
* @since 1.1.0
13
13
*/
14
14
data class UUIDPlayer (val uniqueId : UUID ) : Comparable<UUIDPlayer> {
15
15
/* *
16
- * [Player] として取得する
16
+ * [Player] として取得する。
17
17
* @since 1.1.0
18
18
*/
19
19
val player: Player ?
20
20
get() = Bukkit .getPlayer(uniqueId)
21
21
22
22
/* *
23
- * [OfflinePlayer] として取得する
23
+ * [OfflinePlayer] として取得する。
24
24
* @since 1.1.0
25
25
*/
26
26
val offlinePlayer: OfflinePlayer
27
27
get() = Bukkit .getOfflinePlayer(uniqueId)
28
28
29
29
/* *
30
- * [UUIDPlayer.uniqueId] を文字列として取得する
30
+ * [UUIDPlayer.uniqueId] を文字列として取得する。
31
31
* @see [UUID.toString]
32
32
* @since 1.1.0
33
33
*/
34
34
override fun toString () = uniqueId.toString()
35
35
36
36
/* *
37
- * [UUIDPlayer.uniqueId] を比較する
37
+ * [UUIDPlayer.uniqueId] を比較する。
38
38
* @see [UUID.compareTo]
39
39
* @since 1.1.0
40
40
*/
41
41
override fun compareTo (other : UUIDPlayer ) = uniqueId.compareTo(other.uniqueId)
42
42
43
+ /* *
44
+ * @see UUIDPlayer.from
45
+ */
43
46
companion object {
44
47
/* *
45
- * [OfflinePlayer] を [UUIDPlayer] に変換する
48
+ * [OfflinePlayer] を [UUIDPlayer] に変換する。
46
49
*/
47
50
fun from (player : OfflinePlayer ) = UUIDPlayer (player.uniqueId)
48
51
49
52
/* *
50
- * [UUID] を表す文字列から [UUIDPlayer] に変換する
53
+ * [UUID] を表す文字列から [UUIDPlayer] に変換する。
51
54
*/
52
55
fun from (uniqueId : String ) = uuidOrNull(uniqueId)?.let (::UUIDPlayer )
53
56
}
Original file line number Diff line number Diff line change @@ -3,13 +3,13 @@ package com.github.syari.spigot.api.util.uuid
3
3
import java.util.UUID
4
4
5
5
/* *
6
- * [UUID.fromString] を実行する
6
+ * [UUID.fromString] を実行する。
7
7
* @since 1.1.0
8
8
*/
9
9
fun uuid (name : String ): UUID = UUID .fromString(name)
10
10
11
11
/* *
12
- * [uuid] を実行するが、例外が発生した場合は null を返す
12
+ * [uuid] を実行するが、例外が発生した場合は null を返す。
13
13
* @since 1.1.0
14
14
*/
15
15
fun uuidOrNull (name : String ): UUID ? = try {
You can’t perform that action at this time.
0 commit comments