generated from Nlkomaru/PluginTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from morinoparty/develop
Add vault integration
- Loading branch information
Showing
20 changed files
with
177 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
core/src/main/kotlin/party/morino/mineauth/core/integration/Integration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package party.morino.mineauth.core.integration | ||
|
||
interface Integration { | ||
var available: Boolean | ||
val name: String | ||
|
||
fun initialize() | ||
} |
17 changes: 17 additions & 0 deletions
17
core/src/main/kotlin/party/morino/mineauth/core/integration/IntegrationInitializer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package party.morino.mineauth.core.integration | ||
|
||
import party.morino.mineauth.core.integration.vault.VaultIntegration | ||
|
||
object IntegrationInitializer { | ||
private val integrations = mutableListOf<Integration>() | ||
val availableIntegrations: List<Integration> | ||
get() = integrations.filter { it.available } | ||
|
||
fun initialize() { | ||
integrations.add(VaultIntegration) | ||
|
||
integrations.forEach { | ||
it.initialize() | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
core/src/main/kotlin/party/morino/mineauth/core/integration/vault/VaultIntegration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package party.morino.mineauth.core.integration.vault | ||
|
||
import net.milkbowl.vault.economy.Economy | ||
import org.bukkit.Bukkit.getServer | ||
import party.morino.mineauth.core.integration.Integration | ||
|
||
|
||
object VaultIntegration : Integration { | ||
override var available: Boolean = false | ||
override val name: String = "Vault" | ||
lateinit var economy : Economy | ||
|
||
override fun initialize() { | ||
val plugin = getServer().pluginManager.getPlugin(name) | ||
plugin?.let { | ||
available = true | ||
} | ||
val rsp = getServer().servicesManager.getRegistration( | ||
Economy::class.java | ||
) | ||
if (rsp == null) { | ||
available = false | ||
return | ||
} | ||
economy = rsp.provider | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
core/src/main/kotlin/party/morino/mineauth/core/web/JwtCompleteCode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package party.morino.mineauth.core.web | ||
|
||
enum class JwtCompleteCode(val code: String) { | ||
USER_TOKEN("user-oauth-token"), | ||
SERVICE_TOKEN("service-oauth-token") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
core/src/main/kotlin/party/morino/mineauth/core/web/data/OIDCConfigData.kt
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
.../mineauth/core/web/data/AuthorizedData.kt → ...re/web/router/auth/data/AuthorizedData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rino/mineauth/core/web/data/ClientData.kt → ...h/core/web/router/auth/data/ClientData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
core/src/main/kotlin/party/morino/mineauth/core/web/router/auth/data/OIDCConfigData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package party.morino.mineauth.core.web.router.auth.data | ||
|
||
class OIDCConfigData |
2 changes: 1 addition & 1 deletion
2
...orino/mineauth/core/web/data/TokenData.kt → ...th/core/web/router/auth/data/TokenData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 43 additions & 3 deletions
46
core/src/main/kotlin/party/morino/mineauth/core/web/router/plugin/vault/VaultRouter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...src/main/kotlin/party/morino/mineauth/core/web/router/plugin/vault/data/RemittanceData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package party.morino.mineauth.core.web.router.plugin.vault.data | ||
|
||
import kotlinx.serialization.Serializable | ||
import org.bukkit.OfflinePlayer | ||
import party.morino.mineauth.core.utils.OfflinePlayerSerializer | ||
|
||
@Serializable | ||
data class RemittanceData( | ||
val target : @Serializable(with = OfflinePlayerSerializer::class) OfflinePlayer, | ||
val amount : Double | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters