-
Notifications
You must be signed in to change notification settings - Fork 3
Use jpenilla/resource-factory to generate plugin.yml file #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e78908f
fix: Remove unused gradle-download-task dependency
osipxd f50f716
feat: Use jpenilla/resource-factory to generate plugin.yml
osipxd a78c741
feat: Read defaults from existing plugin.yml
osipxd 7a73eac
fix: Fix generatePluginYaml flag
osipxd 186e0e3
fix: Bring applying JavaPlugin back
osipxd 2b37c4f
fix: Better errors handling
osipxd 13aede9
fix: Address review comments
osipxd 10f0bd7
docs: Add changelog notes
osipxd f8a5030
fix: Remove an extra import
osipxd 9553cad
fix: Finalize generatePluginYaml value before getting
osipxd ab8b686
fix: Use PathSensitivity.NONE for pluginYamlFile
osipxd c394573
test: Rewrite content of pluginYamlFile instead of appending
osipxd 2f57e5d
docs: Revise the quick start guide
osipxd 22050c0
docs: Add a migration guide section for 0.11+
osipxd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,76 @@ | ||
@file:UseSerializers(PermissionDefaultSerializer::class) | ||
|
||
package ru.endlesscode.bukkitgradle.plugin | ||
|
||
import kotlinx.serialization.KSerializer | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.UseSerializers | ||
import kotlinx.serialization.descriptors.PrimitiveKind | ||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor | ||
import kotlinx.serialization.descriptors.SerialDescriptor | ||
import kotlinx.serialization.encoding.Decoder | ||
import kotlinx.serialization.encoding.Encoder | ||
import xyz.jpenilla.resourcefactory.bukkit.BukkitPluginYaml | ||
import xyz.jpenilla.resourcefactory.bukkit.Permission.Default as PermissionDefault | ||
|
||
/** | ||
* Should be synced with [BukkitPluginYaml.Serializable]. | ||
* We can't use the existing class as we want all fields to be nullable. | ||
*/ | ||
@Serializable | ||
internal data class BukkitPluginYamlDefaults( | ||
val apiVersion: String? = null, | ||
val name: String? = null, | ||
val version: String? = null, | ||
val main: String? = null, | ||
val description: String? = null, | ||
val load: BukkitPluginYaml.PluginLoadOrder? = null, | ||
val author: String? = null, | ||
val authors: List<String>? = null, | ||
val website: String? = null, | ||
val depend: List<String>? = null, | ||
val softdepend: List<String>? = null, | ||
val loadbefore: List<String>? = null, | ||
val prefix: String? = null, | ||
val defaultPermission: PermissionDefault? = null, | ||
val provides: List<String>? = null, | ||
val libraries: List<String>? = null, | ||
val commands: Map<String, Command>? = null, | ||
val permissions: Map<String, Permission>? = null, | ||
val foliaSupported: Boolean? = null, | ||
val paperPluginLoader: String? = null, | ||
val paperSkipLibraries: Boolean? = null, | ||
) { | ||
osipxd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@Serializable | ||
internal data class Command( | ||
val description: String? = null, | ||
val aliases: List<String>? = null, | ||
val permission: String? = null, | ||
val permissionMessage: String? = null, | ||
val usage: String? = null, | ||
) | ||
|
||
@Serializable | ||
internal data class Permission( | ||
val description: String? = null, | ||
val default: PermissionDefault? = null, | ||
val children: Map<String, Boolean>? = null, | ||
) | ||
} | ||
|
||
internal object PermissionDefaultSerializer : KSerializer<PermissionDefault> { | ||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor( | ||
"xyz.jpenilla.resourcefactory.bukkit.Permission.Default", | ||
PrimitiveKind.STRING, | ||
) | ||
|
||
override fun deserialize(decoder: Decoder): PermissionDefault { | ||
val string = decoder.decodeString() | ||
return PermissionDefault.values().first { it.serialized.equals(string, ignoreCase = true) } | ||
} | ||
|
||
override fun serialize(encoder: Encoder, value: PermissionDefault) { | ||
encoder.encodeString(value.serialized) | ||
} | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.