Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd40faf351 | ||
|
|
afae8f211b | ||
|
|
6c5c2b99a8 | ||
|
|
7fe976c4dd | ||
|
|
a2040e484f | ||
|
|
8790f079ce | ||
|
|
554bddba45 | ||
|
|
2f594fc0a5 | ||
|
|
78ee8527b4 | ||
|
|
98e90565c4 | ||
|
|
8c6adfd18a | ||
|
|
e61c1d2657 | ||
|
|
b4b211e318 | ||
|
|
8e16b05c76 | ||
|
|
5532f33f82 | ||
|
|
68ce448030 | ||
|
|
51090f4e1d | ||
|
|
6a421a7078 | ||
|
|
b9050a46a9 | ||
|
|
3a4c03affe | ||
|
|
7430e35ec2 | ||
|
|
dc13279d44 | ||
|
|
fad61ee007 | ||
|
|
ef23b69d9c | ||
|
|
5b7003d400 | ||
|
|
e592daad57 | ||
|
|
c5aaa19367 | ||
|
|
c2d0dd3a01 | ||
|
|
5f8b203489 | ||
|
|
3f47bfadce | ||
|
|
de20133533 | ||
|
|
9ceada1f59 | ||
|
|
fd2b51cc85 | ||
|
|
a43f27923e | ||
|
|
12e76b7316 | ||
|
|
12d54b3188 |
No files matched your search
@@ -1,22 +1,12 @@
|
||||
# KotlinBukkitAPI-Tooling
|
||||
|
||||
[](https://plugins.jetbrains.com/plugin/14913-kotlinbukkitapi-tooling/)
|
||||
[](https://red-tea.gitbook.io/kotlinbukkitkit/genref/getting-started-with-idea-plugin)
|
||||
|
||||
The KotlinBukkitAPI Tooling is plugin for IntelliJ that helps developers using [KotlinBukkitAPI](https://github.com/DevSrSouza/KotlinBukkitAPI) and scripts for [Bukkript](https://github.com/DevSrSouza/Bukkript).
|
||||
The KotlinBukkitKit Tooling is plugin for IntelliJ that helps developers using [KotlinBukkitKIT](https://github.com/CarcadeX/KotlinBukkitKit)<br>
|
||||
Check also <a href="https://github.com/CarcadeX/KBK-Menu-Preview">MenuPreview plugin</a>
|
||||
|
||||
## Features
|
||||
|
||||
- [Menu Preview](#Menu-Preview)
|
||||
- Tooling for [Bukkript Scripts](#Bukkript-Script).
|
||||
- Generator of KotlinBukkitKIT project
|
||||
|
||||
## Menu Preview
|
||||
|
||||
When using KotlinBukkitAPI Menu DSL you have a good preview of how the slots are arranged in the Menu in the game.
|
||||
|
||||

|
||||
|
||||
## [Bukkript Script](https://github.com/DevSrSouza/Bukkript/)
|
||||
|
||||
The plugin provides out of the box Bukkript Script resolution (`.bk.kts` files).
|
||||
|
||||

|
||||
<img src="https://red-tea.gitbook.io/~gitbook/image?url=https:%2F%2F630270463-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F1PBqxCHnbDKJwzj8IhJk%252Fuploads%252Fo2jPveKWzw47uGTxMm2Q%252Fimage.png%3Falt=media%26token=403c70a1-fa12-435d-99c2-aab79493de97&width=400&dpr=3&quality=100&sign=5ca18a6e18c88ceb0b5a355577cfb45cadea88b46003ac032ac4f52d7cfe52b0">
|
||||
@@ -1,91 +1,109 @@
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
id("org.jetbrains.intellij") version "0.4.21"
|
||||
id("org.jetbrains.intellij") version "1.17.2"
|
||||
java
|
||||
kotlin("jvm") version "1.4.0"
|
||||
kotlin("jvm") version "1.9.0"
|
||||
}
|
||||
|
||||
val kotlinVersion = "1.4.0"
|
||||
val kotlinBukkitAPIVersion = "0.1.0-SNAPSHOT"
|
||||
val bukkriptVersion = "0.1.0-SNAPSHOT"
|
||||
val kotlinVersion = "1.9.0"
|
||||
val kotlinBukkitAPIVersion = "1.0.0.2"
|
||||
|
||||
group = "br.com.devsrsouza.kotlinbukkitapi"
|
||||
version = "0.0.2"
|
||||
group = "tech.carcadex.kotlinbukkitkit"
|
||||
version = "0.0.3"
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
maven("http://nexus.devsrsouza.com.br/repository/maven-public/")
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib-jdk8"))
|
||||
|
||||
val changing = Action<ExternalModuleDependency> { isChanging = true }
|
||||
api("br.com.devsrsouza.bukkript:script-definition-embedded:$bukkriptVersion", changing)
|
||||
|
||||
testCompile("junit", "junit", "4.12")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.0")
|
||||
}
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = "2020.1.2"
|
||||
|
||||
setPlugins("java", "Kotlin")
|
||||
// version = "2023.3.3"
|
||||
version.set("2023.3.3")
|
||||
plugins.set(listOf("java", "Kotlin"))
|
||||
}
|
||||
|
||||
configure<JavaPluginConvention> {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "17"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
tasks {
|
||||
compileJava {
|
||||
sourceCompatibility = "17"
|
||||
targetCompatibility = "17"
|
||||
}
|
||||
jar {
|
||||
duplicatesStrategy = (DuplicatesStrategy.EXCLUDE)
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
compileKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
compileTestKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
runIde {
|
||||
jbrVersion.set("jbr_jcef-17.0.9-windows-x64-b1087.11")
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
publishPlugin {
|
||||
token = System.getenv("ORG_GRADLE_PROJECT_intellijPublishToken")
|
||||
token.set(System.getenv("ORG_GRADLE_PROJECT_intellijPublishToken"))
|
||||
channels.set(listOf("stable"))
|
||||
}
|
||||
}
|
||||
tasks.getByName<org.jetbrains.intellij.tasks.PatchPluginXmlTask>("patchPluginXml") {
|
||||
sinceBuild("201")
|
||||
untilBuild("202.*")
|
||||
|
||||
pluginDescription("""
|
||||
|
||||
pluginDescription.set("""
|
||||
<img src="https://github.com/DevSrSouza/KotlinBukkitAPI/raw/master/logo.png" width="417" height="161"/>
|
||||
|
||||
|
||||
<br />
|
||||
|
||||
The KotlinBukkitAPI Tooling is plugin for IntelliJ that helps developers using <a href="https://github.com/DevSrSouza/KotlinBukkitAPI">KotlinBukkitAPI</a> and scripts for <a href="https://github.com/DevSrSouza/Bukkript">Bukkript</a>. This libraries help build extensions for Minecraft Server using Spigot server.
|
||||
|
||||
The KotlinBukkitKit Tooling is plugin for IntelliJ that helps
|
||||
<br />
|
||||
developers using <a href="https://github.com/CarcadeX/KotlinBukkitKit-Tooling</a>.
|
||||
<br />
|
||||
This libraries help build extensions for Minecraft Server using Spigot server.
|
||||
|
||||
<br />
|
||||
|
||||
<img src="https://img.shields.io/static/v1?label=Kotlin&message=${kotlinVersion}&color=Orange&style=for-the-badge" />
|
||||
<a href="https://github.com/DevSrSouza/KotlinBukkitAPI"><img src="https://img.shields.io/static/v1?label=KotlinBukkitAPI&message=${kotlinBukkitAPIVersion}&color=Orange&style=for-the-badge" /></a>
|
||||
<a href="https://github.com/DevSrSouza/Bukkript"><img src="https://img.shields.io/static/v1?label=Bukkript&message=${bukkriptVersion}&color=Orange&style=for-the-badge" /></a>
|
||||
<img src="https://img.shields.io/github/stars/DevSrSouza/KotlinBukkitAPI-Tooling.svg?style=for-the-badge&color=orange&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAADYklEQVR4XuWbvbPNQBiHn9uo6NFT0GEYHa0/QofOR2MojI8xxmh8VFwVf4RaxTB0KOhdPRUF8zPJmdy1J3l3N9ndxDb3zr0n2exzfu/zJjk5G5Qdh5vp35c6jI1SEzfzbgK/gXOljqMkgF3A1wbAXuBHCQglAehdf9wsWr8rDdlHSQCq+0MdBxzJvnqgFADJ752zYAHILsNSABT3Mw4A/S27DEsAaOW30wHwHcguwxIAuvJzyz67DEsA6MrPBaD/ZZVhbgA++bkQssowNwCf/FwAWWWYE8A6+bkAssowJ4A++RWTYU4AffIrJsNcACzyKyLDXAAs8isiwxwArPIrIsMcAELkl12GOQCEyC+7DAUgpj5LXLpPMeemAOwAXgLHp5ih4n2+Ak62JbCnuRmhn//D2ALUmre6DlAClAQlYsnjJ3ACeK1FuhI8CzxZ8uqbu06rG7C+LrBkKf5zpekDsFQp/pUeoBJYjXXnAUuT4kp6bnn3nQgtRYrbpBcCQK9dghR7b7RaToXnLMXB22sWAHOVold6oSXQvn5uUlwrvVgA2m4uUuyVXgqAuUgx6NMliwN8t6rcDzZrOXselF5qArR9rVI0SW8MANpHbVI0S28sADVJMUh6YwKoRYpB0hsbwEHgQ2ED6hg+xR5DTBfoznUDuB47+Ujb6Rhuxu4rFcBH4EDs5CNtp3dfKYgaKQBqiH+76OgySAFQQ/xbANFlkAKghvi3AKLLIBZATfFPKoNYADXFP6kMYgHUFP+kMogBUGP8o8sgBsBY8f8MXGqO/D6wP6qRb98ouBvEAEiNvx6DuwU8BH41x69L7AvANUBPlMSO4G4QCiAl/vpqzDPgKvBtzQp3A3eB0wmP8gedFIUCiI3/G+A88Nb41h4DHgFHja93r0/M1wahAELjr3f6CvC8+W5QyHp0bEqCEqFkWEdQGYQACIm/blI8AG4DqvmUISfIDXKE9dkFcxmEALDG/wVwEfiSsmrPtvsaqKcM+zV3gxAAQ/Fv25oATDkEYKhtmsvACqAv/r62NiUA7dvSNk1lYAXgi7+lrU0Noq9tmsrACsCNf2hbmxqEr22aysACoBv/lLY2NQRf2xwsAwsARUlnb2O1talBdNvmnaEbphYA94CnE7S1qUGobeozzMt9E/0BUX274HXoySkAAAAASUVORK5CYII=" />
|
||||
<img src="https://img.shields.io/badge/license-MIT-blue.svg?color=ORANGE&style=for-the-badge" />
|
||||
|
||||
<br />
|
||||
|
||||
|
||||
<ul>
|
||||
<li><a href='https://github.com/DevSrSouza/Bukkript'>Bukkript</a></li>
|
||||
|
||||
<li<a href='https://github.com/CarcadeX/KotlinBukkitKit'>KotlinBukkitKit</a></li>
|
||||
<li<a href='https://github.com/DevSrSouza/KotlinBukkitAPI-Tooling'>KotlinBukkitAPI-Tooling (this plugin)</a></li>
|
||||
<li<a href='https://github.com/DevSrSouza/KotlinBukkitAPI'>KotlinBukkitAPI</a></li>
|
||||
<li><a href='https://github.com/KotlinMinecraft/KotlinBukkitAPI-Examples'>KotlinBukkitAPI Examples</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<h3>Demonstration</h3>
|
||||
|
||||
|
||||
|
||||
<br />
|
||||
|
||||
<img src="https://i.imgur.com/exlwVUs.gif" width='680' height='390'/>
|
||||
""".trimIndent())
|
||||
|
||||
|
||||
changeNotes.set("""
|
||||
<h3>0.0.1</h3>
|
||||
|
||||
<ul>
|
||||
<li>KotlinBukkitAPI Project Wizard</li>
|
||||
<li>Menu Preview tab only avaiable on projects that was KotlinBukkitAPI.</li>
|
||||
</ul>
|
||||
""".trimIndent())
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy.cacheChangingModulesFor(120, "seconds")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,2 +1,2 @@
|
||||
rootProject.name = "KotlinBukkitAPI-Tooling"
|
||||
rootProject.name = "KotlinBukkitKit-Tooling"
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling
|
||||
|
||||
import com.intellij.ui.IconManager
|
||||
import javax.swing.Icon
|
||||
|
||||
object Assets {
|
||||
private fun load(path: String): Icon {
|
||||
return IconManager.getInstance().getIcon(path, Assets::class.java)
|
||||
}
|
||||
|
||||
private const val assetFolder = "/assets"
|
||||
|
||||
val KotlinBukkitAPIIcon =
|
||||
load("$assetFolder/icons/kotlinbukkitapi-icon.svg")
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling.bukkript
|
||||
|
||||
import com.intellij.ide.actions.CreateFileFromTemplateAction
|
||||
import com.intellij.ide.actions.CreateFileFromTemplateDialog
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiDirectory
|
||||
import com.intellij.psi.PsiFile
|
||||
|
||||
class BukkriptCreateNewFileAction : CreateFileFromTemplateAction(
|
||||
BUKKRIPT_SCRIPT,
|
||||
BUKKRIPT_DESCRIPTION,
|
||||
BukkriptFileType.INSTANCE.icon
|
||||
) {
|
||||
override fun getActionName(
|
||||
directory: PsiDirectory?,
|
||||
newName: String,
|
||||
templateName: String?
|
||||
): String = BUKKRIPT_CREATE_SCRIPT_DESCRIPTION
|
||||
|
||||
override fun createFile(
|
||||
name: String,
|
||||
templateName: String,
|
||||
dir: PsiDirectory
|
||||
): PsiFile? = super.createFile("$name.bk", templateName, dir)
|
||||
|
||||
override fun buildDialog(
|
||||
project: Project,
|
||||
directory: PsiDirectory,
|
||||
builder: CreateFileFromTemplateDialog.Builder
|
||||
) {
|
||||
builder.setTitle(BUKKRIPT_SCRIPT)
|
||||
.addKind(
|
||||
BUKKRIPT_FILE,
|
||||
BukkriptFileType.INSTANCE.icon,
|
||||
BUKKRIPT_SCRIPT
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling.bukkript
|
||||
|
||||
import br.com.devsrsouza.kotlinbukkitapi.tooling.Assets
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType
|
||||
import com.intellij.openapi.fileTypes.ex.FileTypeIdentifiableByVirtualFile
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import javax.swing.Icon
|
||||
|
||||
class BukkriptFileType : LanguageFileType(KotlinLanguage.INSTANCE), FileTypeIdentifiableByVirtualFile {
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val INSTANCE = BukkriptFileType()
|
||||
}
|
||||
|
||||
override fun getIcon(): Icon? = Assets.KotlinBukkitAPIIcon
|
||||
|
||||
override fun getName(): String = BUKKRIPT_FILE
|
||||
|
||||
override fun getDefaultExtension(): String = BUKKRIPT_EXTENSION
|
||||
|
||||
override fun getDescription(): String = BUKKRIPT_DESCRIPTION
|
||||
|
||||
override fun isMyFileType(file: VirtualFile): Boolean = file.name.isBukkriptScript()
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling.bukkript
|
||||
|
||||
import com.intellij.ide.IconProvider
|
||||
import com.intellij.openapi.project.DumbAware
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiFile
|
||||
import javax.swing.Icon
|
||||
|
||||
class BukkriptIconProvider : IconProvider(), DumbAware {
|
||||
override fun getIcon(element: PsiElement, flags: Int): Icon? {
|
||||
if(element is PsiFile && element.name.isBukkriptScript()) {
|
||||
return BukkriptFileType.INSTANCE.icon
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling.bukkript
|
||||
|
||||
import org.jetbrains.kotlin.utils.PathUtil
|
||||
import java.io.File
|
||||
import kotlin.script.experimental.intellij.ScriptDefinitionsProvider
|
||||
import br.com.devsrsouza.bukkript.script.definition.BukkriptScript
|
||||
|
||||
class BukkriptScriptDefinitionProvider : ScriptDefinitionsProvider {
|
||||
|
||||
companion object {
|
||||
const val ID = "BukkriptScriptDefinition"
|
||||
}
|
||||
|
||||
override val id: String
|
||||
get() = ID
|
||||
|
||||
override fun getDefinitionClasses(): Iterable<String> {
|
||||
return listOf("br.com.devsrsouza.bukkript.script.definition.BukkriptScript")
|
||||
}
|
||||
|
||||
override fun getDefinitionsClassPath(): Iterable<File> {
|
||||
val jarFile = PathUtil.getResourcePathForClass(BukkriptScript::class.java)
|
||||
|
||||
return listOf(jarFile)
|
||||
}
|
||||
|
||||
override fun useDiscovery(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling.bukkript
|
||||
|
||||
const val BUKKRIPT_EXTENSION = "bk.kts"
|
||||
|
||||
const val BUKKRIPT_SCRIPT = "Bukkript Script"
|
||||
const val BUKKRIPT_FILE = "Bukkript File"
|
||||
const val BUKKRIPT_DESCRIPTION = "Bukkript Script File for Bukkit"
|
||||
const val BUKKRIPT_CREATE_SCRIPT_DESCRIPTION = "Create Bukkript Script"
|
||||
@@ -1,3 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling.bukkript
|
||||
|
||||
fun String.isBukkriptScript() = endsWith(".$BUKKRIPT_EXTENSION", true)
|
||||
@@ -1,14 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling.menu
|
||||
|
||||
data class MenuDeclaration(
|
||||
val displayname: String,
|
||||
val lines: Int,
|
||||
val slots: List<MenuSlotDeclaration>
|
||||
)
|
||||
|
||||
data class MenuSlotDeclaration(
|
||||
val line: Int,
|
||||
val slot: Int,
|
||||
val itemId: Int?,
|
||||
val isSelected: Boolean = false
|
||||
)
|
||||
@@ -1,107 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling.menu
|
||||
|
||||
import com.intellij.util.ImageLoader
|
||||
import org.jetbrains.kotlin.utils.keysToMap
|
||||
import java.awt.*
|
||||
import javax.swing.JPanel
|
||||
|
||||
class InventoryComponent(
|
||||
val declaration: MenuDeclaration
|
||||
) : JPanel() {
|
||||
companion object {
|
||||
val CHEST_SCALE = 2
|
||||
val CHEST_SINGLE_LINE_HEIGHT = 42
|
||||
val CHEST_LINE_DIFF = 18
|
||||
val CHEST_WIDTH = 176
|
||||
|
||||
private val minecraftFontResource = "/assets/fonts/Minecraftia-Regular.ttf"
|
||||
private val spritesFolder = "/assets/sprites"
|
||||
private val itemsSpriteFolder = "/assets/items"
|
||||
|
||||
// the selected-border is 36x36 and not 32x32
|
||||
private val selectedBorderSizeDiff = 2
|
||||
}
|
||||
|
||||
private val lines = when {
|
||||
declaration.lines > 6 -> 6
|
||||
declaration.lines < 1 -> 1
|
||||
else -> declaration.lines
|
||||
}
|
||||
|
||||
private val spriteImage = ImageLoader.loadFromResource(
|
||||
"$spritesFolder/chest-${lines}.png"
|
||||
)!!
|
||||
private val itemsImage = declaration.slots.filter {
|
||||
it.line in 1..declaration.lines && it.slot in 1..9
|
||||
}.keysToMap {
|
||||
ImageLoader.loadFromResource("$itemsSpriteFolder/${it.itemId}-0.png")
|
||||
//?.getScaledInstance(16, 16, Image.SCALE_FAST)
|
||||
}
|
||||
private val selectionImage = if(declaration.slots.any { it.isSelected })
|
||||
ImageLoader.loadFromResource("$spritesFolder/selected-border.png")
|
||||
else null
|
||||
|
||||
private val minecraftFont = Font.createFont(
|
||||
Font.TRUETYPE_FONT,
|
||||
this::class.java.getResource(minecraftFontResource).openStream()
|
||||
).deriveFont(18.5f)
|
||||
|
||||
init {
|
||||
isVisible = true
|
||||
minimumSize = calculateDimension()
|
||||
}
|
||||
override fun paintComponent(g: Graphics) {
|
||||
val g = g as Graphics2D
|
||||
val oldTransform = g.transform
|
||||
|
||||
// drawing menu
|
||||
g.scale(CHEST_SCALE.toDouble(), CHEST_SCALE.toDouble())
|
||||
g.drawImage(spriteImage, 0, 0,this)
|
||||
|
||||
g.transform = oldTransform
|
||||
|
||||
// drawing items
|
||||
for ((slot, texture) in itemsImage) {
|
||||
val (x, y) = calculateXYForSlot(slot)
|
||||
|
||||
g.drawImage(texture ?: continue, x, y, this)
|
||||
|
||||
// if is selected draw selection border
|
||||
if(slot.isSelected) {
|
||||
g.drawImage(
|
||||
selectionImage ?: continue,
|
||||
x- selectedBorderSizeDiff,
|
||||
y- selectedBorderSizeDiff,
|
||||
this
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// drawing displayname
|
||||
g.font = minecraftFont
|
||||
g.color = Color.DARK_GRAY
|
||||
g.drawString(declaration.displayname, 16, 40)
|
||||
}
|
||||
|
||||
fun calculateXYForSlot(menuSlotDeclaration: MenuSlotDeclaration): Pair<Int, Int> {
|
||||
val topXPadding = 18 * CHEST_SCALE
|
||||
val leftYPadding = 8 * CHEST_SCALE
|
||||
val itemSize = 16 * CHEST_SCALE
|
||||
val rightYPadding = 2 * CHEST_SCALE
|
||||
val bottomXPadding = 2 * CHEST_SCALE
|
||||
|
||||
val itemXPos = menuSlotDeclaration.line -1
|
||||
val itemYPos = menuSlotDeclaration.slot -1
|
||||
|
||||
val x = leftYPadding + (itemYPos * rightYPadding) + (itemYPos * itemSize)
|
||||
val y = topXPadding + (itemXPos * bottomXPadding) + (itemXPos * itemSize)
|
||||
|
||||
return x to y
|
||||
}
|
||||
|
||||
private fun calculateDimension(): Dimension {
|
||||
val height = CHEST_SINGLE_LINE_HEIGHT + (lines - 1) * CHEST_LINE_DIFF
|
||||
|
||||
return Dimension((CHEST_WIDTH * CHEST_SCALE).toInt(), (height * CHEST_SCALE).toInt())
|
||||
}
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling.menu
|
||||
|
||||
import com.intellij.openapi.editor.event.CaretEvent
|
||||
import com.intellij.openapi.editor.event.CaretListener
|
||||
import com.intellij.openapi.editor.event.DocumentEvent
|
||||
import com.intellij.openapi.editor.event.DocumentListener
|
||||
import com.intellij.openapi.fileEditor.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.UserDataHolderBase
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.psi.util.forEachDescendantOfType
|
||||
import com.intellij.ui.components.JBScrollPane
|
||||
import com.intellij.ui.layout.panel
|
||||
import com.intellij.util.Alarm
|
||||
import org.jetbrains.kotlin.psi.KtCallExpression
|
||||
import java.awt.*
|
||||
import java.beans.PropertyChangeListener
|
||||
import javax.swing.*
|
||||
|
||||
class MenuPreviewFileEditor(
|
||||
private val myProject: Project,
|
||||
private val myFile: VirtualFile,
|
||||
private val mainEditor: TextEditor
|
||||
) : UserDataHolderBase(), FileEditor {
|
||||
|
||||
private val mySwingAlarm = Alarm(Alarm.ThreadToUse.SWING_THREAD, this)
|
||||
private val myDocument = FileDocumentManager.getInstance().getDocument(myFile)!!
|
||||
private val myUi = JPanel().apply {
|
||||
layout = BorderLayout()
|
||||
isVisible = true
|
||||
minimumSize = Dimension(
|
||||
InventoryComponent.CHEST_WIDTH * InventoryComponent.CHEST_SCALE + 10,
|
||||
0
|
||||
)
|
||||
}
|
||||
|
||||
private lateinit var currentScroll: JBScrollPane
|
||||
private var currentSelectedLine: Int? = null
|
||||
|
||||
init {
|
||||
rebuild(null)
|
||||
|
||||
// listen to the source code changes to rebuild the UI
|
||||
myDocument.addDocumentListener(object : DocumentListener {
|
||||
override fun beforeDocumentChange(event: DocumentEvent) {
|
||||
mySwingAlarm.cancelAllRequests()
|
||||
}
|
||||
override fun documentChanged(event: DocumentEvent) {
|
||||
mySwingAlarm.addRequest({
|
||||
rebuild(currentScroll.viewport.viewPosition)
|
||||
}, 50)
|
||||
}
|
||||
})
|
||||
|
||||
// listen to cursor changes to make a slot selectable
|
||||
mainEditor.editor.caretModel.addCaretListener(object : CaretListener {
|
||||
override fun caretPositionChanged(event: CaretEvent) {
|
||||
currentSelectedLine = event.newPosition.line
|
||||
rebuild(currentScroll.viewport.viewPosition)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun rebuild(currentViewPosition: Point?) {
|
||||
val tree = PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument) ?: return
|
||||
|
||||
// clear the old UI
|
||||
myUi.removeAll()
|
||||
|
||||
// create the scroll pane with a centralized component with the inventories
|
||||
var menuCount = 0
|
||||
currentScroll = JBScrollPane(
|
||||
panel {
|
||||
tree.forEachDescendantOfType<KtCallExpression> {
|
||||
val declaration =
|
||||
findMenuDeclaration(
|
||||
it,
|
||||
currentSelectedLine
|
||||
)
|
||||
if (declaration != null) {
|
||||
row {
|
||||
component(
|
||||
InventoryComponent(
|
||||
declaration
|
||||
)
|
||||
)
|
||||
}
|
||||
menuCount++
|
||||
}
|
||||
}
|
||||
}.centerComponent(),
|
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
|
||||
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
|
||||
).apply {
|
||||
if(currentViewPosition != null)
|
||||
viewport.viewPosition = currentViewPosition
|
||||
}
|
||||
|
||||
if(menuCount > 0) {
|
||||
// add the scroll pane to the UI
|
||||
myUi.add(
|
||||
currentScroll,
|
||||
BorderLayout.CENTER
|
||||
)
|
||||
} else {
|
||||
myUi.add(
|
||||
JLabel("Currently this source code has no menu declaration!")
|
||||
.centerComponent(),
|
||||
BorderLayout.CENTER
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun isModified(): Boolean = false
|
||||
|
||||
override fun isValid(): Boolean = true
|
||||
|
||||
override fun addPropertyChangeListener(listener: PropertyChangeListener) {
|
||||
|
||||
}
|
||||
|
||||
override fun removePropertyChangeListener(listener: PropertyChangeListener) {
|
||||
}
|
||||
|
||||
override fun getName(): String = "KotlinBukkitAPI Menu Viewer"
|
||||
|
||||
override fun setState(state: FileEditorState) {
|
||||
|
||||
}
|
||||
|
||||
override fun getComponent(): JComponent {
|
||||
return myUi
|
||||
}
|
||||
|
||||
override fun getPreferredFocusedComponent(): JComponent? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getCurrentLocation(): FileEditorLocation? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
mySwingAlarm.cancelAllRequests()
|
||||
}
|
||||
|
||||
private fun JComponent.centerComponent(): JPanel {
|
||||
return JPanel().apply {
|
||||
isVisible = true
|
||||
layout = GridBagLayout()
|
||||
|
||||
add(this@centerComponent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling.menu
|
||||
|
||||
import br.com.devsrsouza.kotlinbukkitapi.tooling.bukkript.BukkriptFileType
|
||||
import com.intellij.openapi.fileEditor.*
|
||||
import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
|
||||
class MenuPreviewFileEditorProvider : WeighedFileEditorProvider() {
|
||||
|
||||
companion object {
|
||||
const val ID = "kotlinbukkitapi-menu-preview"
|
||||
}
|
||||
|
||||
override fun getEditorTypeId(): String =
|
||||
ID
|
||||
|
||||
override fun accept(project: Project, file: VirtualFile): Boolean {
|
||||
|
||||
val type = file.fileType
|
||||
|
||||
if(type != KotlinFileType.INSTANCE && type != BukkriptFileType.INSTANCE) return false
|
||||
|
||||
return true
|
||||
// return PsiManager.getInstance(project).findFile(file)?.findDescendantOfType<KtCallExpression> {
|
||||
// findMenuDeclaration(it) != null
|
||||
// } != null
|
||||
}
|
||||
|
||||
override fun createEditor(project: Project, file: VirtualFile): FileEditor {
|
||||
println(file.canonicalPath)
|
||||
val editor: TextEditor = TextEditorProvider.getInstance().createEditor(project, file) as TextEditor
|
||||
val preview =
|
||||
MenuPreviewFileEditor(project, file, editor)
|
||||
|
||||
return TextEditorWithPreview(editor, preview, "KotlinBukkitAPI")
|
||||
}
|
||||
|
||||
//override fun getPolicy(): FileEditorPolicy = FileEditorPolicy.HIDE_DEFAULT_EDITOR
|
||||
override fun getPolicy(): FileEditorPolicy = FileEditorPolicy.PLACE_AFTER_DEFAULT_EDITOR
|
||||
|
||||
}
|
||||
@@ -1,390 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling.menu
|
||||
|
||||
enum class MinecraftItem(val id: Int) {
|
||||
AIR(0),
|
||||
STONE(1),
|
||||
GRASS(2),
|
||||
DIRT(3),
|
||||
COBBLESTONE(4),
|
||||
WOOD(5),
|
||||
SAPLING(6),
|
||||
BEDROCK(7),
|
||||
WATER(8),
|
||||
STATIONARY_WATER(9),
|
||||
LAVA(10), STATIONARY_LAVA(11),
|
||||
SAND(12),
|
||||
GRAVEL(13),
|
||||
GOLD_ORE(14),
|
||||
IRON_ORE(15),
|
||||
COAL_ORE(16),
|
||||
LOG(17),
|
||||
LEAVES(18),
|
||||
SPONGE(19),
|
||||
GLASS(20),
|
||||
LAPIS_ORE(21),
|
||||
LAPIS_BLOCK(22),
|
||||
DISPENSER(23),
|
||||
SANDSTONE(24),
|
||||
NOTE_BLOCK(25),
|
||||
BED_BLOCK(26),
|
||||
POWERED_RAIL(27),
|
||||
DETECTOR_RAIL(28),
|
||||
PISTON_STICKY_BASE(29),
|
||||
WEB(30),
|
||||
LONG_GRASS(31),
|
||||
DEAD_BUSH(32),
|
||||
PISTON_BASE(33),
|
||||
PISTON_EXTENSION(34),
|
||||
WOOL(35),
|
||||
PISTON_MOVING_PIECE(36),
|
||||
YELLOW_FLOWER(37),
|
||||
RED_ROSE(38),
|
||||
BROWN_MUSHROOM(39),
|
||||
RED_MUSHROOM(40),
|
||||
GOLD_BLOCK(41),
|
||||
IRON_BLOCK(42),
|
||||
DOUBLE_STEP(43),
|
||||
STEP(44),
|
||||
BRICK(45),
|
||||
TNT(46),
|
||||
BOOKSHELF(47),
|
||||
MOSSY_COBBLESTONE(48),
|
||||
OBSIDIAN(49),
|
||||
TORCH(50),
|
||||
FIRE(51),
|
||||
MOB_SPAWNER(52),
|
||||
WOOD_STAIRS(53),
|
||||
CHEST(54),
|
||||
REDSTONE_WIRE(55),
|
||||
DIAMOND_ORE(56),
|
||||
DIAMOND_BLOCK(57),
|
||||
WORKBENCH(58),
|
||||
CROPS(59),
|
||||
SOIL(60),
|
||||
FURNACE(61),
|
||||
BURNING_FURNACE(62),
|
||||
SIGN_POST(63),
|
||||
WOODEN_DOOR(64),
|
||||
LADDER(65),
|
||||
RAILS(66),
|
||||
COBBLESTONE_STAIRS(67),
|
||||
WALL_SIGN(68),
|
||||
LEVER(69),
|
||||
STONE_PLATE(70),
|
||||
IRON_DOOR_BLOCK(71),
|
||||
WOOD_PLATE(72),
|
||||
REDSTONE_ORE(73),
|
||||
GLOWING_REDSTONE_ORE(74),
|
||||
REDSTONE_TORCH_OFF(75),
|
||||
REDSTONE_TORCH_ON(76),
|
||||
STONE_BUTTON(77),
|
||||
SNOW(78),
|
||||
ICE(79),
|
||||
SNOW_BLOCK(80),
|
||||
CACTUS(81),
|
||||
CLAY(82),
|
||||
SUGAR_CANE_BLOCK(83),
|
||||
JUKEBOX(84),
|
||||
FENCE(85),
|
||||
PUMPKIN(86),
|
||||
NETHERRACK(87),
|
||||
SOUL_SAND(88),
|
||||
GLOWSTONE(89),
|
||||
PORTAL(90),
|
||||
JACK_O_LANTERN(91),
|
||||
CAKE_BLOCK(92),
|
||||
DIODE_BLOCK_OFF(93),
|
||||
DIODE_BLOCK_ON(94),
|
||||
STAINED_GLASS(95),
|
||||
TRAP_DOOR(96),
|
||||
MONSTER_EGGS(97),
|
||||
SMOOTH_BRICK(98),
|
||||
HUGE_MUSHROOM_1(99),
|
||||
HUGE_MUSHROOM_2(100),
|
||||
IRON_FENCE(101),
|
||||
THIN_GLASS(102),
|
||||
MELON_BLOCK(103),
|
||||
PUMPKIN_STEM(104),
|
||||
MELON_STEM(105),
|
||||
VINE(106),
|
||||
FENCE_GATE(107),
|
||||
BRICK_STAIRS(108),
|
||||
SMOOTH_STAIRS(109),
|
||||
MYCEL(110),
|
||||
WATER_LILY(111),
|
||||
NETHER_BRICK(112),
|
||||
NETHER_FENCE(113),
|
||||
NETHER_BRICK_STAIRS(114),
|
||||
NETHER_WARTS(115),
|
||||
ENCHANTMENT_TABLE(116),
|
||||
BREWING_STAND(117),
|
||||
CAULDRON(118),
|
||||
ENDER_PORTAL(119),
|
||||
ENDER_PORTAL_FRAME(120),
|
||||
ENDER_STONE(121),
|
||||
DRAGON_EGG(122),
|
||||
REDSTONE_LAMP_OFF(123),
|
||||
REDSTONE_LAMP_ON(124),
|
||||
WOOD_DOUBLE_STEP(125),
|
||||
WOOD_STEP(126),
|
||||
COCOA(127),
|
||||
SANDSTONE_STAIRS(128),
|
||||
EMERALD_ORE(129),
|
||||
ENDER_CHEST(130),
|
||||
TRIPWIRE_HOOK(131),
|
||||
TRIPWIRE(132),
|
||||
EMERALD_BLOCK(133),
|
||||
SPRUCE_WOOD_STAIRS(134),
|
||||
BIRCH_WOOD_STAIRS(135),
|
||||
JUNGLE_WOOD_STAIRS(136),
|
||||
COMMAND(137),
|
||||
BEACON(138),
|
||||
COBBLE_WALL(139),
|
||||
FLOWER_POT(140),
|
||||
CARROT(141),
|
||||
POTATO(142),
|
||||
WOOD_BUTTON(143),
|
||||
SKULL(144),
|
||||
ANVIL(145),
|
||||
TRAPPED_CHEST(146),
|
||||
GOLD_PLATE(147),
|
||||
IRON_PLATE(148),
|
||||
REDSTONE_COMPARATOR_OFF(149),
|
||||
REDSTONE_COMPARATOR_ON(150),
|
||||
DAYLIGHT_DETECTOR(151),
|
||||
REDSTONE_BLOCK(152),
|
||||
QUARTZ_ORE(153),
|
||||
HOPPER(154),
|
||||
QUARTZ_BLOCK(155),
|
||||
QUARTZ_STAIRS(156),
|
||||
ACTIVATOR_RAIL(157),
|
||||
DROPPER(158),
|
||||
STAINED_CLAY(159),
|
||||
STAINED_GLASS_PANE(160),
|
||||
LEAVES_2(161),
|
||||
LOG_2(162),
|
||||
ACACIA_STAIRS(163),
|
||||
DARK_OAK_STAIRS(164),
|
||||
SLIME_BLOCK(165),
|
||||
BARRIER(166),
|
||||
IRON_TRAPDOOR(167),
|
||||
PRISMARINE(168),
|
||||
SEA_LANTERN(169),
|
||||
HAY_BLOCK(170),
|
||||
CARPET(171),
|
||||
HARD_CLAY(172),
|
||||
COAL_BLOCK(173),
|
||||
PACKED_ICE(174),
|
||||
DOUBLE_PLANT(175),
|
||||
STANDING_BANNER(176),
|
||||
WALL_BANNER(177),
|
||||
DAYLIGHT_DETECTOR_INVERTED(178),
|
||||
RED_SANDSTONE(179),
|
||||
RED_SANDSTONE_STAIRS(180),
|
||||
DOUBLE_STONE_SLAB2(181),
|
||||
STONE_SLAB2(182),
|
||||
SPRUCE_FENCE_GATE(183),
|
||||
BIRCH_FENCE_GATE(184),
|
||||
JUNGLE_FENCE_GATE(185),
|
||||
DARK_OAK_FENCE_GATE(186),
|
||||
ACACIA_FENCE_GATE(187),
|
||||
SPRUCE_FENCE(188),
|
||||
BIRCH_FENCE(189),
|
||||
JUNGLE_FENCE(190),
|
||||
DARK_OAK_FENCE(191),
|
||||
ACACIA_FENCE(192),
|
||||
SPRUCE_DOOR(193),
|
||||
BIRCH_DOOR(194),
|
||||
JUNGLE_DOOR(195),
|
||||
ACACIA_DOOR(196),
|
||||
DARK_OAK_DOOR(197),
|
||||
|
||||
// ----- Item Separator -----
|
||||
IRON_SPADE(256),
|
||||
IRON_PICKAXE(257),
|
||||
IRON_AXE(258),
|
||||
FLINT_AND_STEEL(259),
|
||||
APPLE(260),
|
||||
BOW(261),
|
||||
ARROW(262), COAL(263),
|
||||
DIAMOND(264),
|
||||
IRON_INGOT(265),
|
||||
GOLD_INGOT(266),
|
||||
IRON_SWORD(267),
|
||||
WOOD_SWORD(268),
|
||||
WOOD_SPADE(269),
|
||||
WOOD_PICKAXE(270),
|
||||
WOOD_AXE(271),
|
||||
STONE_SWORD(272),
|
||||
STONE_SPADE(273),
|
||||
STONE_PICKAXE(274),
|
||||
STONE_AXE(275),
|
||||
DIAMOND_SWORD(276),
|
||||
DIAMOND_SPADE(277),
|
||||
DIAMOND_PICKAXE(278),
|
||||
DIAMOND_AXE(279),
|
||||
STICK(280),
|
||||
BOWL(281),
|
||||
MUSHROOM_SOUP(282),
|
||||
GOLD_SWORD(283),
|
||||
GOLD_SPADE(284),
|
||||
GOLD_PICKAXE(285),
|
||||
GOLD_AXE(286),
|
||||
STRING(287),
|
||||
FEATHER(288),
|
||||
SULPHUR(289),
|
||||
WOOD_HOE(290),
|
||||
STONE_HOE(291),
|
||||
IRON_HOE(292),
|
||||
DIAMOND_HOE(293),
|
||||
GOLD_HOE(294),
|
||||
SEEDS(295),
|
||||
WHEAT(296),
|
||||
BREAD(297),
|
||||
LEATHER_HELMET(298),
|
||||
LEATHER_CHESTPLATE(299),
|
||||
LEATHER_LEGGINGS(300),
|
||||
LEATHER_BOOTS(301),
|
||||
CHAINMAIL_HELMET(302),
|
||||
CHAINMAIL_CHESTPLATE(303),
|
||||
CHAINMAIL_LEGGINGS(304),
|
||||
CHAINMAIL_BOOTS(305),
|
||||
IRON_HELMET(306),
|
||||
IRON_CHESTPLATE(307),
|
||||
IRON_LEGGINGS(308),
|
||||
IRON_BOOTS(309),
|
||||
DIAMOND_HELMET(310),
|
||||
DIAMOND_CHESTPLATE(311),
|
||||
DIAMOND_LEGGINGS(312),
|
||||
DIAMOND_BOOTS(313),
|
||||
GOLD_HELMET(314),
|
||||
GOLD_CHESTPLATE(315),
|
||||
GOLD_LEGGINGS(316),
|
||||
GOLD_BOOTS(317),
|
||||
FLINT(318),
|
||||
PORK(319),
|
||||
GRILLED_PORK(320),
|
||||
PAINTING(321),
|
||||
GOLDEN_APPLE(322),
|
||||
SIGN(323),
|
||||
WOOD_DOOR(324),
|
||||
BUCKET(325),
|
||||
WATER_BUCKET(326),
|
||||
LAVA_BUCKET(327),
|
||||
MINECART(328),
|
||||
SADDLE(329),
|
||||
IRON_DOOR(330),
|
||||
REDSTONE(331),
|
||||
SNOW_BALL(332),
|
||||
BOAT(333),
|
||||
LEATHER(334),
|
||||
MILK_BUCKET(335),
|
||||
CLAY_BRICK(336),
|
||||
CLAY_BALL(337),
|
||||
SUGAR_CANE(338),
|
||||
PAPER(339),
|
||||
BOOK(340),
|
||||
SLIME_BALL(341),
|
||||
STORAGE_MINECART(342),
|
||||
POWERED_MINECART(343),
|
||||
EGG(344),
|
||||
COMPASS(345),
|
||||
FISHING_ROD(346),
|
||||
WATCH(347),
|
||||
GLOWSTONE_DUST(348),
|
||||
RAW_FISH(349),
|
||||
COOKED_FISH(350),
|
||||
INK_SACK(351),
|
||||
BONE(352),
|
||||
SUGAR(353),
|
||||
CAKE(354),
|
||||
BED(355),
|
||||
DIODE(356),
|
||||
COOKIE(357),
|
||||
MAP(358),
|
||||
SHEARS(359),
|
||||
MELON(360),
|
||||
PUMPKIN_SEEDS(361),
|
||||
MELON_SEEDS(362),
|
||||
RAW_BEEF(363),
|
||||
COOKED_BEEF(364),
|
||||
RAW_CHICKEN(365),
|
||||
COOKED_CHICKEN(366),
|
||||
ROTTEN_FLESH(367),
|
||||
ENDER_PEARL(368),
|
||||
BLAZE_ROD(369),
|
||||
GHAST_TEAR(370),
|
||||
GOLD_NUGGET(371),
|
||||
NETHER_STALK(372),
|
||||
|
||||
POTION(373),
|
||||
GLASS_BOTTLE(374),
|
||||
SPIDER_EYE(375),
|
||||
FERMENTED_SPIDER_EYE(376),
|
||||
BLAZE_POWDER(377),
|
||||
MAGMA_CREAM(378),
|
||||
BREWING_STAND_ITEM(379),
|
||||
CAULDRON_ITEM(380),
|
||||
EYE_OF_ENDER(381),
|
||||
SPECKLED_MELON(382),
|
||||
MONSTER_EGG(383),
|
||||
EXP_BOTTLE(384),
|
||||
FIREBALL(385),
|
||||
BOOK_AND_QUILL(386),
|
||||
WRITTEN_BOOK(387),
|
||||
EMERALD(388),
|
||||
ITEM_FRAME(389),
|
||||
FLOWER_POT_ITEM(390),
|
||||
CARROT_ITEM(391),
|
||||
POTATO_ITEM(392),
|
||||
BAKED_POTATO(393),
|
||||
POISONOUS_POTATO(394),
|
||||
EMPTY_MAP(395),
|
||||
GOLDEN_CARROT(396),
|
||||
SKULL_ITEM(397),
|
||||
CARROT_STICK(398),
|
||||
NETHER_STAR(399),
|
||||
PUMPKIN_PIE(400),
|
||||
FIREWORK(401),
|
||||
FIREWORK_CHARGE(402),
|
||||
ENCHANTED_BOOK(403),
|
||||
REDSTONE_COMPARATOR(404),
|
||||
NETHER_BRICK_ITEM(405),
|
||||
QUARTZ(406),
|
||||
EXPLOSIVE_MINECART(407),
|
||||
HOPPER_MINECART(408),
|
||||
PRISMARINE_SHARD(409),
|
||||
PRISMARINE_CRYSTALS(410),
|
||||
RABBIT(411),
|
||||
COOKED_RABBIT(412),
|
||||
RABBIT_STEW(413),
|
||||
RABBIT_FOOT(414),
|
||||
RABBIT_HIDE(415),
|
||||
ARMOR_STAND(416),
|
||||
IRON_BARDING(417),
|
||||
GOLD_BARDING(418),
|
||||
DIAMOND_BARDING(419),
|
||||
LEASH(420),
|
||||
NAME_TAG(421),
|
||||
COMMAND_MINECART(422),
|
||||
MUTTON(423),
|
||||
COOKED_MUTTON(424),
|
||||
BANNER(425),
|
||||
SPRUCE_DOOR_ITEM(427),
|
||||
BIRCH_DOOR_ITEM(428),
|
||||
JUNGLE_DOOR_ITEM(429),
|
||||
ACACIA_DOOR_ITEM(430),
|
||||
DARK_OAK_DOOR_ITEM(431),
|
||||
GOLD_RECORD(2256),
|
||||
GREEN_RECORD(2257),
|
||||
RECORD_3(2258),
|
||||
RECORD_4(2259),
|
||||
RECORD_5(2260),
|
||||
RECORD_6(2261),
|
||||
RECORD_7(2262),
|
||||
RECORD_8(2263),
|
||||
RECORD_9(2264),
|
||||
RECORD_10(2265),
|
||||
RECORD_11(2266),
|
||||
RECORD_12(2267);
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package br.com.devsrsouza.kotlinbukkitapi.tooling.menu
|
||||
|
||||
import com.intellij.psi.util.collectDescendantsOfType
|
||||
import com.intellij.psi.util.findDescendantOfType
|
||||
import org.jetbrains.kotlin.builtins.getReceiverTypeFromFunctionType
|
||||
import org.jetbrains.kotlin.builtins.getReturnTypeFromFunctionType
|
||||
import org.jetbrains.kotlin.builtins.isExtensionFunctionType
|
||||
import org.jetbrains.kotlin.idea.core.util.getLineNumber
|
||||
import org.jetbrains.kotlin.idea.debugger.sequence.psi.resolveType
|
||||
import org.jetbrains.kotlin.idea.intentions.isMethodCall
|
||||
import org.jetbrains.kotlin.idea.refactoring.fqName.fqName
|
||||
import org.jetbrains.kotlin.idea.refactoring.fqName.getKotlinFqName
|
||||
import org.jetbrains.kotlin.idea.references.mainReference
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.types.typeUtil.isUnit
|
||||
|
||||
private val menuFqSupportedNames = listOf(
|
||||
"br.com.devsrsouza.kotlinbukkitapi.dsl.menu.menu",
|
||||
"br.com.devsrsouza.bukkript.script.definition.api.menu"
|
||||
)
|
||||
|
||||
fun findMenuDeclaration(
|
||||
element: KtCallExpression,
|
||||
currentSelectedLine: Int? = null
|
||||
): MenuDeclaration? {
|
||||
val simpleName = "menu"
|
||||
|
||||
if (!element.isCallFrom(simpleName, menuFqSupportedNames)) return null
|
||||
|
||||
val menuFunction = element.findDescendantOfType<KtCallExpression> {
|
||||
isMenuCall(it)
|
||||
} ?: return null
|
||||
|
||||
// TODO: Support named parameters
|
||||
|
||||
val displayName = menuFunction.valueArguments.getOrNull(0)?.text?.replace("\"", "") ?: return null
|
||||
val lines = menuFunction.valueArguments.getOrNull(1)?.text?.toIntOrNull() ?: return null
|
||||
|
||||
val menuLambdaBlock = element.findDescendantOfType<KtLambdaExpression> {
|
||||
it.isBuilderBlockFor("br.com.devsrsouza.kotlinbukkitapi.dsl.menu.MenuDSL")
|
||||
} ?: return null
|
||||
|
||||
val slotFqName = listOf("br.com.devsrsouza.kotlinbukkitapi.dsl.menu.slot")
|
||||
val slotSimpleName = "slot"
|
||||
|
||||
val slotCalls = menuLambdaBlock.collectDescendantsOfType<KtCallExpression> {
|
||||
it.isCallFrom(slotSimpleName, slotFqName)
|
||||
}.mapNotNull {
|
||||
|
||||
val args = it.valueArguments
|
||||
|
||||
// TODO: support named parameters
|
||||
|
||||
val line = args.getOrNull(0)?.text?.toIntOrNull() ?: return@mapNotNull null
|
||||
val slot = args.getOrNull(1)?.text?.toIntOrNull() ?: return@mapNotNull null
|
||||
|
||||
// TODO: support just slot: slot(15, item(...)) {}
|
||||
|
||||
val itemValue = args.getOrNull(2) ?: return@mapNotNull null
|
||||
val expression = itemValue.getArgumentExpression() ?: return@mapNotNull null
|
||||
|
||||
val materialExpression = expression.findDescendantOfType<KtDotQualifiedExpression> {
|
||||
it.text.startsWith("Material")
|
||||
&& it.receiverExpression.mainReference?.resolve()?.getKotlinFqName()?.asString()
|
||||
?.equals("org.bukkit.Material") == true
|
||||
} ?: return@mapNotNull null
|
||||
|
||||
val typeExpression = materialExpression.selectorExpression as? KtNameReferenceExpression ?: return@mapNotNull null
|
||||
val materialName = typeExpression.text ?: return@mapNotNull null
|
||||
|
||||
val item = runCatching { MinecraftItem.valueOf(materialName) }.getOrNull()
|
||||
|
||||
println("Slot $line, $slot using item: $materialName")
|
||||
|
||||
val isSelected = it.getLineNumber() == currentSelectedLine
|
||||
|
||||
MenuSlotDeclaration(
|
||||
line,
|
||||
slot,
|
||||
item?.id,
|
||||
isSelected
|
||||
)
|
||||
}
|
||||
|
||||
return MenuDeclaration(displayName, lines, slotCalls)
|
||||
}
|
||||
|
||||
fun isMenuCall(it: KtCallExpression) =
|
||||
it.isCallFrom("menu", menuFqSupportedNames)
|
||||
|
||||
fun KtLambdaExpression.isBuilderBlockFor(fqName: String): Boolean {
|
||||
val type = resolveType()
|
||||
|
||||
val extensionFunctionType = type.isExtensionFunctionType
|
||||
|
||||
if(!extensionFunctionType) return false
|
||||
|
||||
val returnTypeFromFunctionType = type.getReturnTypeFromFunctionType()
|
||||
val receiverTypeFromFunctionType = type.getReceiverTypeFromFunctionType() ?: return false
|
||||
val receiverFqName = receiverTypeFromFunctionType.fqName ?: return false
|
||||
|
||||
return returnTypeFromFunctionType.isUnit() && receiverFqName.asString().equals(fqName)
|
||||
}
|
||||
|
||||
fun KtCallExpression.isCallFrom(
|
||||
simpleName: String,
|
||||
fqNames: List<String>
|
||||
): Boolean {
|
||||
return text.startsWith(simpleName) && fqNames.any { isMethodCall(it) }
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling
|
||||
|
||||
import com.intellij.ui.IconManager
|
||||
import javax.swing.Icon
|
||||
|
||||
object Assets {
|
||||
private fun load(path: String): Icon {
|
||||
return IconManager.getInstance().getIcon(path, ClassLoader.getSystemClassLoader())
|
||||
}
|
||||
|
||||
private const val assetFolder = "/assets"
|
||||
|
||||
val KotlinBukkitAPIIcon =
|
||||
tech.carcadex.kotlinbukkitkit.tooling.Assets.load("${tech.carcadex.kotlinbukkitkit.tooling.Assets.assetFolder}/icons/kotlinbukkitapi-icon.svg")
|
||||
val Bukkript =
|
||||
tech.carcadex.kotlinbukkitkit.tooling.Assets.load("${tech.carcadex.kotlinbukkitkit.tooling.Assets.assetFolder}/icons/bukkript.svg")
|
||||
val FolderScript =
|
||||
tech.carcadex.kotlinbukkitkit.tooling.Assets.load("${tech.carcadex.kotlinbukkitkit.tooling.Assets.assetFolder}/icons/folderScript.svg")
|
||||
val FolderPlugins =
|
||||
tech.carcadex.kotlinbukkitkit.tooling.Assets.load("${tech.carcadex.kotlinbukkitkit.tooling.Assets.assetFolder}/icons/folderPlugins.svg")
|
||||
val FolderBukkript =
|
||||
tech.carcadex.kotlinbukkitkit.tooling.Assets.load("${tech.carcadex.kotlinbukkitkit.tooling.Assets.assetFolder}/icons/folderBukkript.svg")
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard
|
||||
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.utils.addAtGrid
|
||||
import com.intellij.ide.util.projectWizard.*
|
||||
import com.intellij.uiDesigner.core.*
|
||||
import javax.swing.*
|
||||
|
||||
/**
|
||||
* https://github.com/ktorio/ktor-init-tools/blob/master/ktor-intellij-plugin/src/io/ktor/start/intellij/KtorArtifactWizardStep.kt
|
||||
*/
|
||||
class KBAPIArtifactWizard(val config: KBAPIModuleConfig) : ModuleWizardStep() {
|
||||
val groupId: JTextField
|
||||
val artifactId: JTextField
|
||||
val version: JTextField
|
||||
val author: JTextField
|
||||
val website: JTextField
|
||||
val description: JTextField
|
||||
|
||||
val panel = JPanel().apply {
|
||||
layout = GridLayoutManager(8, 2)
|
||||
|
||||
fun addLabelText(name: String, value: String, row: Int): JTextField {
|
||||
val tfield = JTextField(value)
|
||||
addAtGrid(
|
||||
JLabel(name),
|
||||
row = row,
|
||||
column = 0,
|
||||
anchor = GridConstraints.ANCHOR_WEST,
|
||||
fill = GridConstraints.FILL_NONE,
|
||||
HSizePolicy = GridConstraints.SIZEPOLICY_FIXED,
|
||||
VSizePolicy = GridConstraints.SIZEPOLICY_FIXED
|
||||
)
|
||||
addAtGrid(
|
||||
tfield,
|
||||
row = row,
|
||||
column = 1,
|
||||
anchor = GridConstraints.ANCHOR_WEST,
|
||||
fill = GridConstraints.FILL_HORIZONTAL,
|
||||
HSizePolicy = GridConstraints.SIZEPOLICY_CAN_GROW or GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||
VSizePolicy = GridConstraints.SIZEPOLICY_FIXED
|
||||
)
|
||||
return tfield
|
||||
}
|
||||
|
||||
addAtGrid(
|
||||
JLabel(""),
|
||||
row = 0,
|
||||
column = 0,
|
||||
HSizePolicy = GridConstraints.SIZEPOLICY_FIXED,
|
||||
VSizePolicy = GridConstraints.SIZEPOLICY_FIXED
|
||||
)
|
||||
|
||||
artifactId = addLabelText("Plugin Name", config.artifactId, row = 1)
|
||||
groupId = addLabelText("GroupId", config.artifactGroup, row = 2)
|
||||
version = addLabelText("Version", config.artifactVersion, row = 3)
|
||||
author = addLabelText("Author", config.author, row = 4)
|
||||
website = addLabelText("Website", config.author, row = 5)
|
||||
description = addLabelText("Description", config.description, row = 6)
|
||||
|
||||
add(Spacer().apply {}, GridConstraints().apply {
|
||||
colSpan = 2
|
||||
row = 7
|
||||
column = 0
|
||||
fill = GridConstraints.FILL_VERTICAL
|
||||
})
|
||||
}
|
||||
|
||||
override fun updateDataModel() {
|
||||
config.artifactGroup = groupId.text
|
||||
config.artifactId = artifactId.text
|
||||
config.artifactVersion = version.text
|
||||
config.author = author.text
|
||||
config.website = website.text
|
||||
config.description = description.text
|
||||
}
|
||||
|
||||
override fun getComponent() = panel
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard
|
||||
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.creator.*
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.utils.backgroundTask
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.utils.get
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.utils.invokeLater
|
||||
import com.intellij.codeInsight.actions.ReformatCodeProcessor
|
||||
import com.intellij.ide.actions.ImportModuleAction
|
||||
import com.intellij.ide.util.projectWizard.JavaModuleBuilder
|
||||
import com.intellij.ide.util.projectWizard.ModuleBuilder
|
||||
import com.intellij.ide.util.projectWizard.WizardContext
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.ModalityState
|
||||
import com.intellij.openapi.module.ModuleType
|
||||
import com.intellij.openapi.project.DumbAwareRunnable
|
||||
import com.intellij.openapi.projectRoots.JavaSdk
|
||||
import com.intellij.openapi.projectRoots.SdkTypeId
|
||||
import com.intellij.openapi.roots.ModifiableRootModel
|
||||
import com.intellij.openapi.roots.ui.configuration.ModulesProvider
|
||||
import com.intellij.openapi.util.Computable
|
||||
import com.intellij.openapi.util.Ref
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.projectImport.ProjectImportProvider
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
import javax.swing.Icon
|
||||
|
||||
class KBAPIModuleBuilder : ModuleBuilder() {
|
||||
override fun getPresentableName(): String = KBAPIModuleType.NAME
|
||||
override fun getNodeIcon(): Icon = KBAPIModuleType.ICON
|
||||
override fun getGroupName(): String = KBAPIModuleType.NAME
|
||||
override fun getBuilderId(): String? = "KOTLINBUKKITAPI_MODULE"
|
||||
|
||||
override fun isSuitableSdkType(sdkType: SdkTypeId?): Boolean = sdkType === JavaSdk.getInstance()
|
||||
|
||||
val config = KBAPIModuleConfig()
|
||||
|
||||
override fun setupRootModel(rootModel: ModifiableRootModel) {
|
||||
val project = rootModel.project
|
||||
val (rootPath, vFile) = createAndGetRoot()
|
||||
val root = rootPath.toFile()
|
||||
rootModel.addContentEntry(vFile)
|
||||
if (moduleJdk != null) rootModel.sdk = moduleJdk
|
||||
|
||||
project.backgroundTask("Setting Up Project") { progress ->
|
||||
progress.text = "Generating Gradle"
|
||||
|
||||
val gradleBuildFile = generateGradleBuildFile(root).createIfNotExists()
|
||||
val gradleSettingFile = generateGradleSettingsFile(root).createIfNotExists()
|
||||
generateConfigFile(root).createIfNotExists()
|
||||
generateMessagesFile(root).createIfNotExists()
|
||||
|
||||
gradleBuildFile.appendText(generateGradleBuildFileContent(config))
|
||||
gradleSettingFile.appendText(generateGradleSettingsFileContent(config))
|
||||
|
||||
progress.text = "Generating Plugin Main"
|
||||
|
||||
val pluginMain = generatePluginMainFile(root, config).createIfNotExists()
|
||||
|
||||
pluginMain.appendText(generatePluginMainFileContent(config))
|
||||
|
||||
progress.text = "Configuring project gradle"
|
||||
vFile.refresh(false, true)
|
||||
|
||||
val buildGradle = vFile["build.gradle.kts"]
|
||||
if (buildGradle != null)
|
||||
invokeLater {
|
||||
val provider = ProjectImportProvider.PROJECT_IMPORT_PROVIDER.extensions
|
||||
.firstOrNull { it.canImport(buildGradle, project) }
|
||||
?: return@invokeLater
|
||||
|
||||
val wizard = ImportModuleAction.createImportWizard(
|
||||
project,
|
||||
null,
|
||||
buildGradle,
|
||||
provider
|
||||
)
|
||||
|
||||
if (wizard != null && (wizard.stepCount <= 0 || wizard.showAndGet())) {
|
||||
ImportModuleAction.createFromWizard(project, wizard)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getModuleType(): ModuleType<*> {
|
||||
return KBAPIModuleType()
|
||||
}
|
||||
|
||||
override fun getParentGroup() = KBAPIModuleType.NAME
|
||||
|
||||
override fun createWizardSteps(wizardContext: WizardContext, modulesProvider: ModulesProvider) = arrayOf(
|
||||
KBAPIArtifactWizard(config)
|
||||
)
|
||||
|
||||
override fun getCustomOptionsStep(context: WizardContext, parentDisposable: Disposable?) =
|
||||
KBAPIWizardStep(config)
|
||||
|
||||
|
||||
private fun createAndGetRoot(): Pair<Path, VirtualFile> {
|
||||
val temp = contentEntryPath ?: throw IllegalStateException("Failed to get content entry path")
|
||||
|
||||
val pathName = FileUtil.toSystemIndependentName(temp)
|
||||
|
||||
val path = Paths.get(pathName)
|
||||
Files.createDirectories(path)
|
||||
val vFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(pathName)
|
||||
?: throw IllegalStateException("Failed to refresh and file file: $path")
|
||||
|
||||
return path to vFile
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard
|
||||
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit.Plugin
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit.ServerType
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit.ServerVersion
|
||||
|
||||
data class KBAPIModuleConfig(
|
||||
var artifactGroup: String = "com.example",
|
||||
var artifactId: String = "MyPlugin",
|
||||
var artifactVersion: String = "0.0.1",
|
||||
var externalPlugins: List<Plugin> = listOf<Plugin>(),
|
||||
var kbAPIVersion: KotlinBukkitAPIVersion = Versions.LAST,
|
||||
var serverVersion: ServerVersion = ServerVersion.v1_8,
|
||||
var serverType: ServerType = ServerType.PAPERMC,
|
||||
var author: String = "",
|
||||
var website: String = "",
|
||||
var description: String = ""
|
||||
)
|
||||
@@ -0,0 +1,22 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard
|
||||
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.Assets
|
||||
import com.intellij.openapi.module.ModuleType
|
||||
import javax.swing.Icon
|
||||
|
||||
class KBAPIModuleType : ModuleType<KBAPIModuleBuilder>("kotlinbukkitkit") {
|
||||
|
||||
companion object {
|
||||
val NAME = "KotlinBukkitKit"
|
||||
val DESCRIPTION = "KotlinBukkitKit Quick"
|
||||
val ICON = tech.carcadex.kotlinbukkitkit.tooling.Assets.KotlinBukkitAPIIcon
|
||||
val INSTANCE = KBAPIModuleType()
|
||||
}
|
||||
|
||||
override fun createModuleBuilder(): KBAPIModuleBuilder = KBAPIModuleBuilder()
|
||||
override fun getName(): String = NAME
|
||||
override fun getDescription(): String = DESCRIPTION
|
||||
override fun getNodeIcon(isOpened: Boolean): Icon = ICON
|
||||
override fun getIcon(): Icon = ICON
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard
|
||||
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit.*
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.utils.*
|
||||
import com.intellij.ide.util.projectWizard.ModuleWizardStep
|
||||
import com.intellij.openapi.ui.Splitter
|
||||
import com.intellij.ui.IdeBorderFactory
|
||||
import java.awt.BorderLayout
|
||||
import javax.swing.*
|
||||
|
||||
/**
|
||||
* https://github.com/ktorio/ktor-init-tools/blob/master/ktor-intellij-plugin/src/io/ktor/start/intellij/KtorModuleWizardStep.kt
|
||||
*/
|
||||
class KBAPIWizardStep(
|
||||
val config: KBAPIModuleConfig
|
||||
) : ModuleWizardStep() {
|
||||
lateinit var serverApiVersionCB: JComboBox<ServerVersion>
|
||||
lateinit var serverForkCB: JComboBox<ServerType>
|
||||
lateinit var kotlinBukkitAPIVersionCB: JComboBox<KotlinBukkitAPIVersion>
|
||||
lateinit var externalPluginList: PluginCheckboxList
|
||||
|
||||
override fun updateDataModel() {
|
||||
config.serverVersion = serverApiVersionCB.selectedItem as ServerVersion
|
||||
config.externalPlugins = externalPluginList.pluginsToCheckbox.keys.filter { it.isSelected }
|
||||
config.serverType = serverForkCB.selectedItem as ServerType
|
||||
config.kbAPIVersion = kotlinBukkitAPIVersionCB.selectedItem as KotlinBukkitAPIVersion
|
||||
}
|
||||
|
||||
val panel by lazy {
|
||||
JPanel().apply {
|
||||
val description = JPanel().apply {
|
||||
layout = BoxLayout(this, BoxLayout.Y_AXIS)
|
||||
border = IdeBorderFactory.createBorder()
|
||||
}
|
||||
|
||||
externalPluginList = object : PluginCheckboxList(ALL_PLUGINS) {
|
||||
override fun onSelected(feature: Plugin?, node: ThreeStateCheckedTreeNode) {
|
||||
// TODO: Show source link?
|
||||
}
|
||||
override fun onChanged(feature: Plugin, node: ThreeStateCheckedTreeNode) {
|
||||
feature.isSelected = !feature.isSelected
|
||||
|
||||
externalPluginList.repaint()
|
||||
}
|
||||
}
|
||||
|
||||
this.layout = BorderLayout(0, 0)
|
||||
|
||||
add(table {
|
||||
tr(
|
||||
policy = TdSize.FIXED,
|
||||
fill = TdFill.NONE,
|
||||
align = TdAlign.CENTER_LEFT
|
||||
) {
|
||||
td(JLabel("Server API Version:"))
|
||||
td(JComboBox(ServerVersion.values().reversedArray()).apply { serverApiVersionCB = this })
|
||||
td(JLabel("Server:"))
|
||||
td(JComboBox(ServerType.values()).apply { serverForkCB = this })
|
||||
td(JLabel("KotlinBukkitKit:"))
|
||||
td(JComboBox(Versions.ALL).apply {
|
||||
kotlinBukkitAPIVersionCB = this
|
||||
selectedItem = Versions.LAST
|
||||
})
|
||||
}
|
||||
}, BorderLayout.NORTH)
|
||||
|
||||
add(Splitter(true, 0.8f, 0.2f, 0.8f).apply {
|
||||
this.firstComponent = table {
|
||||
tr(
|
||||
policy = TdSize.FIXED,
|
||||
minHeight = 24,
|
||||
maxHeight = 24,
|
||||
fill = TdFill.NONE,
|
||||
align = TdAlign.CENTER_LEFT
|
||||
) {
|
||||
td(JLabel("Plugins:"))
|
||||
}
|
||||
tr {
|
||||
td(externalPluginList.scrollVertical())
|
||||
}
|
||||
}
|
||||
this.secondComponent = description
|
||||
}, BorderLayout.CENTER)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getComponent(): JComponent {
|
||||
return panel
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard
|
||||
|
||||
const val PLUGIN_YML = "0.6.0"
|
||||
const val SHADOW_PLUGIN = "7.1.2"
|
||||
const val KSP = "1.9.21-1.0.15"
|
||||
const val RUN_PAPER = "2.1.0"
|
||||
@@ -0,0 +1,60 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard
|
||||
|
||||
object Versions {
|
||||
val `1-0-0-3` = KotlinBukkitAPIVersion("1.0.0.3")
|
||||
val `1-0-1-0` = KotlinBukkitAPIVersion("1.0.1.0")
|
||||
|
||||
val ALL = arrayOf(
|
||||
`1-0-0-3`,
|
||||
`1-0-1-0`
|
||||
)
|
||||
|
||||
val LAST = `1-0-1-0`
|
||||
|
||||
val visitorAll = ALL.associate { it.version to it }
|
||||
|
||||
fun fromString(version: String) = visitorAll[version]
|
||||
}
|
||||
|
||||
data class KotlinBukkitAPIVersion(
|
||||
val version: String,
|
||||
val kotlinVersion: String = "1.9.21"
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return version
|
||||
}
|
||||
|
||||
private val group = "tech.carcadex"
|
||||
|
||||
val repositories = listOf(
|
||||
"https://hub.spigotmc.org/nexus/content/repositories/snapshots/",
|
||||
"https://s01.oss.sonatype.org/content/repositories/snapshots/",
|
||||
"https://s01.oss.sonatype.org/content/repositories/releases/"
|
||||
)
|
||||
|
||||
val dependencies = listOf(
|
||||
"${group}:kotlinbukkitkit-architecture:\$kbk_version",
|
||||
"${group}:kotlinbukkitkit-extensions:\$kbk_version",
|
||||
"${group}:kotlinbukkitkit-serialization:\$kbk_version",
|
||||
"${group}:kotlinbukkitkit-messages:\$kbk_version",
|
||||
"${group}:kotlinbukkitkit-commands:\$kbk_version",
|
||||
"${group}:kotlinbukkitkit-utility:\$kbk_version",
|
||||
"${group}:kotlinbukkitkit-menu:\$kbk_version",
|
||||
|
||||
"org.jetbrains.kotlin:kotlin-stdlib",
|
||||
"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2",
|
||||
"org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1",
|
||||
"com.github.cryptomorin:XSeries:9.2.0"
|
||||
)
|
||||
|
||||
val dependenciesImplementation = listOf(
|
||||
"org.jetbrains.kotlin:kotlin-reflect:1.9.21",
|
||||
)
|
||||
val dependenciesCompileOnly = listOf(
|
||||
"org.jetbrains:annotations:24.0.0",
|
||||
)
|
||||
|
||||
val kspModules = listOf(
|
||||
"${group}:kotlinbukkitkit-genref:$version"
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit
|
||||
|
||||
data class Plugin(
|
||||
val name: String,
|
||||
val versions: List<PluginVersion>,
|
||||
val repositories: Set<String>,
|
||||
val displayName: String = name
|
||||
) {
|
||||
var isSelected = false
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit
|
||||
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit.ServerVersion.*
|
||||
|
||||
private val worldEdit = "com.sk89q.worldedit"
|
||||
|
||||
// TODO: plotsquared, multiverse
|
||||
|
||||
val ALL_PLUGINS = listOf(
|
||||
Plugin(
|
||||
"Vault",
|
||||
allVersion("1.7") { setOf("com.github.MilkBowl:VaultAPI:$it") },
|
||||
setOf("https://jitpack.io"),
|
||||
),
|
||||
Plugin(
|
||||
"WorldEdit",
|
||||
listOf(v1_8, v1_9, v1_12).asPluginVersion("6.1.5") { setOf("$worldEdit:worldedit-core:$it", "$worldEdit:worldedit-bukkit:$it") }
|
||||
+ listOf(v1_13, v1_14, v1_15, v1_16, v1_17, v1_18, v1_19).asPluginVersion("7.2.14-SNAPSHOT") { setOf("$worldEdit:worldedit-core:$it", "$worldEdit:worldedit-bukkit:$it") }
|
||||
+ listOf(v1_20).asPluginVersion("7.3.0-SNAPSHOT") { setOf("$worldEdit:worldedit-core:$it", "$worldEdit:worldedit-bukkit:$it") }
|
||||
,
|
||||
setOf("https://repo.minebench.de/")
|
||||
),
|
||||
Plugin(
|
||||
"WorldGuard",
|
||||
listOf(v1_8, v1_9, v1_12).asPluginVersion("6.1") { setOf("com.sk89q:worldguard:$it") }
|
||||
+ listOf(v1_13, v1_14, v1_15, v1_16, v1_17, v1_18, v1_19, v1_20).asPluginVersion("7.0.1-SNAPSHOT") { setOf("com.sk89q.worldguard:worldguard-core:$it", "com.sk89q.worldguard:worldguard-bukkit:$it") }
|
||||
,
|
||||
setOf("https://repo.minebench.de/")
|
||||
),
|
||||
Plugin(
|
||||
"Citizens",
|
||||
allVersion("2.0.27-SNAPSHOT") { setOf("net.citizensnpcs:citizensapi:$it", "net.citizensnpcs:citizens:$it") },
|
||||
setOf("http://repo.citizensnpcs.co/")
|
||||
),
|
||||
Plugin(
|
||||
"LuckPerms",
|
||||
allVersion("5.4") { setOf("net.luckperms:api:$it") },
|
||||
setOf() // mavenCentral
|
||||
),
|
||||
Plugin(
|
||||
"ProtocolLib",
|
||||
allVersion("5.1.0") { setOf("com.comphenix.protocol:ProtocolLib:$it") },
|
||||
setOf("http://repo.dmulloy2.net/nexus/repository/public/")
|
||||
),
|
||||
Plugin(
|
||||
"PlaceholderAPI",
|
||||
allVersion("2.11.5") { setOf("me.clip:placeholderapi:$it") },
|
||||
setOf("http://repo.extendedclip.com/content/repositories/placeholderapi/")
|
||||
),
|
||||
Plugin(
|
||||
"MVdWPlaceholderAPI",
|
||||
allVersion("3.1.1") { setOf("be.maximvdw:MVdWPlaceholderAPI:$it") },
|
||||
setOf("http://repo.mvdw-software.be/content/groups/public/")),
|
||||
Plugin(
|
||||
"ActionBarAPI",
|
||||
allVersion("d60c2aedb9") { setOf("com.github.ConnorLinfoot:ActionBarAPI:$it") },
|
||||
setOf("https://jitpack.io")
|
||||
),
|
||||
Plugin(
|
||||
"TitleAPI",
|
||||
allVersion("1.8.1") { setOf("com.github.ConnorLinfoot:TitleAPI:$it") },
|
||||
setOf("https://jitpack.io")),
|
||||
Plugin(
|
||||
"ViaVersion",
|
||||
allVersion("4.9.3") { setOf("us.myles:viaversion-common:$it") },
|
||||
setOf("https://repo.viaversion.com/")
|
||||
),
|
||||
Plugin(
|
||||
"BossBarAPI",
|
||||
allVersion("2.4.2") { setOf("org.inventivetalent:bossbarapi:$it") },
|
||||
setOf("https://repo.inventivetalent.org/content/groups/public/")
|
||||
),
|
||||
Plugin(
|
||||
"HologramAPI",
|
||||
allVersion("1.6.0") { setOf("org.inventivetalent:hologramapi:$it") },
|
||||
setOf("https://repo.inventivetalent.org/content/groups/public/")
|
||||
),
|
||||
Plugin(
|
||||
"NoDropX",
|
||||
allVersion("1.0.3c") { setOf("com.github.iRedTea:NoDropX:$it") },
|
||||
setOf("https://jitpack.io")
|
||||
),
|
||||
Plugin(
|
||||
"EssentialsX",
|
||||
allVersion("2.20.1") { setOf("net.essentialsx:EssentialsX:$it") },
|
||||
setOf("https://repo.essentialsx.net/releases/")
|
||||
),
|
||||
Plugin(
|
||||
"Multiverse-Core",
|
||||
allVersion("4.3.1") { setOf("com.onarandombox.multiversecore:Multiverse-Core:$it") },
|
||||
setOf("https://repo.onarandombox.com/content/groups/public/")
|
||||
),
|
||||
Plugin(
|
||||
"ItemsAdder",
|
||||
allVersion("3.6.1") { setOf("com.github.LoneDev6:api-itemsadder:$it") },
|
||||
setOf("https://jitpack.io")
|
||||
),
|
||||
)
|
||||
|
||||
inline fun allVersion(version: String, dependencies: (String) -> Set<String>): List<PluginVersion> = ServerVersion.values().map { PluginVersion(version, it, dependencies(version)) }
|
||||
inline fun List<ServerVersion>.asPluginVersion(version: String, dependencies: (String) -> Set<String>): List<PluginVersion> = map { PluginVersion(version, it, dependencies(version)) }
|
||||
@@ -0,0 +1,7 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit
|
||||
|
||||
class PluginVersion(
|
||||
val version: String,
|
||||
val serverVersion: ServerVersion,
|
||||
val dependencies: Set<String>
|
||||
)
|
||||
@@ -0,0 +1,55 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit
|
||||
|
||||
data class ServerAPI(
|
||||
val version: ServerVersion,
|
||||
val serverType: ServerType
|
||||
)
|
||||
|
||||
val ServerAPI.dependencies: List<String> get() {
|
||||
|
||||
val versionName = when(version) {
|
||||
ServerVersion.v1_8 -> "1.8.8-R0.1-SNAPSHOT"
|
||||
ServerVersion.v1_9 -> "1.9.4-R0.1-SNAPSHOT"
|
||||
ServerVersion.v1_12 -> "1.12.2-R0.1-SNAPSHOT"
|
||||
ServerVersion.v1_13 -> "1.13.2-R0.1-SNAPSHOT"
|
||||
ServerVersion.v1_14 -> "1.14.4-R0.1-SNAPSHOT"
|
||||
ServerVersion.v1_15 -> "1.15.2-R0.1-SNAPSHOT"
|
||||
ServerVersion.v1_16 -> "1.16.5-R0.1-SNAPSHOT"
|
||||
ServerVersion.v1_17 -> "1.17.1-R0.1-SNAPSHOT"
|
||||
ServerVersion.v1_18 -> "1.18.2-R0.1-SNAPSHOT"
|
||||
ServerVersion.v1_19 -> "1.19.4-R0.1-SNAPSHOT"
|
||||
ServerVersion.v1_20 -> "1.20.4-R0.1-SNAPSHOT"
|
||||
ServerVersion.v1_21 -> "1.21-R0.1-SNAPSHOT"
|
||||
}
|
||||
|
||||
val dependency = when(serverType) {
|
||||
ServerType.SPIGOT -> "org.spigotmc:spigot-api:$versionName"
|
||||
ServerType.PAPERMC -> {
|
||||
val v17 = "org.github.paperspigot:paperspigot-api"
|
||||
val v19 = "com.destroystokyo.paper:paper-api"
|
||||
val v20 = "io.papermc.paper:paper-api"
|
||||
|
||||
when(version) {
|
||||
ServerVersion.v1_8 -> "$v17:$versionName"
|
||||
ServerVersion.v1_9, ServerVersion.v1_12, ServerVersion.v1_13,
|
||||
ServerVersion.v1_14, ServerVersion.v1_15, ServerVersion.v1_16 -> "$v19:$versionName";
|
||||
else -> "$v20:$versionName"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return listOf(dependency)
|
||||
}
|
||||
|
||||
val ServerAPI.repositories: List<String> get() {
|
||||
return when(serverType) {
|
||||
ServerType.SPIGOT -> listOf(
|
||||
"https://hub.spigotmc.org/nexus/content/repositories/snapshots/",
|
||||
"https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
)
|
||||
ServerType.PAPERMC -> listOf(
|
||||
"https://papermc.io/repo/repository/maven-public/",
|
||||
"https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit
|
||||
|
||||
enum class ServerType {
|
||||
SPIGOT, PAPERMC
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit
|
||||
|
||||
enum class ServerVersion(val displayName: String, val maxVersion: String, val minor: Int,) {
|
||||
v1_8("1.8", "1.8.9", 8),
|
||||
v1_9("1.9", "1.9.4", 9),
|
||||
v1_12("1.12", "1.12.2", 12),
|
||||
v1_13("1.13", "1.13.2", 13),
|
||||
v1_14("1.14", "1.14.4", 14),
|
||||
v1_15("1.15", "1.15.2", 15),
|
||||
v1_16("1.16", "1.16.5", 16),
|
||||
v1_17("1.17", "1.17.1", 17),
|
||||
v1_18("1.18", "1.18.2", 18),
|
||||
v1_19("1.19", "1.19.4", 19),
|
||||
v1_20("1.20", "1.20.6", 20),
|
||||
v1_21("1.21", "1.21", 21),;
|
||||
|
||||
|
||||
override fun toString(): String {
|
||||
return displayName
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard.creator
|
||||
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.*
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit.ServerAPI
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit.dependencies
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit.repositories
|
||||
import java.io.File
|
||||
|
||||
fun generateGradleBuildFile(
|
||||
root: File
|
||||
): File = File(root, "build.gradle.kts")
|
||||
|
||||
fun generateGradleSettingsFile(
|
||||
root: File
|
||||
): File = File(root, "settings.gradle.kts")
|
||||
|
||||
fun generateConfigFile(
|
||||
root: File
|
||||
): File = File(root, "src/main/resources/config.yml")
|
||||
|
||||
fun generateMessagesFile(
|
||||
root: File
|
||||
): File = File(root, "src/main/resources/messages.yml")
|
||||
|
||||
fun generateGradleBuildFileContent(
|
||||
config: KBAPIModuleConfig
|
||||
): String = with(config) {
|
||||
val kbapiDependencies = kbAPIVersion.dependencies
|
||||
.dependenciesAsGradle(if (config.serverVersion.minor >= 16 && !config.kbAPIVersion.version.endsWith("SNAPSHOT")) "library" else "implementation")
|
||||
val kbapiDependenciesCompileOnly = kbAPIVersion.dependenciesCompileOnly
|
||||
.dependenciesAsGradle("compileOnly")
|
||||
val kbapiDependenciesImplementation = kbAPIVersion.dependenciesCompileOnly
|
||||
.dependenciesAsGradle("implementation")
|
||||
val kspModules = kbAPIVersion.kspModules.dependenciesAsGradle("ksp")
|
||||
val kspDependencies = kbAPIVersion.kspModules.dependenciesAsGradle()
|
||||
|
||||
val kbapiRepositories = kbAPIVersion.repositories
|
||||
.repositoriesAsGradle()
|
||||
|
||||
val serverApi = ServerAPI(config.serverVersion, config.serverType)
|
||||
val serverRepositories = serverApi.repositories.repositoriesAsGradle()
|
||||
val serverDependencies = serverApi.dependencies.dependenciesAsGradle()
|
||||
|
||||
val pluginDependencies = "${DEFAULT_INDENTATION}val transitive = Action<ExternalModuleDependency> { isTransitive = false }\n" + externalPlugins
|
||||
.flatMap { it.versions.first { it.serverVersion == serverVersion }.dependencies }
|
||||
.distinct()
|
||||
.dependenciesAsGradle(with = ", transitive")
|
||||
|
||||
val pluginRepositories = externalPlugins
|
||||
.flatMap { it.repositories }
|
||||
.distinct()
|
||||
.repositoriesAsGradle()
|
||||
|
||||
|
||||
val plugins = (externalPlugins.map{ "\"${it.name}\"" }).joinToString()
|
||||
|
||||
return """
|
||||
|// More about the setup here: https://red-tea.gitbook.io/kotlinbukkitkit
|
||||
|
|
||||
|plugins {
|
||||
| kotlin("jvm") version "${kbAPIVersion.kotlinVersion}"
|
||||
| kotlin("plugin.serialization") version "${kbAPIVersion.kotlinVersion}"
|
||||
| id("net.minecrell.plugin-yml.bukkit") version "$PLUGIN_YML"
|
||||
| id("com.github.johnrengelman.shadow") version "$SHADOW_PLUGIN"
|
||||
| id("xyz.jpenilla.run-paper") version "$RUN_PAPER"
|
||||
| id("com.google.devtools.ksp") version "$KSP"
|
||||
|}
|
||||
|
|
||||
|group = "$artifactGroup"
|
||||
|version = "$artifactVersion"
|
||||
|val kbk_version = "${config.kbAPIVersion.version}"
|
||||
|
|
||||
|repositories {
|
||||
| mavenCentral()
|
||||
| // minecraft
|
||||
|$serverRepositories
|
||||
|
|
||||
| //kotlinbukkitapi with backup repo
|
||||
|$kbapiRepositories
|
||||
|
|
||||
| //plugins
|
||||
|$pluginRepositories
|
||||
|}
|
||||
|
|
||||
|dependencies {
|
||||
| compileOnly(kotlin("stdlib-jdk8"))
|
||||
|
|
||||
| //minecraft
|
||||
|$serverDependencies
|
||||
|
|
||||
| //kotlinbukkitapi
|
||||
|$kbapiDependencies
|
||||
|$kbapiDependenciesCompileOnly
|
||||
|$kbapiDependenciesImplementation
|
||||
|
|
||||
| //ksp
|
||||
|$kspDependencies
|
||||
|$kspModules
|
||||
|
|
||||
| //plugins
|
||||
|$pluginDependencies
|
||||
|}
|
||||
|
|
||||
|bukkit {
|
||||
| main = "${packageName}.${pluginMainName}Plugin"
|
||||
| depend = listOf($plugins)
|
||||
| description = "$description"
|
||||
| author = "$author"
|
||||
| website = "$website"
|
||||
| apiVersion = "${config.serverVersion.displayName}"
|
||||
|}
|
||||
|
|
||||
|tasks {
|
||||
|// shadowJar {
|
||||
|// minimize {
|
||||
|// exclude(dependency("org.jetbrains:.*:.*"))
|
||||
|// }
|
||||
|// }
|
||||
| runServer {
|
||||
| minecraftVersion("${config.serverVersion.maxVersion}")
|
||||
| }
|
||||
|}
|
||||
|
|
||||
|
|
||||
|sourceSets {
|
||||
| main {
|
||||
| kotlin.srcDirs.add(File("build/generated/ksp"))
|
||||
| }
|
||||
|}
|
||||
|
|
||||
""".trimMargin()
|
||||
}
|
||||
|
||||
private inline fun List<String>.dependenciesAsGradle(configuration: String = "compileOnly", with: String = ""): String =
|
||||
joinToString("\n") {
|
||||
"$configuration(\"${it}\"$with)"
|
||||
}.prependIndent(DEFAULT_INDENTATION)
|
||||
|
||||
|
||||
private inline fun List<String>.repositoriesAsGradle(): String =
|
||||
joinToString("\n") {
|
||||
"""
|
||||
|maven {
|
||||
| url = uri("$it")
|
||||
| isAllowInsecureProtocol = true
|
||||
|}
|
||||
""".trimMargin()
|
||||
}.prependIndent(DEFAULT_INDENTATION)
|
||||
|
||||
fun generateGradleSettingsFileContent(
|
||||
config: KBAPIModuleConfig
|
||||
): String = with(config) {
|
||||
return """
|
||||
rootProject.name = "$artifactId"
|
||||
""".trimSource()
|
||||
}
|
||||
|
||||
fun String.trimSource(): String {
|
||||
val lines = lines()
|
||||
val indentation = lines[1].indexOfFirst { !it.isWhitespace() }
|
||||
|
||||
return lines.joinToString("\n") { it.removePrefix(" ".repeat(indentation)) }
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard.creator
|
||||
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.KBAPIModuleConfig
|
||||
import java.io.File
|
||||
|
||||
fun generatePluginPackageFolder(
|
||||
root: File,
|
||||
config: KBAPIModuleConfig
|
||||
): File = File(root, "src/main/kotlin/${config.packageName.replace(".", "/")}")
|
||||
|
||||
fun generatePluginMainFile(
|
||||
root: File,
|
||||
config: KBAPIModuleConfig
|
||||
): File = File(generatePluginPackageFolder(root, config), "${config.pluginMainName}.kt")
|
||||
|
||||
fun generatePluginMainFileContent(
|
||||
config: KBAPIModuleConfig
|
||||
): String = with(config) {
|
||||
return """
|
||||
package $packageName
|
||||
|
||||
import tech.carcadex.kotlinbukkitkit.architecture.KotlinPlugin
|
||||
import tech.carcadex.kotlinbukkitkit.genref.plugin.annotations.OnDisable
|
||||
import tech.carcadex.kotlinbukkitkit.genref.plugin.annotations.Plugin
|
||||
|
||||
@Plugin
|
||||
fun KotlinPlugin.start() {
|
||||
|
||||
}
|
||||
|
||||
@OnDisable
|
||||
fun KotlinPlugin.stop() {
|
||||
|
||||
}
|
||||
""".trimIndent()
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard.creator
|
||||
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.KBAPIModuleConfig
|
||||
import java.io.File
|
||||
|
||||
const val DEFAULT_INDENTATION = " "
|
||||
|
||||
inline fun String.mapIfNotBlank(block: (String) -> String): String =
|
||||
if(isNotBlank())
|
||||
block(this)
|
||||
else
|
||||
this
|
||||
|
||||
fun File.createIfNotExists(): File = apply {
|
||||
if(!exists()) {
|
||||
parentFile.mkdirs()
|
||||
createNewFile()
|
||||
}
|
||||
}
|
||||
|
||||
val KBAPIModuleConfig.packageName get() = "${artifactGroup}.${artifactId.toLowerCase()}"
|
||||
val KBAPIModuleConfig.pluginMainName get() = artifactId
|
||||
@@ -0,0 +1,99 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard.utils
|
||||
|
||||
import tech.carcadex.kotlinbukkitkit.tooling.wizard.bukkit.Plugin
|
||||
import com.intellij.ui.CheckboxTree
|
||||
import com.intellij.ui.CheckedTreeNode
|
||||
import com.intellij.ui.SimpleTextAttributes
|
||||
import com.intellij.util.ui.ThreeStateCheckBox
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import javax.swing.JTree
|
||||
import javax.swing.tree.DefaultTreeModel
|
||||
import javax.swing.tree.TreePath
|
||||
|
||||
open class ThreeStateCheckedTreeNode : CheckedTreeNode {
|
||||
constructor() : super()
|
||||
constructor(userObject: Any?) : super(userObject)
|
||||
|
||||
var indeterminate = false
|
||||
}
|
||||
|
||||
/**
|
||||
* Based on Ktor FeatureCheckboxList
|
||||
* https://github.com/ktorio/ktor-init-tools/blob/master/ktor-intellij-plugin/src/io/ktor/start/intellij/KtorModuleWizardStep.kt#L175
|
||||
*/
|
||||
abstract class PluginCheckboxList(val plugins: List<Plugin>) : CheckboxTree(
|
||||
object : CheckboxTree.CheckboxTreeCellRenderer() {
|
||||
override fun customizeRenderer(
|
||||
tree: JTree?,
|
||||
value: Any?,
|
||||
selected: Boolean,
|
||||
expanded: Boolean,
|
||||
leaf: Boolean,
|
||||
row: Int,
|
||||
hasFocus: Boolean
|
||||
) {
|
||||
if (value is ThreeStateCheckedTreeNode) {
|
||||
val plugin = value.userObject
|
||||
val tscheckbox = checkbox as ThreeStateCheckBox
|
||||
if (plugin is Plugin) {
|
||||
val style: SimpleTextAttributes = when {
|
||||
value.indeterminate -> SimpleTextAttributes.REGULAR_ITALIC_ATTRIBUTES
|
||||
else -> SimpleTextAttributes.REGULAR_ATTRIBUTES
|
||||
}
|
||||
textRenderer.append(plugin.name, style)
|
||||
textRenderer.isEnabled = true
|
||||
tscheckbox.isVisible = true
|
||||
tscheckbox.state = when {
|
||||
value.indeterminate -> ThreeStateCheckBox.State.DONT_CARE
|
||||
value.isChecked -> ThreeStateCheckBox.State.SELECTED
|
||||
else -> ThreeStateCheckBox.State.NOT_SELECTED
|
||||
}
|
||||
textRenderer.foreground = UIUtil.getTreeForeground()
|
||||
} else if (plugin is String) {
|
||||
textRenderer.append(plugin)
|
||||
textRenderer.isEnabled = false
|
||||
isEnabled = false
|
||||
tscheckbox.isVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
ThreeStateCheckedTreeNode()
|
||||
) {
|
||||
val CheckedTreeNode?.plugin: Plugin? get() = this?.userObject as? Plugin?
|
||||
|
||||
val pluginsToCheckbox = LinkedHashMap<Plugin, ThreeStateCheckedTreeNode>()
|
||||
val root = (this.model as DefaultTreeModel).root as ThreeStateCheckedTreeNode
|
||||
init {
|
||||
this.model = object : DefaultTreeModel(root) {
|
||||
override fun valueForPathChanged(path: TreePath, newValue: Any) {
|
||||
super.valueForPathChanged(path, newValue)
|
||||
val node = path.lastPathComponent as ThreeStateCheckedTreeNode
|
||||
val plugin = node.plugin
|
||||
if (plugin != null) {
|
||||
onChanged(plugin, node)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
for (plugin in plugins) {
|
||||
root.add(ThreeStateCheckedTreeNode(plugin).apply { isChecked = false; pluginsToCheckbox[plugin] = this })
|
||||
}
|
||||
(this.model as DefaultTreeModel).reload(root)
|
||||
|
||||
addTreeSelectionListener { e ->
|
||||
val node = (e.newLeadSelectionPath.lastPathComponent as? ThreeStateCheckedTreeNode)
|
||||
val plugin = node?.userObject as? Plugin?
|
||||
|
||||
if (node != null) {
|
||||
onSelected(plugin, node)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract fun onSelected(feature: Plugin?, node: ThreeStateCheckedTreeNode)
|
||||
open fun onChanged(feature: Plugin, node: ThreeStateCheckedTreeNode) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard.utils
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.ModalityState
|
||||
import com.intellij.openapi.progress.ProgressIndicator
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.progress.Task
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
|
||||
/**
|
||||
* https://github.com/ktorio/ktor-init-tools/blob/master/ktor-intellij-plugin/src/io/ktor/start/intellij/util/Utils.kt
|
||||
*/
|
||||
|
||||
operator fun VirtualFile?.get(path: String?): VirtualFile? {
|
||||
if (this == null || path == null || path == "" || path == ".") return this
|
||||
val parts = path.split('/', limit = 2)
|
||||
val firstName = parts[0]
|
||||
val lastName = parts.getOrNull(1)
|
||||
val child = this.findChild(firstName)
|
||||
return if (lastName != null) child[lastName] else child
|
||||
}
|
||||
|
||||
|
||||
fun Project.backgroundTask(
|
||||
name: String,
|
||||
indeterminate: Boolean = true,
|
||||
cancellable: Boolean = false,
|
||||
background: Boolean = false,
|
||||
callback: (indicator: ProgressIndicator) -> Unit
|
||||
) {
|
||||
ProgressManager.getInstance().run(object : Task.Backgroundable(this, name, cancellable, { background }) {
|
||||
override fun shouldStartInBackground() = background
|
||||
|
||||
override fun run(indicator: ProgressIndicator) {
|
||||
try {
|
||||
if (indeterminate) indicator.isIndeterminate = true
|
||||
callback(indicator)
|
||||
} catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
throw e
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
inline fun invokeLater(crossinline func: () -> Unit) {
|
||||
if (ApplicationManager.getApplication().isDispatchThread) {
|
||||
func()
|
||||
} else {
|
||||
ApplicationManager.getApplication().invokeLater({ func() }, ModalityState.defaultModalityState())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
package tech.carcadex.kotlinbukkitkit.tooling.wizard.utils
|
||||
|
||||
import com.intellij.ui.ScrollPaneFactory
|
||||
import com.intellij.ui.components.JBScrollPane
|
||||
import com.intellij.uiDesigner.core.*
|
||||
import java.awt.*
|
||||
import javax.swing.*
|
||||
|
||||
data class TdPos(val col: Int, val row: Int)
|
||||
|
||||
@DslMarker
|
||||
annotation class TableTagMarker
|
||||
|
||||
@TableTagMarker
|
||||
class TableBuilder {
|
||||
val items = LinkedHashMap<TdPos, Pair<Component, GridConstraints>>()
|
||||
var row = 0
|
||||
var col = 0
|
||||
|
||||
var fill: TdFill = TdFill.BOTH
|
||||
var anchor: TdAlign = TdAlign.CENTER_CENTER
|
||||
var hpolicy: TdSize = TdSize.CAN_SHRINK_GROW
|
||||
var vpolicy: TdSize = TdSize.CAN_SHRINK_GROW
|
||||
var minWidth: Int? = null
|
||||
var minHeight: Int? = null
|
||||
var maxWidth: Int? = null
|
||||
var maxHeight: Int? = null
|
||||
|
||||
val nrows get() = items.values.map { it.second.row + it.second.rowSpan }.max() ?: 0
|
||||
val ncols get() = items.values.map { it.second.column + it.second.colSpan }.max() ?: 0
|
||||
}
|
||||
|
||||
fun table(callback: TableBuilder.() -> Unit): JPanel {
|
||||
val tb = TableBuilder()
|
||||
tb.callback()
|
||||
val panel = JPanel(GridLayoutManager(tb.nrows, tb.ncols, Insets(0, 0, 0, 0), 0, 0, false, false))
|
||||
for (item in tb.items.values) {
|
||||
panel.add(item.first, item.second)
|
||||
}
|
||||
//add(panel)
|
||||
return panel
|
||||
}
|
||||
|
||||
fun TableBuilder.tr(
|
||||
fill: TdFill = TdFill.BOTH,
|
||||
align: TdAlign = TdAlign.CENTER_CENTER,
|
||||
policy: TdSize = TdSize.CAN_SHRINK_GROW,
|
||||
hpolicy: TdSize = policy,
|
||||
vpolicy: TdSize = policy,
|
||||
minWidth: Int? = null,
|
||||
maxWidth: Int? = null,
|
||||
minHeight: Int? = null,
|
||||
maxHeight: Int? = null,
|
||||
callback: TableBuilder.() -> Unit
|
||||
) {
|
||||
this.fill = fill
|
||||
this.anchor = align
|
||||
this.hpolicy = hpolicy
|
||||
this.vpolicy = vpolicy
|
||||
this.minWidth = minWidth
|
||||
this.maxWidth = maxWidth
|
||||
this.minHeight = minHeight
|
||||
this.maxHeight = maxHeight
|
||||
callback()
|
||||
row++
|
||||
col = 0
|
||||
}
|
||||
|
||||
//fun TableBuilder.td(colspan: Int = 1, rowspan: Int = 1, callback: TableBuilder.() -> Unit) {
|
||||
// GridConstraints()
|
||||
//}
|
||||
|
||||
fun TableBuilder.td(
|
||||
component: Component, colspan: Int = 1, rowspan: Int = 1,
|
||||
fill: TdFill? = null,
|
||||
anchor: TdAlign? = null,
|
||||
hpolicy: TdSize? = null,
|
||||
vpolicy: TdSize? = null,
|
||||
minWidth: Int? = null,
|
||||
maxWidth: Int? = null,
|
||||
minHeight: Int? = null,
|
||||
maxHeight: Int? = null
|
||||
) {
|
||||
items[TdPos(col, row)] = Pair(
|
||||
component, GridConstraints(
|
||||
row, col,
|
||||
rowspan, colspan,
|
||||
(anchor ?: this.anchor).value,
|
||||
(fill ?: this.fill).value,
|
||||
(hpolicy ?: this.hpolicy).value,
|
||||
(vpolicy ?: this.vpolicy).value,
|
||||
Dimension((minWidth ?: this.minWidth) ?: -1, (minHeight ?: this.minHeight) ?: -1),
|
||||
Dimension(-1, -1),
|
||||
Dimension((maxWidth ?: this.maxWidth) ?: -1, (maxHeight ?: this.maxHeight) ?: -1),
|
||||
0,
|
||||
false
|
||||
)
|
||||
)
|
||||
col++
|
||||
}
|
||||
|
||||
enum class TdFill(val value: Int) {
|
||||
NONE(GridConstraints.FILL_NONE),
|
||||
HORIZONTAL(GridConstraints.FILL_HORIZONTAL),
|
||||
VERTICAL(GridConstraints.FILL_VERTICAL),
|
||||
BOTH(GridConstraints.FILL_BOTH)
|
||||
}
|
||||
|
||||
enum class TdAlign(val value: Int) {
|
||||
TOP_LEFT(GridConstraints.ANCHOR_NORTHWEST),
|
||||
TOP_CENTER(GridConstraints.ANCHOR_NORTH),
|
||||
TOP_RIGHT(GridConstraints.ANCHOR_NORTHEAST),
|
||||
|
||||
CENTER_LEFT(GridConstraints.ANCHOR_WEST),
|
||||
CENTER_CENTER(GridConstraints.ANCHOR_CENTER),
|
||||
CENTER_RIGHT(GridConstraints.ANCHOR_EAST),
|
||||
|
||||
BOTTOM_LEFT(GridConstraints.ANCHOR_SOUTHWEST),
|
||||
BOTTOM_CENTER(GridConstraints.ANCHOR_SOUTH),
|
||||
BOTTOM_RIGHT(GridConstraints.ANCHOR_SOUTHEAST),
|
||||
}
|
||||
|
||||
enum class TdSize(val value: Int) {
|
||||
FIXED(GridConstraints.SIZEPOLICY_FIXED),
|
||||
CAN_SHRINK(GridConstraints.SIZEPOLICY_CAN_SHRINK),
|
||||
CAN_GROW(GridConstraints.SIZEPOLICY_CAN_GROW),
|
||||
CAN_SHRINK_GROW(GridConstraints.SIZEPOLICY_CAN_SHRINK or GridConstraints.SIZEPOLICY_CAN_SHRINK),
|
||||
WANT_GROW(GridConstraints.SIZEPOLICY_WANT_GROW),
|
||||
}
|
||||
|
||||
val <T> JComboBox<T>.items get() = (0 until this.itemCount).map { getItemAt(it) }
|
||||
|
||||
/**
|
||||
* API from: https://github.com/ktorio/ktor-init-tools/blob/master/ktor-intellij-plugin/src/io/ktor/start/intellij/util/Utils.kt
|
||||
*/
|
||||
|
||||
fun JPanel.addAtGrid(
|
||||
item: JComponent,
|
||||
row: Int, column: Int,
|
||||
rowSpan: Int = 1, colSpan: Int = 1,
|
||||
anchor: Int = GridConstraints.ANCHOR_CENTER,
|
||||
fill: Int = GridConstraints.FILL_NONE,
|
||||
HSizePolicy: Int = GridConstraints.SIZEPOLICY_CAN_GROW or GridConstraints.SIZEPOLICY_CAN_SHRINK,
|
||||
VSizePolicy: Int = GridConstraints.SIZEPOLICY_CAN_GROW or GridConstraints.SIZEPOLICY_CAN_SHRINK,
|
||||
minimumSize: Dimension = Dimension(-1, -1),
|
||||
preferredSize: Dimension = Dimension(-1, -1),
|
||||
maximumSize: Dimension = Dimension(-1, -1)
|
||||
) {
|
||||
add(
|
||||
item,
|
||||
GridConstraints(
|
||||
row,
|
||||
column,
|
||||
rowSpan,
|
||||
colSpan,
|
||||
anchor,
|
||||
fill,
|
||||
HSizePolicy,
|
||||
VSizePolicy,
|
||||
minimumSize,
|
||||
preferredSize,
|
||||
maximumSize
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun Component.scrollVertical() = ScrollPaneFactory.createScrollPane(
|
||||
this,
|
||||
JBScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
||||
JBScrollPane.HORIZONTAL_SCROLLBAR_NEVER
|
||||
)
|
||||
@@ -1,31 +1,24 @@
|
||||
<idea-plugin>
|
||||
<id>br.com.devsrsouza.kotlinbukkitapi.tooling</id>
|
||||
<name>KotlinBukkitAPI Tooling</name>
|
||||
<vendor>DevSrSouza</vendor>
|
||||
<id>tech.carcadex.kotlinbukkitkit.tooling</id>
|
||||
<name>KotlinBukkitKit Tooling</name>
|
||||
<vendor>Denis Istratov</vendor>
|
||||
|
||||
<!-- please see https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
|
||||
on how to target different products -->
|
||||
<depends>com.intellij.modules.platform</depends>
|
||||
<depends>org.jetbrains.kotlin</depends>
|
||||
<depends>com.intellij.modules.lang</depends>
|
||||
<depends>com.intellij.modules.externalSystem</depends>
|
||||
<depends>com.intellij.modules.java</depends>
|
||||
|
||||
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<!-- Add your extensions here -->
|
||||
<fileEditorProvider implementation="br.com.devsrsouza.kotlinbukkitapi.tooling.menu.MenuPreviewFileEditorProvider"/>
|
||||
<moduleBuilder
|
||||
builderClass="tech.carcadex.kotlinbukkitkit.tooling.wizard.KBAPIModuleBuilder"
|
||||
id="KBK_STEP"
|
||||
order="first"/>
|
||||
|
||||
<fileType language="kotlin" extensions="bk.kts" name="Bukkript File" fieldName="INSTANCE"
|
||||
implementationClass="br.com.devsrsouza.kotlinbukkitapi.tooling.bukkript.BukkriptFileType" />
|
||||
<internalFileTemplate name="Bukkript Script" />
|
||||
<iconProvider implementation="br.com.devsrsouza.kotlinbukkitapi.tooling.bukkript.BukkriptIconProvider" order="first"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
<scriptDefinitionsProvider implementation="br.com.devsrsouza.kotlinbukkitapi.tooling.bukkript.BukkriptScriptDefinitionProvider" />
|
||||
</extensions>
|
||||
|
||||
<actions>
|
||||
<!-- Add your actions here -->
|
||||
<action id="Bukkript.NewScript" class="br.com.devsrsouza.kotlinbukkitapi.tooling.bukkript.BukkriptCreateNewFileAction">
|
||||
<add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewFromTemplate"/>
|
||||
</action>
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 354.67 501.96"><defs><style>.cls-1{isolation:isolate;}.cls-2{fill:#797879;}.cls-3{fill:#6d6d6d;}.cls-4{fill:#989999;}.cls-5{fill:#565656;}.cls-6{fill:#525252;}.cls-7{fill:#353535;}.cls-8{opacity:0.65;}.cls-17,.cls-8{mix-blend-mode:multiply;}.cls-9{fill:url(#Gradiente_sem_nome_4);}.cls-10{fill:url(#Gradiente_sem_nome_2);}.cls-11{fill:url(#Gradiente_sem_nome_3);}.cls-12{fill:#979797;}.cls-13{fill:#d8d8d8;}.cls-14{fill:#a8a8a8;}.cls-15{fill:#737373;}.cls-16{fill:#fff;}.cls-17{opacity:0.45;}</style><linearGradient id="Gradiente_sem_nome_4" x1="196.69" y1="389.39" x2="360.57" y2="225.51" gradientUnits="userSpaceOnUse"><stop offset="0.1" stop-color="#0995d3"/><stop offset="0.3" stop-color="#3387c8"/><stop offset="0.62" stop-color="#5876b9"/><stop offset="0.86" stop-color="#6a6eb2"/><stop offset="1" stop-color="#716baf"/></linearGradient><linearGradient id="Gradiente_sem_nome_2" x1="184.43" y1="194.2" x2="266.91" y2="111.72" gradientTransform="matrix(0.98, -0.21, 0.21, 0.98, -180.79, -26.57)" gradientUnits="userSpaceOnUse"><stop offset="0.12" stop-color="#0995d3"/><stop offset="0.42" stop-color="#497fc1"/><stop offset="0.7" stop-color="#676fb3"/><stop offset="0.83" stop-color="#716baf"/></linearGradient><linearGradient id="Gradiente_sem_nome_3" x1="112.74" y1="410.17" x2="392.46" y2="130.45" gradientTransform="matrix(0.98, -0.21, 0.21, 0.98, -180.79, -26.57)" gradientUnits="userSpaceOnUse"><stop offset="0.11" stop-color="#af5ea1"/><stop offset="0.21" stop-color="#d1609b"/><stop offset="0.43" stop-color="#e1725c"/><stop offset="0.6" stop-color="#ef7f30"/><stop offset="0.74" stop-color="#f18519"/><stop offset="0.82" stop-color="#f18816"/></linearGradient></defs><title>kotlinbukkitapi-logo</title><g class="cls-1"><g id="Camada_1" data-name="Camada 1"><rect class="cls-2" x="210.57" y="242.57" width="28.82" height="28.82"/><rect class="cls-2" x="181.75" y="242.57" width="28.82" height="28.82"/><rect class="cls-2" x="152.93" y="242.57" width="28.82" height="28.82"/><rect class="cls-3" x="124.11" y="242.57" width="28.82" height="28.82"/><rect class="cls-4" x="268.21" y="213.75" width="28.82" height="28.82"/><rect class="cls-4" x="239.39" y="213.75" width="28.82" height="28.82"/><rect class="cls-2" x="210.57" y="213.75" width="28.82" height="28.82"/><rect class="cls-2" x="181.75" y="213.75" width="28.82" height="28.82"/><rect class="cls-2" x="152.93" y="213.75" width="28.82" height="28.82"/><rect class="cls-3" x="124.11" y="213.75" width="28.82" height="28.82"/><rect class="cls-3" x="95.29" y="213.75" width="28.82" height="28.82"/><rect class="cls-5" x="66.46" y="213.75" width="28.82" height="28.82"/><rect class="cls-4" x="297.03" y="184.93" width="28.82" height="28.82"/><rect class="cls-4" x="268.21" y="184.93" width="28.82" height="28.82"/><rect class="cls-4" x="239.39" y="184.93" width="28.82" height="28.82"/><rect class="cls-2" x="210.57" y="184.93" width="28.82" height="28.82"/><rect class="cls-2" x="181.75" y="184.93" width="28.82" height="28.82"/><rect class="cls-2" x="152.93" y="184.93" width="28.82" height="28.82"/><rect class="cls-2" x="124.11" y="184.93" width="28.82" height="28.82"/><rect class="cls-3" x="95.29" y="184.93" width="28.82" height="28.82"/><rect class="cls-5" x="66.46" y="184.93" width="28.82" height="28.82"/><rect class="cls-5" x="37.64" y="184.93" width="28.82" height="28.82"/><rect class="cls-6" x="297.03" y="156.11" width="28.82" height="28.82"/><rect class="cls-6" x="268.21" y="156.11" width="28.82" height="28.82"/><rect class="cls-4" x="239.39" y="156.11" width="28.82" height="28.82"/><rect class="cls-2" x="210.57" y="156.11" width="28.82" height="28.82"/><rect class="cls-2" x="181.75" y="156.11" width="28.82" height="28.82"/><rect class="cls-2" x="152.93" y="156.11" width="28.82" height="28.82"/><rect class="cls-2" x="124.11" y="156.11" width="28.82" height="28.82"/><rect class="cls-3" x="95.29" y="156.11" width="28.82" height="28.82"/><rect class="cls-7" x="66.46" y="156.11" width="28.82" height="28.82"/><rect class="cls-7" x="37.64" y="156.11" width="28.82" height="28.82"/><rect class="cls-6" x="239.39" y="127.29" width="28.82" height="28.82"/><rect class="cls-6" x="210.57" y="127.29" width="28.82" height="28.82"/><rect class="cls-6" x="181.75" y="127.29" width="28.82" height="28.82"/><rect class="cls-7" x="152.93" y="127.29" width="28.82" height="28.82"/><rect class="cls-7" x="124.11" y="127.29" width="28.82" height="28.82"/><rect class="cls-7" x="95.29" y="127.29" width="28.82" height="28.82"/></g><g id="Camada_2_cópia_cópia" data-name="Camada 2 cópia cópia"><image class="cls-8" width="1456" height="1563" transform="scale(0.24)" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABbEAAAYcCAYAAAA8LMeNAAAACXBIWXMAAC4jAAAuIwF4pT92AAAgAElEQVR4Xuy9244jyQ4ly6yZ///h6ew6D7XjtIvFy2JclCHJDCCcXO6hUgjoF4Mj++v3798GAAAAAAAAAAAAAHBHfnUHAAAAAAAAAAAAAAB+CiQ2AAAAAAAAAAAAANwWJDYAAAAAAAAAAAAA3BYkNgAAALine truncated
|
||||
|
Before Width: | Height: | Size: 304 KiB |
|
Before Width: | Height: | Size: 80 B |
|
Before Width: | Height: | Size: 454 B |
|
Before Width: | Height: | Size: 1009 B |
|
Before Width: | Height: | Size: 943 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 593 B |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 908 B |
|
Before Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 222 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 586 B |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 209 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 482 B |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 558 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 937 B |
|
Before Width: | Height: | Size: 918 B |
|
Before Width: | Height: | Size: 802 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 328 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 530 B |
|
Before Width: | Height: | Size: 548 B |
|
Before Width: | Height: | Size: 563 B |
|
Before Width: | Height: | Size: 541 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 981 B |
|
Before Width: | Height: | Size: 412 B |
|
Before Width: | Height: | Size: 432 B |
|
Before Width: | Height: | Size: 449 B |
|
Before Width: | Height: | Size: 433 B |
|
Before Width: | Height: | Size: 997 B |
|
Before Width: | Height: | Size: 802 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 871 B |
|
Before Width: | Height: | Size: 145 B |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |