All Downloads are FREE. Search and download functionalities are using the official Maven repository.

walkmc.annotation.Resource.kt Maven / Gradle / Ivy

package walkmc.annotation

import kotlinx.serialization.*

/**
 * Represents an autommatically registered resource.
 *
 * All objects and classes without constructors annotated with this annotation,
 * will be parsed as a service, and will be loaded when the plugin enables.
 */
@Target(AnnotationTarget.CLASS)
annotation class AutoResource(val priority: Int = ResourceOrder.NORMAL)

/**
 * Represents a priority of a resource.
 *
 * The priority of a resource is used to get the load priority of a resource.
 */
object ResourceOrder {
	
	/**
	 * First priority. Resources will be loaded first.
	 */
	const val FIRST = Int.MIN_VALUE
	
	/**
	 * Lower priority. Resources will be loaded after [FIRST], but before [NORMAL].
	 */
	const val LOWER = -1
	
	/**
	 * No/Normal priority. Resources will be loaded in normal order.
	 */
	const val NORMAL = 0
	
	/**
	 * Higher priority. Resources will be loaded after [NORMAL], but before [LAST].
	 */
	const val HIGHER = 1
	
	/**
	 * Last priority. Resources will be loaded after all resources loaded.
	 */
	const val LAST = Int.MAX_VALUE
}

/**
 * Represents a informational data class for use with [AutoResource].
 */
@Serializable
data class ResourceInfo(val className: String, val priority: Int)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy