Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
JDK 17, add skull to menu
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoDog896 committed Dec 20, 2021
1 parent 96461a9 commit 0682acd
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {
implementation("net.kyori:adventure-text-minimessage:4.1.0-SNAPSHOT")

// implement KStom
compileOnly("com.github.Project-Cepi:KStom:b20a9c0e9f")
compileOnly("com.github.Project-Cepi:KStom:6bbc7aacce")

// Add Hotbarty
compileOnly("com.github.Project-Cepi:Gooey:f083a23ef5")
Expand All @@ -63,7 +63,7 @@ tasks.withType<Test> {
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "16"
kotlinOptions.jvmTarget = "17"
}

configurations {
Expand All @@ -87,12 +87,12 @@ tasks {
}

java {
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

val compileKotlin: org.jetbrains.kotlin.gradle.tasks.KotlinCompile by tasks
compileKotlin.kotlinOptions.jvmTarget = JavaVersion.VERSION_16.toString()
compileKotlin.kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString()
compileKotlin.kotlinOptions {
freeCompilerArgs = listOf("-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn")
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/world/cepi/kepi/Kepi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Kepi : Extension() {
InventoryManager[8] = menuItem
eventNode.listenOnly<PlayerUseItemEvent> {
if (itemStack == menuItem) {
player.canvas.render { menuUI() }
player.canvas.render { menuUI(player) }
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/world/cepi/kepi/command/MenuCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import world.cepi.kstom.command.kommand.Kommand

object MenuCommand : Kommand({
default {
player.canvas.render { menuUI() }
player.canvas.render { menuUI(player) }
}
}, "menu")
22 changes: 20 additions & 2 deletions src/main/kotlin/world/cepi/kepi/menu/KepiMenuUI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,27 @@ package world.cepi.kepi.menu
import com.mattworzala.canvas.fragment
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.format.NamedTextColor
import net.minestom.server.entity.Player
import net.minestom.server.item.Material
import net.minestom.server.item.metadata.PlayerHeadMeta
import world.cepi.kstom.adventure.noItalic
import world.cepi.kstom.item.item

fun menuUI() = fragment(9, 6) {
fun menuUI(player: Player) = fragment(9, 6) {

this.inventory.title = Component.text("Menu", NamedTextColor.BLUE)
this.inventory.title = Component.text("Menu", NamedTextColor.LIGHT_PURPLE)

item(13, item(Material.PLAYER_HEAD) {
val builder = this as PlayerHeadMeta.Builder

builder.playerSkin(player.skin)

displayName(Component.text(player.username, NamedTextColor.BLUE).noItalic())
lore(
Component.empty(),
Component.text("Level: ", NamedTextColor.GRAY).noItalic()
.append(Component.text(player.level, NamedTextColor.WHITE))
)
})

}

0 comments on commit 0682acd

Please sign in to comment.