Added commands and messages modules
This commit is contained in:
1 parent
ad17e1e15c
commit
5d615bc63e
45 files changed
+457
-89
No files matched your search
@@ -65,12 +65,12 @@ publishing {
|
||||
version = version
|
||||
name.set(globalArtifactId)
|
||||
description.set(globalArtifactId)
|
||||
url.set("https://github.com/iRedTea/CarcadeX")
|
||||
url.set("https://github.com/CarcadeX/KotlinBukkitKit")
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name.set("GNU General Public License v3.0")
|
||||
url.set("https://www.gnu.org/licenses/gpl-3.0.en.html")
|
||||
name.set("MIT")
|
||||
url.set("https://mit-license.org/")
|
||||
}
|
||||
}
|
||||
developers {
|
||||
@@ -83,7 +83,7 @@ publishing {
|
||||
scm {
|
||||
connection.set("scm:https://github.com/CarcadeX/$globalName.git")
|
||||
developerConnection.set("git@github.com:CarcadeX/$globalName.git")
|
||||
url.set("https://github.com/iRedTea/CarcadeX")
|
||||
url.set("https://github.com/CarcadeX/KotlinBukkitKit")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
.gradle
|
||||
build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
@@ -0,0 +1,123 @@
|
||||
plugins {
|
||||
id("java")
|
||||
kotlin("jvm")
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
id("maven-publish")
|
||||
id("signing")
|
||||
}
|
||||
|
||||
group = "tech.carcadex"
|
||||
val globalArtifactId = "kotlinbukkitkit-commands"
|
||||
val globalName = "kotlinbukkitkit-commands"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "spigotmc-repo"
|
||||
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT")
|
||||
compileOnly(project(":extensions"))
|
||||
implementation(kotlin("reflect"))
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(8)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
sourceSets.main {
|
||||
kotlin.srcDir("build/generated/ksp/main/kotlin")
|
||||
}
|
||||
sourceSets.test {
|
||||
kotlin.srcDir("build/generated/ksp/test/kotlin")
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
artifactId = globalArtifactId
|
||||
groupId = "tech.carcadex"
|
||||
version = version
|
||||
from(components["java"])
|
||||
versionMapping {
|
||||
usage("java-api") {
|
||||
fromResolutionOf("runtimeClasspath")
|
||||
}
|
||||
usage("java-runtime") {
|
||||
fromResolutionResult()
|
||||
}
|
||||
}
|
||||
pom {
|
||||
artifactId = globalArtifactId
|
||||
groupId = "tech.carcadex"
|
||||
version = version
|
||||
name.set(globalArtifactId)
|
||||
description.set(globalArtifactId)
|
||||
url.set("https://github.com/CarcadeX/KotlinBukkitKit")
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name.set("MIT")
|
||||
url.set("https://mit-license.org/")
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id.set("itzRedTea")
|
||||
name.set("Red Tea")
|
||||
email.set("red__tea@outlook.com")
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection.set("scm:https://github.com/CarcadeX/$globalName.git")
|
||||
developerConnection.set("git@github.com:CarcadeX/$globalName.git")
|
||||
url.set("https://github.com/CarcadeX/KotlinBukkitKit")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
val releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
|
||||
val snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
|
||||
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
|
||||
credentials {
|
||||
username = "itzRedTea"
|
||||
password = project.findProperty("password").toString()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
sign(publishing.publications.getByName("maven"))
|
||||
}
|
||||
|
||||
tasks.shadowJar {
|
||||
dependencies {
|
||||
exclude {
|
||||
it.moduleGroup.startsWith("org.jetbrains")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands
|
||||
|
||||
import org.bukkit.command.CommandSender
|
||||
import tech.carcadex.kotlinbukkitkit.commands.annotations.Command
|
||||
import tech.carcadex.kotlinbukkitkit.commands.annotations.Permission
|
||||
import tech.carcadex.kotlinbukkitkit.commands.manager.CommandManager
|
||||
|
||||
typealias Sender = CommandSender
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.annotations
|
||||
|
||||
annotation class Aliases(val aliases: Array<String>)
|
||||
@@ -0,0 +1,4 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.annotations
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class Command(val name: String)
|
||||
@@ -0,0 +1,4 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.annotations
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class Default()
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.annotations
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class Description(val desc: String)
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.annotations
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class Optional()
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.annotations
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class Permission(val perm: String)
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.annotations
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class SubCommand(val name: String)
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.annotations
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class TabComplete(val complete: Array<String>)
|
||||
@@ -0,0 +1,4 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.annotations
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class Usage(val usage: String)
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.exceptions
|
||||
|
||||
class UnsupportedTypeException(msg: String) : RuntimeException(msg)
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.manager
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.OfflinePlayer
|
||||
import org.bukkit.World
|
||||
import org.bukkit.command.CommandExecutor
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.plugin.Plugin
|
||||
import tech.carcadex.kotlinbukkitkit.commands.annotations.Command
|
||||
import tech.carcadex.kotlinbukkitkit.commands.exceptions.UnsupportedTypeException
|
||||
import tech.carcadex.kotlinbukkitkit.extensions.offlinePlayerOrNull
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KFunction
|
||||
import kotlin.reflect.KParameter
|
||||
import kotlin.reflect.KType
|
||||
import kotlin.reflect.full.callSuspendBy
|
||||
import kotlin.reflect.full.findAnnotations
|
||||
import kotlin.reflect.full.hasAnnotation
|
||||
import kotlin.reflect.full.isSubtypeOf
|
||||
import kotlin.reflect.jvm.javaType
|
||||
|
||||
class CommandManager(val plugin: Plugin) {
|
||||
private val types = mutableMapOf<String, (String) -> Any?>()
|
||||
|
||||
init {
|
||||
types[CommandSender::class.qualifiedName!!] = { it }
|
||||
types[String::class.qualifiedName!!] = { it }
|
||||
types["java.lang.String"] = { it }
|
||||
types[Int::class.qualifiedName!!] = { it.toInt() }
|
||||
types["java.lang.Integer"] = { it.toInt() }
|
||||
types[UInt::class.qualifiedName!!] = { it.toUInt() }
|
||||
types[Long::class.qualifiedName!!] = { it.toLong() }
|
||||
types["java.lang.Long"] = { it.toInt() }
|
||||
types[ULong::class.qualifiedName!!] = { it.toULong() }
|
||||
types[Short::class.qualifiedName!!] = { it.toShort() }
|
||||
types["java.lang.Short"] = { it.toInt() }
|
||||
types[UShort::class.qualifiedName!!] = { it.toUShort() }
|
||||
types[Float::class.qualifiedName!!] = { it.toFloat() }
|
||||
types["java.lang.Float"] = { it.toInt() }
|
||||
types[Double::class.qualifiedName!!] = { it.toDouble() }
|
||||
types["java.lang.Double"] = { it.toInt() }
|
||||
types[Byte::class.qualifiedName!!] = { it.toByte() }
|
||||
types["java.lang.Byte"] = { it.toInt() }
|
||||
types[UByte::class.qualifiedName!!] = { it.toUByte() }
|
||||
types[Boolean::class.qualifiedName!!] = { it.toBoolean() }
|
||||
types["java.lang.Boolean"] = { it.toInt() }
|
||||
|
||||
types[Player::class.qualifiedName!!] = { Bukkit.getPlayer(it) }
|
||||
types[OfflinePlayer::class.qualifiedName!!] = { offlinePlayerOrNull(it) }
|
||||
types[World::class.qualifiedName!!] = { Bukkit.getWorld(it) }
|
||||
types[Material::class.qualifiedName!!] = { Material.matchMaterial(it) }
|
||||
}
|
||||
|
||||
private fun register(commandExecutor: CommandExecutor, aliases: Array<String>,
|
||||
desc: String = "", usage: String = "") {
|
||||
CommandRegister.reg(plugin, commandExecutor, aliases, desc, usage);
|
||||
}
|
||||
fun register(f: KFunction<Unit>) {
|
||||
if(f.hasAnnotation<Command>()) {
|
||||
val cmdName = f.findAnnotations<Command>().first().name
|
||||
val argsParsers = mutableListOf<(String) -> Any?>({
|
||||
return@mutableListOf types[CommandSender::class.qualifiedName!!]!!(it)
|
||||
})
|
||||
|
||||
for (argType in f.parameters) {
|
||||
val clazz = Class.forName(argType.type.javaType.typeName)
|
||||
if(argType.type.javaType.typeName in this.types) {
|
||||
argsParsers.add(this.types[argType.type.javaType.typeName]!!)
|
||||
} else if(!clazz.isEnum) throw UnsupportedTypeException("Type ${argType.type.javaType.typeName} is not supported") else {
|
||||
argsParsers.add {
|
||||
for(e in clazz.enumConstants) {
|
||||
if((e as Enum<*>).name.equals(it, ignoreCase = true)) return@add e;
|
||||
}
|
||||
throw NoSuchElementException("No such value in enum")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
register(CommandExecutor { sender, command, label, args ->
|
||||
val finalArgs = mutableListOf<Any?>(sender)
|
||||
finalArgs.addAll(args.mapIndexed { i, it -> argsParsers[i](it) })
|
||||
val map = mutableMapOf<KParameter, Any?>()
|
||||
var i = 0;
|
||||
for(arg in finalArgs) {
|
||||
map[f.parameters[i]] = arg
|
||||
++i
|
||||
}
|
||||
f.callBy(map)
|
||||
return@CommandExecutor true;
|
||||
}, arrayOf(cmdName))
|
||||
} else throw IllegalArgumentException("It must be a command!")
|
||||
}
|
||||
|
||||
fun type(clazz: KClass<*>, converter: (String) -> Any) {
|
||||
types[clazz.qualifiedName!!] = converter
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.manager
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.command.*
|
||||
import org.bukkit.plugin.Plugin
|
||||
import java.util.*
|
||||
|
||||
|
||||
class CommandRegister(
|
||||
aliases: Array<String>,
|
||||
desc: String?,
|
||||
usage: String?,
|
||||
protected val owner: CommandExecutor,
|
||||
protected val registeredWith: Any,
|
||||
val pl: Plugin
|
||||
) : Command(aliases[0], desc!!, usage!!, Arrays.asList(*aliases)), PluginIdentifiableCommand {
|
||||
|
||||
|
||||
override fun execute(sender: CommandSender, label: String, args: Array<String>): Boolean {
|
||||
if (!testPermission(sender)) {
|
||||
return true
|
||||
}
|
||||
return if (owner.onCommand(sender, this, label, args)) {
|
||||
true
|
||||
} else {
|
||||
sender.sendMessage(usageMessage)
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun reg(plugin: Plugin, executor: CommandExecutor, aliases: Array<String>, desc: String?, usage: String?) {
|
||||
if(aliases.size < 1) throw IllegalArgumentException("Could not found name")
|
||||
try {
|
||||
val reg = CommandRegister(aliases, desc, usage, executor, Any(), plugin)
|
||||
val field = Bukkit.getServer().javaClass.getDeclaredField("commandMap")
|
||||
field.isAccessible = true
|
||||
val map = field[Bukkit.getServer()] as CommandMap
|
||||
map.register(plugin.description.name, reg)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getPlugin(): Plugin = pl
|
||||
}
|
||||
@@ -66,12 +66,12 @@ publishing {
|
||||
version = version
|
||||
name.set(globalArtifactId)
|
||||
description.set(globalArtifactId)
|
||||
url.set("https://github.com/iRedTea/CarcadeX")
|
||||
url.set("https://github.com/CarcadeX/KotlinBukkitKit")
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name.set("GNU General Public License v3.0")
|
||||
url.set("https://www.gnu.org/licenses/gpl-3.0.en.html")
|
||||
name.set("MIT")
|
||||
url.set("https://mit-license.org/")
|
||||
}
|
||||
}
|
||||
developers {
|
||||
@@ -84,7 +84,7 @@ publishing {
|
||||
scm {
|
||||
connection.set("scm:https://github.com/CarcadeX/$globalName.git")
|
||||
developerConnection.set("git@github.com:CarcadeX/$globalName.git")
|
||||
url.set("https://github.com/iRedTea/CarcadeX")
|
||||
url.set("https://github.com/CarcadeX/KotlinBukkitKit")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,12 @@ Thanks DevSrSouza for KotlinBukkitAPI
|
||||
|
||||
package tech.carcadex.kotlinbukkitkit.extensions
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.Effect
|
||||
import org.bukkit.Instrument
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.Note
|
||||
import org.bukkit.OfflinePlayer
|
||||
import org.bukkit.Sound
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.entity.Player
|
||||
@@ -42,3 +44,4 @@ public fun Player.resetWalkSpeed() {
|
||||
public fun Player.resetFlySpeed() {
|
||||
flySpeed = 0.1f
|
||||
}
|
||||
|
||||
@@ -7,10 +7,7 @@ Thanks DevSrSouza for KotlinBukkitAPI
|
||||
*/
|
||||
package tech.carcadex.kotlinbukkitkit.extensions
|
||||
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.OfflinePlayer
|
||||
import org.bukkit.World
|
||||
import org.bukkit.WorldCreator
|
||||
import org.bukkit.*
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.inventory.Recipe
|
||||
@@ -26,6 +23,15 @@ public val isPrimaryThread: Boolean get() = server.isPrimaryThread
|
||||
|
||||
public fun offlinePlayer(uuid: UUID): OfflinePlayer = server.getOfflinePlayer(uuid)
|
||||
public fun offlinePlayer(name: String): OfflinePlayer = server.getOfflinePlayer(name)
|
||||
public fun offlinePlayerOrNull(name: String, ignoreCase: Boolean = false): OfflinePlayer? {
|
||||
val onlinePlayer = Bukkit.getPlayer(name)
|
||||
if(onlinePlayer != null) return onlinePlayer
|
||||
|
||||
for(player in Bukkit.getOfflinePlayers()) {
|
||||
if(player.name.equals(name, ignoreCase = ignoreCase)) return player
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
public fun player(uuid: UUID): Player? = server.getPlayer(uuid)
|
||||
public fun player(name: String): Player? = server.getPlayer(name)
|
||||
|
||||
@@ -69,12 +69,12 @@ publishing {
|
||||
version = version
|
||||
name.set(globalArtifactId)
|
||||
description.set(globalArtifactId)
|
||||
url.set("https://github.com/iRedTea/CarcadeX")
|
||||
url.set("https://github.com/CarcadeX/KotlinBukkitKit")
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name.set("GNU General Public License v3.0")
|
||||
url.set("https://www.gnu.org/licenses/gpl-3.0.en.html")
|
||||
name.set("MIT")
|
||||
url.set("https://mit-license.org/")
|
||||
}
|
||||
}
|
||||
developers {
|
||||
@@ -87,7 +87,7 @@ publishing {
|
||||
scm {
|
||||
connection.set("scm:https://github.com/CarcadeX/$globalName.git")
|
||||
developerConnection.set("git@github.com:CarcadeX/$globalName.git")
|
||||
url.set("https://github.com/iRedTea/CarcadeX")
|
||||
url.set("https://github.com/CarcadeX/KotlinBukkitKit")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -1,8 +1,9 @@
|
||||
package me.redtea.carcadex.genref.plugin
|
||||
package tech.carcadex.kotlinbukkitkit.genref.plugin
|
||||
|
||||
import com.google.devtools.ksp.KspExperimental
|
||||
import com.google.devtools.ksp.getAnnotationsByType
|
||||
import com.google.devtools.ksp.processing.CodeGenerator
|
||||
import com.google.devtools.ksp.processing.Dependencies
|
||||
import com.google.devtools.ksp.processing.KSPLogger
|
||||
import com.google.devtools.ksp.symbol.KSFile
|
||||
import com.google.devtools.ksp.symbol.KSFunctionDeclaration
|
||||
@@ -10,8 +11,8 @@ import com.google.devtools.ksp.symbol.KSVisitorVoid
|
||||
import com.squareup.kotlinpoet.*
|
||||
import com.squareup.kotlinpoet.ksp.KotlinPoetKspPreview
|
||||
import com.squareup.kotlinpoet.ksp.writeTo
|
||||
import me.redtea.carcadex.genref.plugin.annotations.OnDisable
|
||||
import me.redtea.carcadex.genref.plugin.annotations.Plugin
|
||||
import tech.carcadex.kotlinbukkitkit.genref.plugin.annotations.OnDisable
|
||||
import tech.carcadex.kotlinbukkitkit.genref.plugin.annotations.Plugin
|
||||
import tech.carcadex.kotlinbukkitkit.architecture.KotlinPlugin
|
||||
|
||||
@OptIn(KotlinPoetKspPreview::class)
|
||||
@@ -54,10 +55,9 @@ class PluginVisitor(private val codeGenerator: CodeGenerator,
|
||||
.build()
|
||||
)
|
||||
}.build()
|
||||
try {
|
||||
fileSpec.writeTo(codeGenerator, true)
|
||||
} catch (ignored: FileAlreadyExistsException) {
|
||||
}
|
||||
|
||||
//todo try catch?
|
||||
fileSpec.writeTo(codeGenerator, Dependencies(false))
|
||||
}
|
||||
|
||||
@OptIn(KspExperimental::class)
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package me.redtea.carcadex.genref.plugin.annotations
|
||||
package tech.carcadex.kotlinbukkitkit.genref.plugin.annotations
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package me.redtea.carcadex.genref.plugin.annotations
|
||||
package tech.carcadex.kotlinbukkitkit.genref.plugin.annotations
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package me.redtea.carcadex.genref.processor
|
||||
package tech.carcadex.kotlinbukkitkit.genref.processor
|
||||
|
||||
import com.google.devtools.ksp.KspExperimental
|
||||
import com.google.devtools.ksp.isAnnotationPresent
|
||||
@@ -9,8 +9,8 @@ import com.google.devtools.ksp.processing.SymbolProcessor
|
||||
import com.google.devtools.ksp.symbol.KSAnnotated
|
||||
import com.google.devtools.ksp.symbol.KSFunctionDeclaration
|
||||
import com.google.devtools.ksp.validate
|
||||
import me.redtea.carcadex.genref.plugin.PluginVisitor
|
||||
import me.redtea.carcadex.genref.plugin.annotations.Plugin
|
||||
import tech.carcadex.kotlinbukkitkit.genref.plugin.PluginVisitor
|
||||
import tech.carcadex.kotlinbukkitkit.genref.plugin.annotations.Plugin
|
||||
|
||||
class GenRefProcessor(private val codeGenerator: CodeGenerator,
|
||||
private val logger: KSPLogger) : SymbolProcessor {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package me.redtea.carcadex.genref.processor
|
||||
package tech.carcadex.kotlinbukkitkit.genref.processor
|
||||
|
||||
import com.google.devtools.ksp.processing.SymbolProcessor
|
||||
import com.google.devtools.ksp.processing.SymbolProcessorEnvironment
|
||||
+1
-1
@@ -1 +1 @@
|
||||
me.redtea.carcadex.genref.processor.ProcessorProvider
|
||||
tech.carcadex.kotlinbukkitkit.genref.processor.ProcessorProvider
|
||||
@@ -76,12 +76,12 @@ publishing {
|
||||
version = version
|
||||
name.set(globalArtifactId)
|
||||
description.set(globalArtifactId)
|
||||
url.set("https://github.com/iRedTea/CarcadeX")
|
||||
url.set("https://github.com/CarcadeX/KotlinBukkitKit")
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name.set("GNU General Public License v3.0")
|
||||
url.set("https://www.gnu.org/licenses/gpl-3.0.en.html")
|
||||
name.set("MIT")
|
||||
url.set("https://mit-license.org/")
|
||||
}
|
||||
}
|
||||
developers {
|
||||
@@ -94,7 +94,7 @@ publishing {
|
||||
scm {
|
||||
connection.set("scm:https://github.com/CarcadeX/$globalName.git")
|
||||
developerConnection.set("git@github.com:CarcadeX/$globalName.git")
|
||||
url.set("https://github.com/iRedTea/CarcadeX")
|
||||
url.set("https://github.com/CarcadeX/KotlinBukkitKit")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -1,13 +1,13 @@
|
||||
package me.redtea.carcadex.messages.container;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.container;
|
||||
|
||||
import me.redtea.carcadex.messages.factory.impl.MessageFactoryImpl;
|
||||
import me.redtea.carcadex.messages.model.Message;
|
||||
import me.redtea.carcadex.messages.container.impl.MessagesImpl;
|
||||
import me.redtea.carcadex.messages.factory.MessageFactory;
|
||||
import me.redtea.carcadex.messages.factory.impl.LegacyFactoryImpl;
|
||||
import me.redtea.carcadex.messages.model.impl.NullMessage;
|
||||
import me.redtea.carcadex.messages.verifier.MessageVerifier;
|
||||
import me.redtea.carcadex.messages.verifier.impl.FileMessageVerifier;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.factory.impl.MessageFactoryImpl;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.Message;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.container.impl.MessagesImpl;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.factory.MessageFactory;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.factory.impl.LegacyFactoryImpl;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.impl.NullMessage;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.verifier.MessageVerifier;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.verifier.impl.FileMessageVerifier;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
package me.redtea.carcadex.messages.container.impl;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.container.impl;
|
||||
|
||||
import me.redtea.carcadex.messages.container.Messages;
|
||||
import me.redtea.carcadex.messages.model.Message;
|
||||
import me.redtea.carcadex.messages.factory.MessageFactory;
|
||||
import me.redtea.carcadex.messages.model.impl.NullMessage;
|
||||
import me.redtea.carcadex.messages.verifier.MessageVerifier;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.container.Messages;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.Message;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.factory.MessageFactory;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.impl.NullMessage;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.verifier.MessageVerifier;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package me.redtea.carcadex.messages.factory;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.factory;
|
||||
|
||||
import me.redtea.carcadex.messages.container.Messages;
|
||||
import me.redtea.carcadex.messages.model.Message;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.container.Messages;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.Message;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
package me.redtea.carcadex.messages.factory.impl;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.factory.impl;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.redtea.carcadex.messages.model.Message;
|
||||
import me.redtea.carcadex.messages.utils.MD5ColorUtils;
|
||||
import me.redtea.carcadex.messages.factory.MessageFactory;
|
||||
import me.redtea.carcadex.messages.model.impl.serialized.impl.LegacyMessage;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.Message;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.utils.MD5ColorUtils;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.factory.MessageFactory;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.impl.serialized.impl.LegacyMessage;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.List;
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
package me.redtea.carcadex.messages.factory.impl;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.factory.impl;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.redtea.carcadex.messages.model.Message;
|
||||
import me.redtea.carcadex.messages.utils.MD5ColorUtils;
|
||||
import me.redtea.carcadex.messages.factory.MessageFactory;
|
||||
import me.redtea.carcadex.messages.model.impl.ComponentMessage;
|
||||
import me.redtea.carcadex.messages.model.impl.serialized.impl.LegacyMessage;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.Message;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.utils.MD5ColorUtils;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.factory.MessageFactory;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.impl.ComponentMessage;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.impl.serialized.impl.LegacyMessage;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.List;
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
package me.redtea.carcadex.messages.kotlin
|
||||
package tech.carcadex.kotlinbukkitkit.messages.kotlin
|
||||
|
||||
import me.redtea.carcadex.messages.container.Messages
|
||||
import me.redtea.carcadex.messages.model.Message
|
||||
import me.redtea.carcadex.messages.verifier.MessageVerifier
|
||||
import tech.carcadex.kotlinbukkitkit.messages.container.Messages
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.Message
|
||||
import tech.carcadex.kotlinbukkitkit.messages.verifier.MessageVerifier
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.plugin.Plugin
|
||||
import java.io.File
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package me.redtea.carcadex.messages.kotlin
|
||||
package tech.carcadex.kotlinbukkitkit.messages.kotlin
|
||||
|
||||
import dev.triumphteam.gui.builder.item.ItemBuilder
|
||||
import me.redtea.carcadex.messages.model.Message
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.Message
|
||||
|
||||
fun ItemBuilder.name(message: Message) = this.name(message.asComponent())
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package me.redtea.carcadex.messages.model;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.model;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package me.redtea.carcadex.messages.model;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.model;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import net.kyori.adventure.text.Component;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package me.redtea.carcadex.messages.model.impl;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.model.impl;
|
||||
|
||||
import me.redtea.carcadex.messages.model.AbstractMessage;
|
||||
import me.redtea.carcadex.messages.model.Message;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.AbstractMessage;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.Message;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package me.redtea.carcadex.messages.model.impl;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.model.impl;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import me.redtea.carcadex.messages.model.Message;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.Message;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package me.redtea.carcadex.messages.model.impl.serialized;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.model.impl.serialized;
|
||||
|
||||
import me.redtea.carcadex.messages.model.AbstractMessage;
|
||||
import me.redtea.carcadex.messages.model.Message;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.AbstractMessage;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.Message;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package me.redtea.carcadex.messages.model.impl.serialized.impl;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.model.impl.serialized.impl;
|
||||
|
||||
import me.redtea.carcadex.messages.model.impl.serialized.SerializedMessage;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.model.impl.serialized.SerializedMessage;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package me.redtea.carcadex.messages.utils;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.utils;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package me.redtea.carcadex.messages.verifier;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.verifier;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package me.redtea.carcadex.messages.verifier.impl;
|
||||
package tech.carcadex.kotlinbukkitkit.messages.verifier.impl;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import me.redtea.carcadex.messages.verifier.MessageVerifier;
|
||||
import tech.carcadex.kotlinbukkitkit.messages.verifier.MessageVerifier;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -69,12 +69,12 @@ publishing {
|
||||
version = version
|
||||
name.set(globalArtifactId)
|
||||
description.set(globalArtifactId)
|
||||
url.set("https://github.com/iRedTea/CarcadeX")
|
||||
url.set("https://github.com/CarcadeX/KotlinBukkitKit")
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name.set("GNU General Public License v3.0")
|
||||
url.set("https://www.gnu.org/licenses/gpl-3.0.en.html")
|
||||
name.set("MIT")
|
||||
url.set("https://mit-license.org/")
|
||||
}
|
||||
}
|
||||
developers {
|
||||
@@ -87,7 +87,7 @@ publishing {
|
||||
scm {
|
||||
connection.set("scm:https://github.com/CarcadeX/$globalName.git")
|
||||
developerConnection.set("git@github.com:CarcadeX/$globalName.git")
|
||||
url.set("https://github.com/iRedTea/CarcadeX")
|
||||
url.set("https://github.com/CarcadeX/KotlinBukkitKit")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,3 +6,4 @@ include("extensions")
|
||||
include("serialization")
|
||||
include("genref")
|
||||
include("messages")
|
||||
include("commands")
|
||||
Reference in new issue
Block a user