Skip to content

Commit 3710d16

Browse files
authored
Merge pull request #20 from EndlessCodeGroup/feature/improve-dokka
Improve Dokka
2 parents aae2595 + ab63162 commit 3710d16

8 files changed

Lines changed: 43 additions & 21 deletions

File tree

buildSrc/src/main/kotlin/commons.gradle.kts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
1+
import org.jetbrains.dokka.gradle.DokkaTaskPartial
22
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3+
import java.net.URL
34

45
plugins {
56
kotlin("jvm")
@@ -28,7 +29,7 @@ tasks.withType<KotlinCompile> {
2829
}
2930
}
3031

31-
extensions.configure<KotlinProjectExtension> {
32+
kotlin {
3233
explicitApi()
3334
}
3435

@@ -41,6 +42,21 @@ repositories {
4142
mavenCentral()
4243
}
4344

45+
tasks.withType<DokkaTaskPartial>().configureEach {
46+
dokkaSourceSets.configureEach {
47+
reportUndocumented.set(true)
48+
sourceLink {
49+
localDirectory.set(file("src/main/kotlin/"))
50+
remoteUrl.set(URL("https://github.com/EndlessCodeGroup/Mimic/tree/develop/${project.name}/src/main/kotlin/"))
51+
}
52+
externalDocumentationLink {
53+
url.set(URL("https://hub.spigotmc.org/javadocs/spigot/"))
54+
packageListUrl.set(URL("https://gist.githubusercontent.com/osipxd/604c9b3f91c3a6c56050f4a3b027f333/raw/package-list"))
55+
}
56+
pluginsMapConfiguration.put("org.jetbrains.dokka.base.DokkaBase", """{ "separateInheritedMembers": true}""")
57+
}
58+
}
59+
4460
fun DependencyHandlerScope.testingDependencies() {
4561
testImplementation(kotlin("test-junit5"))
4662
testImplementation(junit.jupiter)

mimic-bukkit-api/src/main/kotlin/PlayerSystemProviderService.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public abstract class PlayerSystemProviderService<T : Any>(final override val id
2626

2727
override val isEnabled: Boolean = true
2828

29+
/**
30+
* Returns new instance of [T] is given [arg] is instance of [Player].
31+
* Otherwise, throws [ClassCastException].
32+
*/
33+
@Deprecated("Use getSystem(player) instead", ReplaceWith("this.getSystem(arg)"))
2934
final override fun get(arg: Any): T = getSystem(arg as Player)
3035

3136
/** Returns new instance of [T] initialized with the given [player] object. */

mimic-bukkit-api/src/main/kotlin/classes/BukkitClassSystem.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import ru.endlesscode.mimic.util.ExistingWeakReference
2626
/** [ClassSystem] for Bukkit. */
2727
public abstract class BukkitClassSystem(player: Player) : ClassSystem {
2828

29+
/** Player owning this class system. */
2930
public val player: Player get() = playerRef.get()
3031

3132
private val playerRef: ExistingWeakReference<Player> = ExistingWeakReference(player)

mimic-bukkit-api/src/main/kotlin/level/BukkitLevelSystem.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import ru.endlesscode.mimic.util.ExistingWeakReference
2626
/** [LevelSystem] for Bukkit. */
2727
public abstract class BukkitLevelSystem(player: Player) : LevelSystem {
2828

29+
/** Player owning this level system. */
2930
public val player: Player get() = playerRef.get()
3031

3132
private val playerRef: ExistingWeakReference<Player> = ExistingWeakReference(player)

mimic-bukkit/src/main/kotlin/command/ClassSystemSubcommand.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is part of BukkitMimic.
3-
* Copyright (C) 2020 Osip Fatkullin
4-
* Copyright (C) 2020 EndlessCode Group and contributors
3+
* Copyright (C) 2021 Osip Fatkullin
4+
* Copyright (C) 2021 EndlessCode Group and contributors
55
*
66
* BukkitMimic is free software: you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@ internal class ClassSystemSubcommand(
4040
@Description("Show information about player's class system")
4141
@CommandCompletion("@players")
4242
fun info(sender: CommandSender, @Optional @Flags("other,defaultself") player: Player) {
43-
val system = systemProvider.get(player)
43+
val system = systemProvider.getSystem(player)
4444
sender.send(
4545
"&3System: &7${systemProvider.id}",
4646
"&3Classes: &7${system.classes}",
@@ -57,7 +57,7 @@ internal class ClassSystemSubcommand(
5757
@Default("all") mode: Mode,
5858
@Optional @Flags("other,defaultself") player: Player
5959
) {
60-
val system = systemProvider.get(player)
60+
val system = systemProvider.getSystem(player)
6161
val has = if (mode == Mode.ALL) {
6262
system.hasAllClasses(classes.asList())
6363
} else {

mimic-bukkit/src/main/kotlin/command/LevelSystemSubcommand.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is part of BukkitMimic.
3-
* Copyright (C) 2020 Osip Fatkullin
4-
* Copyright (C) 2020 EndlessCode Group and contributors
3+
* Copyright (C) 2021 Osip Fatkullin
4+
* Copyright (C) 2021 EndlessCode Group and contributors
55
*
66
* BukkitMimic is free software: you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ internal class LevelSystemSubcommand(
4545
@Description("Show information about player's level system")
4646
@CommandCompletion("@players")
4747
fun info(sender: CommandSender, @Optional @Flags("other,defaultself") player: Player) {
48-
val system = systemProvider.get(player)
48+
val system = systemProvider.getSystem(player)
4949
sender.send(
5050
"&3System: &7${systemProvider.id}",
5151
"&3Level: &7%.2f".format(system.level + system.fractionalExp),
@@ -64,8 +64,8 @@ internal class LevelSystemSubcommand(
6464
@Optional @Flags("other,defaultself") player: Player
6565
) {
6666
catchUnsupported {
67-
val system = systemProvider.get(player)
68-
@Suppress("DEPRECATION") // Allow to use exp setter
67+
val system = systemProvider.getSystem(player)
68+
@Suppress("DEPRECATION") // Allow using exp setter
6969
when (type) {
7070
ExtendedValueType.LVL -> system.level = amount.toInt()
7171
ExtendedValueType.TOTAL -> system.totalExp = amount
@@ -85,7 +85,7 @@ internal class LevelSystemSubcommand(
8585
@Optional @Flags("other,defaultself") player: Player
8686
) {
8787
catchUnsupported {
88-
val system = systemProvider.get(player)
88+
val system = systemProvider.getSystem(player)
8989
when (type) {
9090
ValueType.LVL -> system.giveLevels(amount)
9191
ValueType.POINTS -> system.giveExp(amount.toDouble())
@@ -104,7 +104,7 @@ internal class LevelSystemSubcommand(
104104
@Optional @Flags("other,defaultself") player: Player
105105
) {
106106
catchUnsupported {
107-
val system = systemProvider.get(player)
107+
val system = systemProvider.getSystem(player)
108108
when (type) {
109109
ValueType.LVL -> system.takeLevels(amount)
110110
ValueType.POINTS -> system.takeExp(amount.toDouble())
@@ -135,7 +135,7 @@ internal class LevelSystemSubcommand(
135135
@Default("lvl") type: ExtendedValueType,
136136
@Optional @Flags("other,defaultself") player: Player
137137
) {
138-
val system = systemProvider.get(player)
138+
val system = systemProvider.getSystem(player)
139139
val has = when (type) {
140140
ExtendedValueType.LVL -> system.didReachLevel(value)
141141
ExtendedValueType.POINTS -> system.hasExp(value.toDouble())

mimic-bukkit/src/test/kotlin/impl/mimic/PermissionsClassSystemTest.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is part of BukkitMimic.
3-
* Copyright (C) 2020 Osip Fatkullin
4-
* Copyright (C) 2020 EndlessCode Group and contributors
3+
* Copyright (C) 2021 Osip Fatkullin
4+
* Copyright (C) 2021 EndlessCode Group and contributors
55
*
66
* BukkitMimic is free software: you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -25,7 +25,6 @@ import com.nhaarman.mockitokotlin2.whenever
2525
import org.bukkit.permissions.PermissionAttachmentInfo
2626
import ru.endlesscode.mimic.BukkitTestBase
2727
import ru.endlesscode.mimic.classes.ClassSystem
28-
import java.util.*
2928
import kotlin.test.BeforeTest
3029
import kotlin.test.Test
3130
import kotlin.test.assertFalse
@@ -39,7 +38,7 @@ class PermissionsClassSystemTest : BukkitTestBase() {
3938
@BeforeTest
4039
override fun setUp() {
4140
super.setUp()
42-
classSystem = PermissionsClassSystem.Provider().get(player)
41+
classSystem = PermissionsClassSystem.Provider().getSystem(player)
4342
}
4443

4544
@Test

mimic-bukkit/src/test/kotlin/impl/vanilla/MinecraftLevelSystemTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is part of BukkitMimic.
3-
* Copyright (C) 2020 Osip Fatkullin
4-
* Copyright (C) 2020 EndlessCode Group and contributors
3+
* Copyright (C) 2021 Osip Fatkullin
4+
* Copyright (C) 2021 EndlessCode Group and contributors
55
*
66
* BukkitMimic is free software: you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ class MinecraftLevelSystemTest : BukkitTestBase() {
3838
@BeforeTest
3939
override fun setUp() {
4040
super.setUp()
41-
levelSystem = MinecraftLevelSystem.Provider().get(player)
41+
levelSystem = MinecraftLevelSystem.Provider().getSystem(player)
4242
}
4343

4444
@Test

0 commit comments

Comments
 (0)