diff --git a/.gitignore b/.gitignore index c426c32..56b1232 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,9 @@ out/ /.nb-gradle/ ### VS Code ### -.vscode/ \ No newline at end of file +.vscode/ + +### Other ### +development/run +!development/run/eula.txt +!development/run/server.properties \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index dcb005e..929a3dc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - kotlin("jvm") version "1.9.0" + kotlin("jvm") version "1.9.20" id("maven-publish") } @@ -18,7 +18,6 @@ repositories { dependencies { implementation(kotlin("stdlib")) - compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT") } diff --git a/development/build.gradle.kts b/development/build.gradle.kts new file mode 100644 index 0000000..951205a --- /dev/null +++ b/development/build.gradle.kts @@ -0,0 +1,45 @@ +import xyz.jpenilla.runpaper.task.RunServer + +plugins { + kotlin("jvm") version "1.9.20" + id("com.github.johnrengelman.shadow") version "8.1.1" + + id("net.minecrell.plugin-yml.bukkit") version "0.5.3" + id("xyz.jpenilla.run-paper") version "2.1.0" +} + +group = "me.tech" +version = "1.0.0" + +repositories { + mavenCentral() + + maven("https://papermc.io/repo/repository/maven-public/") +} + +dependencies { + compileOnly("io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT") + +// implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.20") + implementation(rootProject) +} + +tasks.withType { + minecraftVersion("1.20.2") +} + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) +} + +bukkit { + name = "ui-development" + apiVersion = "1.20" + version = "${project.version}" + authors = listOf("Tech") + main = "me.tech.development.DevelopmentPlugin" + + commands { + register("openui") + } +} \ No newline at end of file diff --git a/development/run/eula.txt b/development/run/eula.txt new file mode 100644 index 0000000..a9e07ce --- /dev/null +++ b/development/run/eula.txt @@ -0,0 +1,3 @@ +#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA). +#Sat Nov 25 10:08:58 EST 2023 +eula=true diff --git a/development/run/server.properties b/development/run/server.properties new file mode 100644 index 0000000..21f2adf --- /dev/null +++ b/development/run/server.properties @@ -0,0 +1,60 @@ +#Minecraft server properties +#Sat Nov 25 10:27:18 EST 2023 +enable-jmx-monitoring=false +rcon.port=25575 +level-seed= +gamemode=survival +enable-command-block=false +enable-query=false +generator-settings={} +enforce-secure-profile=true +level-name=world +motd=A Minecraft Server +query.port=25565 +pvp=true +generate-structures=true +max-chained-neighbor-updates=1000000 +difficulty=easy +network-compression-threshold=256 +max-tick-time=60000 +require-resource-pack=false +use-native-transport=true +max-players=20 +online-mode=true +enable-status=true +allow-flight=false +initial-disabled-packs= +broadcast-rcon-to-ops=true +view-distance=2 +server-ip= +resource-pack-prompt= +allow-nether=true +server-port=25565 +enable-rcon=false +sync-chunk-writes=true +op-permission-level=4 +prevent-proxy-connections=false +hide-online-players=false +resource-pack= +entity-broadcast-range-percentage=100 +simulation-distance=10 +rcon.password= +player-idle-timeout=0 +debug=false +force-gamemode=false +rate-limit=0 +hardcore=false +white-list=false +broadcast-console-to-ops=true +spawn-npcs=true +spawn-animals=true +log-ips=true +function-permission-level=2 +initial-enabled-packs=vanilla +level-type=minecraft\:normal +text-filtering-config= +spawn-monsters=true +enforce-whitelist=false +spawn-protection=16 +resource-pack-sha1= +max-world-size=29999984 diff --git a/development/src/main/kotlin/me/tech/development/DevelopmentPlugin.kt b/development/src/main/kotlin/me/tech/development/DevelopmentPlugin.kt new file mode 100644 index 0000000..60f05a0 --- /dev/null +++ b/development/src/main/kotlin/me/tech/development/DevelopmentPlugin.kt @@ -0,0 +1,42 @@ +package me.tech.development + +import me.tech.mcchestui.* +import net.kyori.adventure.text.Component +import org.bukkit.GameMode +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.Listener +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.plugin.java.JavaPlugin + +class DevelopmentPlugin : JavaPlugin(), Listener { + override fun onEnable() { + getCommand("openui")?.setExecutor { sender, _, _, _ -> + (sender as? Player)?.openGUI(open(sender)) + true + } + + // op & set gamemode on local server. + server.pluginManager.registerEvents(object : Listener { + @EventHandler + fun PlayerJoinEvent.on() { + player.gameMode = GameMode.CREATIVE + player.isOp = true + } + }, this) + } + + private fun open(player: Player): GUI { + return gui( + this, + title = Component.text("Test UI"), + type = GUIType.Chest(rows = 3) + ) { + slot(1, 1) { + item = item(Material.CAKE) + onClick = { it.sendMessage("You've clicked the cake!") } + } + } + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index cac596b..480c2ca 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,3 @@ -rootProject.name = "mc-chestui-plus" \ No newline at end of file +rootProject.name = "mc-chestui-plus" + +include("development") \ No newline at end of file