From 37cf7db85bfb8b145bb26a9d8b1082078fb667ea Mon Sep 17 00:00:00 2001 From: Dawson Date: Fri, 24 Nov 2023 13:53:54 -0500 Subject: [PATCH 1/7] refactor: Added gradle.kts, changed package, new repos. --- build.gradle | 6 +- build.gradle.kts | 82 +++++++++++++++++++ settings.gradle.kts | 3 +- .../flyte}/event/ChristmasEvent.kt | 12 +-- .../flyte}/event/debug/DebugCommand.kt | 2 +- .../flyte}/event/game/Game.kt | 2 +- .../flyte}/event/game/GameCommand.kt | 2 +- .../flyte}/event/game/GameType.kt | 2 +- .../flyte}/event/game/lobby/LobbyGame.kt | 2 +- .../event/game/lobby/LobbyGameEngine.kt | 4 +- .../event/game/lobby/type/PresentHuntGame.kt | 2 +- .../flyte}/event/game/main/MainGame.kt | 2 +- .../flyte}/event/game/main/MainGameEngine.kt | 4 +- .../flyte}/event/game/main/MainGameState.kt | 2 +- .../event/game/main/type/BlockPartyGame.kt | 2 +- .../event/game/main/type/KingOfTheHillGame.kt | 2 +- .../game/main/type/MusicalMinecartsGame.kt | 6 +- .../event/game/main/type/SledRacingGame.kt | 8 +- .../event/listener/ConnectionListener.kt | 4 +- .../flyte}/event/listener/MapListener.kt | 2 +- .../flyte}/event/util/MapLocation.kt | 4 +- .../flyte}/event/util/Message.kt | 2 +- .../flyte}/event/util/NBSSongType.kt | 6 +- .../flyte}/event/util/Skin.kt | 2 +- .../flyte}/event/util/npc/NPC.kt | 6 +- .../flyte}/event/util/npc/NPCClickEvent.kt | 2 +- .../flyte}/event/util/npc/NPCListener.kt | 2 +- .../flyte}/event/visual/TablistManager.kt | 6 +- src/main/resources/plugin.yml | 2 +- 29 files changed, 132 insertions(+), 51 deletions(-) create mode 100644 build.gradle.kts rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/ChristmasEvent.kt (89%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/debug/DebugCommand.kt (95%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/Game.kt (91%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/GameCommand.kt (98%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/GameType.kt (98%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/lobby/LobbyGame.kt (77%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/lobby/LobbyGameEngine.kt (93%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/lobby/type/PresentHuntGame.kt (97%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/main/MainGame.kt (86%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/main/MainGameEngine.kt (97%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/main/MainGameState.kt (58%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/main/type/BlockPartyGame.kt (98%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/main/type/KingOfTheHillGame.kt (99%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/main/type/MusicalMinecartsGame.kt (97%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/game/main/type/SledRacingGame.kt (91%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/listener/ConnectionListener.kt (96%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/listener/MapListener.kt (94%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/util/MapLocation.kt (72%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/util/Message.kt (73%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/util/NBSSongType.kt (78%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/util/Skin.kt (63%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/util/npc/NPC.kt (97%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/util/npc/NPCClickEvent.kt (91%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/util/npc/NPCListener.kt (90%) rename src/main/kotlin/{com/learnspigot => gg/flyte}/event/visual/TablistManager.kt (97%) diff --git a/build.gradle b/build.gradle index 2749593..16e5dd4 100644 --- a/build.gradle +++ b/build.gradle @@ -4,11 +4,11 @@ plugins { id "io.github.patrick.remapper" version "1.4.0" id 'com.github.johnrengelman.shadow' version '8.1.1' id "io.papermc.paperweight.userdev" version "1.5.5" - id "xyz.jpenilla.run-paper" version "2.1.0" // Adds runServer and runMojangMappedServer tasks for testing + id "xyz.jpenilla.run-paper" version "2.1.0" } -group = 'com.learnspigot' -version = '1.0-SNAPSHOT' +group = 'gg.flyte' +version = '1.0.0' repositories { mavenCentral() diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..3313bf4 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,82 @@ +plugins { + id 'java' + id 'org.jetbrains.kotlin.jvm' version '1.9.0' + id "io.github.patrick.remapper" version "1.4.0" + id 'com.github.johnrengelman.shadow' version '8.1.1' + id "io.papermc.paperweight.userdev" version "1.5.5" + id "xyz.jpenilla.run-paper" version "2.1.0" // Adds runServer and runMojangMappedServer tasks for testing +} + +group = 'gg.flyte' +version = '1.0.0' + +repositories { + maven("https://jitpack.io") + maven("https://repo.flyte.gg/releases") + maven("https://repo.papermc.io/repository/maven-public/") + maven("https://oss.sonatype.org/content/groups/public/") + maven("https://repo.codemc.io/repository/maven-snapshots/") +} + +dependencies { + paperweight.paperDevBundle("1.20.2-R0.1-SNAPSHOT") + + implementation(libs.twilight) + implementation(libs.paperlib) + + implementation(libs.lamp.common) + implementation(libs.lamp.bukkit) + + implementation 'net.wesjd:anvilgui:1.7.0-SNAPSHOT' + implementation "org.mongodb:mongodb-driver-sync:4.9.0" + implementation "gg.flyte:twilight:1.0.30" + implementation "com.github.SuperGlueLib:LampWrapper:709c323c17" + compileOnly "com.github.koca2000:NoteBlockAPI:1.6.2" +} + +build.dependsOn(shadowJar) +remap.mustRunAfter(build) + +tasks { + remap { + version.set("1.20.1") + mustRunAfter build + } +} + +tasks { + // Configure reobfJar to run when invoking the build task + assemble.dependsOn(reobfJar) + + shadowJar { + def pack = "com.learnspigot.event.shaded." + relocate("gg.flyte.twilight", "${pack}twilight") + relocate("com.github.supergluelib.lamp", "${pack}lamp.wrapper") + relocate("revxrsal.commands", "${pack}lamp") + relocate("com.google.gson", "${pack}gson") + relocate("kotlin", "${pack}kotlin") + relocate("com.mongodb", "${pack}mongodb") + relocate("io.github.cdimascio.dotenv", "${pack}dotenv") + relocate("net.wesjd.anvilgui", "${pack}anvilgui") + relocate("org.bson", "${pack}bson") + relocate("org.bson", "${pack}bson") + relocate("org.intellij.lang.annotations", "${pack}jetbrains.annotations") + relocate("org.jetbrains.annotations", "${pack}jetbrains.annotations") + } +} + +def targetJavaVersion = 17 +java { + def javaVersion = JavaVersion.toVersion(targetJavaVersion) + sourceCompatibility = javaVersion + targetCompatibility = javaVersion + if (JavaVersion.current() < javaVersion) { + toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) + } +} + +tasks.withType(JavaCompile).configureEach { + if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { + options.release = targetJavaVersion + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index d8111f8..a0817f5 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,2 @@ - -rootProject.name = "ls-christmas-plugin" +rootProject.name = "flyte-christmas-plugin" diff --git a/src/main/kotlin/com/learnspigot/event/ChristmasEvent.kt b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt similarity index 89% rename from src/main/kotlin/com/learnspigot/event/ChristmasEvent.kt rename to src/main/kotlin/gg/flyte/event/ChristmasEvent.kt index d14507c..c609252 100644 --- a/src/main/kotlin/com/learnspigot/event/ChristmasEvent.kt +++ b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event +package gg.flyte.event import com.learnspigot.event.debug.DebugCommand import com.learnspigot.event.game.GameCommand @@ -22,17 +22,17 @@ import revxrsal.commands.ktx.autoCompleter class ChristmasEvent : JavaPlugin() { companion object { - lateinit var INSTANCE: ChristmasEvent + lateinit var INSTANCE: gg.flyte.event.ChristmasEvent lateinit var SERVER: Server lateinit var WORLD: World lateinit var LOBBY_SPAWN: MapLocation } override fun onEnable() { - INSTANCE = this - SERVER = server - WORLD = Bukkit.getWorld("world")!! - LOBBY_SPAWN = MapLocation(-134, 80, 78, 90, 0) + gg.flyte.event.ChristmasEvent.Companion.INSTANCE = this + gg.flyte.event.ChristmasEvent.Companion.SERVER = server + gg.flyte.event.ChristmasEvent.Companion.WORLD = Bukkit.getWorld("world")!! + gg.flyte.event.ChristmasEvent.Companion.LOBBY_SPAWN = MapLocation(-134, 80, 78, 90, 0) twilight(this) disableCustomEventListeners(OpEventListener) diff --git a/src/main/kotlin/com/learnspigot/event/debug/DebugCommand.kt b/src/main/kotlin/gg/flyte/event/debug/DebugCommand.kt similarity index 95% rename from src/main/kotlin/com/learnspigot/event/debug/DebugCommand.kt rename to src/main/kotlin/gg/flyte/event/debug/DebugCommand.kt index 5477867..08d459b 100644 --- a/src/main/kotlin/com/learnspigot/event/debug/DebugCommand.kt +++ b/src/main/kotlin/gg/flyte/event/debug/DebugCommand.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.debug +package gg.flyte.event.debug import org.bukkit.Bukkit import org.bukkit.WorldCreator diff --git a/src/main/kotlin/com/learnspigot/event/game/Game.kt b/src/main/kotlin/gg/flyte/event/game/Game.kt similarity index 91% rename from src/main/kotlin/com/learnspigot/event/game/Game.kt rename to src/main/kotlin/gg/flyte/event/game/Game.kt index 0986971..8197453 100644 --- a/src/main/kotlin/com/learnspigot/event/game/Game.kt +++ b/src/main/kotlin/gg/flyte/event/game/Game.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.game +package gg.flyte.event.game import gg.flyte.twilight.event.TwilightListener import org.bukkit.entity.Player diff --git a/src/main/kotlin/com/learnspigot/event/game/GameCommand.kt b/src/main/kotlin/gg/flyte/event/game/GameCommand.kt similarity index 98% rename from src/main/kotlin/com/learnspigot/event/game/GameCommand.kt rename to src/main/kotlin/gg/flyte/event/game/GameCommand.kt index e486d9b..9a284d3 100644 --- a/src/main/kotlin/com/learnspigot/event/game/GameCommand.kt +++ b/src/main/kotlin/gg/flyte/event/game/GameCommand.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.game +package gg.flyte.event.game import com.learnspigot.event.game.main.MainGameEngine import net.kyori.adventure.text.Component diff --git a/src/main/kotlin/com/learnspigot/event/game/GameType.kt b/src/main/kotlin/gg/flyte/event/game/GameType.kt similarity index 98% rename from src/main/kotlin/com/learnspigot/event/game/GameType.kt rename to src/main/kotlin/gg/flyte/event/game/GameType.kt index e1a10ea..8238871 100644 --- a/src/main/kotlin/com/learnspigot/event/game/GameType.kt +++ b/src/main/kotlin/gg/flyte/event/game/GameType.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.game +package gg.flyte.event.game import com.learnspigot.event.game.lobby.type.PresentHuntGame import com.learnspigot.event.game.main.MainGame diff --git a/src/main/kotlin/com/learnspigot/event/game/lobby/LobbyGame.kt b/src/main/kotlin/gg/flyte/event/game/lobby/LobbyGame.kt similarity index 77% rename from src/main/kotlin/com/learnspigot/event/game/lobby/LobbyGame.kt rename to src/main/kotlin/gg/flyte/event/game/lobby/LobbyGame.kt index d2c9306..b1f0cd6 100644 --- a/src/main/kotlin/com/learnspigot/event/game/lobby/LobbyGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/lobby/LobbyGame.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.game.lobby +package gg.flyte.event.game.lobby import com.learnspigot.event.game.Game import org.bukkit.entity.Player diff --git a/src/main/kotlin/com/learnspigot/event/game/lobby/LobbyGameEngine.kt b/src/main/kotlin/gg/flyte/event/game/lobby/LobbyGameEngine.kt similarity index 93% rename from src/main/kotlin/com/learnspigot/event/game/lobby/LobbyGameEngine.kt rename to src/main/kotlin/gg/flyte/event/game/lobby/LobbyGameEngine.kt index 34574ee..a7308e8 100644 --- a/src/main/kotlin/com/learnspigot/event/game/lobby/LobbyGameEngine.kt +++ b/src/main/kotlin/gg/flyte/event/game/lobby/LobbyGameEngine.kt @@ -1,6 +1,6 @@ -package com.learnspigot.event.game.lobby +package gg.flyte.event.game.lobby -import com.learnspigot.event.ChristmasEvent +import gg.flyte.event.ChristmasEvent import com.learnspigot.event.game.GameCategory import com.learnspigot.event.game.GameType import gg.flyte.twilight.event.TwilightListener diff --git a/src/main/kotlin/com/learnspigot/event/game/lobby/type/PresentHuntGame.kt b/src/main/kotlin/gg/flyte/event/game/lobby/type/PresentHuntGame.kt similarity index 97% rename from src/main/kotlin/com/learnspigot/event/game/lobby/type/PresentHuntGame.kt rename to src/main/kotlin/gg/flyte/event/game/lobby/type/PresentHuntGame.kt index b906c86..cc8a8bf 100644 --- a/src/main/kotlin/com/learnspigot/event/game/lobby/type/PresentHuntGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/lobby/type/PresentHuntGame.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.game.lobby.type +package gg.flyte.event.game.lobby.type import com.learnspigot.event.game.lobby.LobbyGame import com.learnspigot.event.game.lobby.LobbyGameEngine diff --git a/src/main/kotlin/com/learnspigot/event/game/main/MainGame.kt b/src/main/kotlin/gg/flyte/event/game/main/MainGame.kt similarity index 86% rename from src/main/kotlin/com/learnspigot/event/game/main/MainGame.kt rename to src/main/kotlin/gg/flyte/event/game/main/MainGame.kt index 0eb35c7..8b58571 100644 --- a/src/main/kotlin/com/learnspigot/event/game/main/MainGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/MainGame.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.game.main +package gg.flyte.event.game.main import com.learnspigot.event.game.Game import org.bukkit.entity.Player diff --git a/src/main/kotlin/com/learnspigot/event/game/main/MainGameEngine.kt b/src/main/kotlin/gg/flyte/event/game/main/MainGameEngine.kt similarity index 97% rename from src/main/kotlin/com/learnspigot/event/game/main/MainGameEngine.kt rename to src/main/kotlin/gg/flyte/event/game/main/MainGameEngine.kt index 5acf002..db38c0d 100644 --- a/src/main/kotlin/com/learnspigot/event/game/main/MainGameEngine.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/MainGameEngine.kt @@ -1,6 +1,6 @@ -package com.learnspigot.event.game.main +package gg.flyte.event.game.main -import com.learnspigot.event.ChristmasEvent.Companion.LOBBY_SPAWN +import gg.flyte.event.ChristmasEvent.Companion.LOBBY_SPAWN import com.learnspigot.event.game.GameType import com.learnspigot.event.game.lobby.LobbyGameEngine import gg.flyte.twilight.event.TwilightListener diff --git a/src/main/kotlin/com/learnspigot/event/game/main/MainGameState.kt b/src/main/kotlin/gg/flyte/event/game/main/MainGameState.kt similarity index 58% rename from src/main/kotlin/com/learnspigot/event/game/main/MainGameState.kt rename to src/main/kotlin/gg/flyte/event/game/main/MainGameState.kt index ac969e4..3e0a933 100644 --- a/src/main/kotlin/com/learnspigot/event/game/main/MainGameState.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/MainGameState.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.game.main +package gg.flyte.event.game.main enum class MainGameState { diff --git a/src/main/kotlin/com/learnspigot/event/game/main/type/BlockPartyGame.kt b/src/main/kotlin/gg/flyte/event/game/main/type/BlockPartyGame.kt similarity index 98% rename from src/main/kotlin/com/learnspigot/event/game/main/type/BlockPartyGame.kt rename to src/main/kotlin/gg/flyte/event/game/main/type/BlockPartyGame.kt index 6f6f4ce..80e3b36 100644 --- a/src/main/kotlin/com/learnspigot/event/game/main/type/BlockPartyGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/type/BlockPartyGame.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.game.main.type +package gg.flyte.event.game.main.type import com.learnspigot.event.game.main.MainGame import com.learnspigot.event.game.main.MainGameEngine diff --git a/src/main/kotlin/com/learnspigot/event/game/main/type/KingOfTheHillGame.kt b/src/main/kotlin/gg/flyte/event/game/main/type/KingOfTheHillGame.kt similarity index 99% rename from src/main/kotlin/com/learnspigot/event/game/main/type/KingOfTheHillGame.kt rename to src/main/kotlin/gg/flyte/event/game/main/type/KingOfTheHillGame.kt index 1fe3cee..30b71b4 100644 --- a/src/main/kotlin/com/learnspigot/event/game/main/type/KingOfTheHillGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/type/KingOfTheHillGame.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.game.main.type +package gg.flyte.event.game.main.type import com.learnspigot.event.game.GameType import com.learnspigot.event.game.main.MainGame diff --git a/src/main/kotlin/com/learnspigot/event/game/main/type/MusicalMinecartsGame.kt b/src/main/kotlin/gg/flyte/event/game/main/type/MusicalMinecartsGame.kt similarity index 97% rename from src/main/kotlin/com/learnspigot/event/game/main/type/MusicalMinecartsGame.kt rename to src/main/kotlin/gg/flyte/event/game/main/type/MusicalMinecartsGame.kt index 644eefa..34af8f5 100644 --- a/src/main/kotlin/com/learnspigot/event/game/main/type/MusicalMinecartsGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/type/MusicalMinecartsGame.kt @@ -1,6 +1,6 @@ -package com.learnspigot.event.game.main.type +package gg.flyte.event.game.main.type -import com.learnspigot.event.ChristmasEvent +import gg.flyte.event.ChristmasEvent import com.learnspigot.event.game.main.MainGame import com.learnspigot.event.game.main.MainGameEngine import com.learnspigot.event.game.GameType @@ -89,7 +89,7 @@ class MusicalMinecartsGame : MainGame() { Bukkit.getOnlinePlayers().applyForEach { playSound(Sound.BLOCK_NOTE_BLOCK_BASEDRUM) } // SPAWNING MINECARTS - val potentialSpawnLocations = MINECART_SPAWN.getLocations(ChristmasEvent.WORLD) + val potentialSpawnLocations = MINECART_SPAWN.getLocations(gg.flyte.event.ChristmasEvent.WORLD) kotlin.repeat((alive.size * 0.66).roundToInt()) { minecarts += potentialSpawnLocations.random().spawnEntity(EntityType.MINECART) as Minecart } diff --git a/src/main/kotlin/com/learnspigot/event/game/main/type/SledRacingGame.kt b/src/main/kotlin/gg/flyte/event/game/main/type/SledRacingGame.kt similarity index 91% rename from src/main/kotlin/com/learnspigot/event/game/main/type/SledRacingGame.kt rename to src/main/kotlin/gg/flyte/event/game/main/type/SledRacingGame.kt index bfebaa7..2faf11b 100644 --- a/src/main/kotlin/com/learnspigot/event/game/main/type/SledRacingGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/type/SledRacingGame.kt @@ -1,6 +1,6 @@ -package com.learnspigot.event.game.main.type +package gg.flyte.event.game.main.type -import com.learnspigot.event.ChristmasEvent +import gg.flyte.event.ChristmasEvent import com.learnspigot.event.game.main.MainGame import com.learnspigot.event.game.main.MainGameEngine import com.learnspigot.event.util.MapLocation @@ -37,7 +37,7 @@ class SledRacingGame : MainGame() { private val boats = mutableMapOf() init { - STARTING_WALL.getBlocks(ChristmasEvent.WORLD).applyForEach { type = Material.OAK_FENCE } + STARTING_WALL.getBlocks(gg.flyte.event.ChristmasEvent.WORLD).applyForEach { type = Material.OAK_FENCE } Bukkit.getOnlinePlayers().forEach { player -> (player.world.spawnEntity(player.location, EntityType.BOAT) as Boat).apply { @@ -61,7 +61,7 @@ class SledRacingGame : MainGame() { override fun start() { startTime = System.currentTimeMillis() - STARTING_WALL.getBlocks(ChristmasEvent.WORLD).applyForEach { type = Material.AIR } + STARTING_WALL.getBlocks(gg.flyte.event.ChristmasEvent.WORLD).applyForEach { type = Material.AIR } var timer = 60.0 tasks += repeat(5) { diff --git a/src/main/kotlin/com/learnspigot/event/listener/ConnectionListener.kt b/src/main/kotlin/gg/flyte/event/listener/ConnectionListener.kt similarity index 96% rename from src/main/kotlin/com/learnspigot/event/listener/ConnectionListener.kt rename to src/main/kotlin/gg/flyte/event/listener/ConnectionListener.kt index 2120a31..989a098 100644 --- a/src/main/kotlin/com/learnspigot/event/listener/ConnectionListener.kt +++ b/src/main/kotlin/gg/flyte/event/listener/ConnectionListener.kt @@ -1,6 +1,6 @@ -package com.learnspigot.event.listener +package gg.flyte.event.listener -import com.learnspigot.event.ChristmasEvent.Companion.LOBBY_SPAWN +import gg.flyte.event.ChristmasEvent.Companion.LOBBY_SPAWN import com.learnspigot.event.game.main.MainGameEngine import com.learnspigot.event.util.npc.NPC import com.learnspigot.event.visual.TablistManager diff --git a/src/main/kotlin/com/learnspigot/event/listener/MapListener.kt b/src/main/kotlin/gg/flyte/event/listener/MapListener.kt similarity index 94% rename from src/main/kotlin/com/learnspigot/event/listener/MapListener.kt rename to src/main/kotlin/gg/flyte/event/listener/MapListener.kt index 401f144..6c98304 100644 --- a/src/main/kotlin/com/learnspigot/event/listener/MapListener.kt +++ b/src/main/kotlin/gg/flyte/event/listener/MapListener.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.listener +package gg.flyte.event.listener import gg.flyte.twilight.event.event import org.bukkit.entity.EntityType diff --git a/src/main/kotlin/com/learnspigot/event/util/MapLocation.kt b/src/main/kotlin/gg/flyte/event/util/MapLocation.kt similarity index 72% rename from src/main/kotlin/com/learnspigot/event/util/MapLocation.kt rename to src/main/kotlin/gg/flyte/event/util/MapLocation.kt index 523d632..3c357c2 100644 --- a/src/main/kotlin/com/learnspigot/event/util/MapLocation.kt +++ b/src/main/kotlin/gg/flyte/event/util/MapLocation.kt @@ -1,6 +1,6 @@ -package com.learnspigot.event.util +package gg.flyte.event.util -import com.learnspigot.event.ChristmasEvent.Companion.WORLD +import gg.flyte.event.ChristmasEvent.Companion.WORLD import org.bukkit.Location data class MapLocation( diff --git a/src/main/kotlin/com/learnspigot/event/util/Message.kt b/src/main/kotlin/gg/flyte/event/util/Message.kt similarity index 73% rename from src/main/kotlin/com/learnspigot/event/util/Message.kt rename to src/main/kotlin/gg/flyte/event/util/Message.kt index 3c1087d..273c2df 100644 --- a/src/main/kotlin/com/learnspigot/event/util/Message.kt +++ b/src/main/kotlin/gg/flyte/event/util/Message.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.util +package gg.flyte.event.util import net.kyori.adventure.text.format.TextColor diff --git a/src/main/kotlin/com/learnspigot/event/util/NBSSongType.kt b/src/main/kotlin/gg/flyte/event/util/NBSSongType.kt similarity index 78% rename from src/main/kotlin/com/learnspigot/event/util/NBSSongType.kt rename to src/main/kotlin/gg/flyte/event/util/NBSSongType.kt index 9874640..03a56cd 100644 --- a/src/main/kotlin/com/learnspigot/event/util/NBSSongType.kt +++ b/src/main/kotlin/gg/flyte/event/util/NBSSongType.kt @@ -1,12 +1,12 @@ -package com.learnspigot.event.util +package gg.flyte.event.util -import com.learnspigot.event.ChristmasEvent +import gg.flyte.event.ChristmasEvent import com.xxmicloxx.NoteBlockAPI.model.Song import com.xxmicloxx.NoteBlockAPI.utils.NBSDecoder import java.io.File private fun parse(fileName: String): Song { - return NBSDecoder.parse(File("${ChristmasEvent.INSTANCE.dataFolder}/music", fileName)) + return NBSDecoder.parse(File("${gg.flyte.event.ChristmasEvent.INSTANCE.dataFolder}/music", fileName)) } enum class NBSSongType(val title: String, val song: Song) { diff --git a/src/main/kotlin/com/learnspigot/event/util/Skin.kt b/src/main/kotlin/gg/flyte/event/util/Skin.kt similarity index 63% rename from src/main/kotlin/com/learnspigot/event/util/Skin.kt rename to src/main/kotlin/gg/flyte/event/util/Skin.kt index 75d48b2..35a6afd 100644 --- a/src/main/kotlin/com/learnspigot/event/util/Skin.kt +++ b/src/main/kotlin/gg/flyte/event/util/Skin.kt @@ -1,3 +1,3 @@ -package com.learnspigot.event.util +package gg.flyte.event.util data class Skin(val texture: String, val signature: String) \ No newline at end of file diff --git a/src/main/kotlin/com/learnspigot/event/util/npc/NPC.kt b/src/main/kotlin/gg/flyte/event/util/npc/NPC.kt similarity index 97% rename from src/main/kotlin/com/learnspigot/event/util/npc/NPC.kt rename to src/main/kotlin/gg/flyte/event/util/npc/NPC.kt index 78f1af0..c4c9908 100644 --- a/src/main/kotlin/com/learnspigot/event/util/npc/NPC.kt +++ b/src/main/kotlin/gg/flyte/event/util/npc/NPC.kt @@ -1,6 +1,6 @@ -package com.learnspigot.event.util.npc +package gg.flyte.event.util.npc -import com.learnspigot.event.ChristmasEvent +import gg.flyte.event.ChristmasEvent import com.learnspigot.event.util.Skin import com.mojang.authlib.GameProfile import com.mojang.authlib.properties.Property @@ -64,7 +64,7 @@ class NPC( } if (followPlayer) { - runTaskTimer(ChristmasEvent.INSTANCE, 5, 5) + runTaskTimer(gg.flyte.event.ChristmasEvent.INSTANCE, 5, 5) } } diff --git a/src/main/kotlin/com/learnspigot/event/util/npc/NPCClickEvent.kt b/src/main/kotlin/gg/flyte/event/util/npc/NPCClickEvent.kt similarity index 91% rename from src/main/kotlin/com/learnspigot/event/util/npc/NPCClickEvent.kt rename to src/main/kotlin/gg/flyte/event/util/npc/NPCClickEvent.kt index b7bba3f..52dee92 100644 --- a/src/main/kotlin/com/learnspigot/event/util/npc/NPCClickEvent.kt +++ b/src/main/kotlin/gg/flyte/event/util/npc/NPCClickEvent.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.util.npc +package gg.flyte.event.util.npc import org.bukkit.entity.Player import org.bukkit.event.Event diff --git a/src/main/kotlin/com/learnspigot/event/util/npc/NPCListener.kt b/src/main/kotlin/gg/flyte/event/util/npc/NPCListener.kt similarity index 90% rename from src/main/kotlin/com/learnspigot/event/util/npc/NPCListener.kt rename to src/main/kotlin/gg/flyte/event/util/npc/NPCListener.kt index b11751f..8cb4b7f 100644 --- a/src/main/kotlin/com/learnspigot/event/util/npc/NPCListener.kt +++ b/src/main/kotlin/gg/flyte/event/util/npc/NPCListener.kt @@ -1,4 +1,4 @@ -package com.learnspigot.event.util.npc +package gg.flyte.event.util.npc import gg.flyte.twilight.event.event import org.bukkit.Bukkit diff --git a/src/main/kotlin/com/learnspigot/event/visual/TablistManager.kt b/src/main/kotlin/gg/flyte/event/visual/TablistManager.kt similarity index 97% rename from src/main/kotlin/com/learnspigot/event/visual/TablistManager.kt rename to src/main/kotlin/gg/flyte/event/visual/TablistManager.kt index 851323b..f3ff1bc 100644 --- a/src/main/kotlin/com/learnspigot/event/visual/TablistManager.kt +++ b/src/main/kotlin/gg/flyte/event/visual/TablistManager.kt @@ -1,6 +1,6 @@ -package com.learnspigot.event.visual +package gg.flyte.event.visual -import com.learnspigot.event.ChristmasEvent +import gg.flyte.event.ChristmasEvent import com.learnspigot.event.util.CHRISTMAS_RED import com.mojang.authlib.GameProfile import com.mojang.authlib.properties.Property @@ -25,7 +25,7 @@ object TablistManager { private val fakePlayers = mutableListOf().apply { val server = (Bukkit.getServer() as CraftServer).server - val world = (ChristmasEvent.WORLD as CraftWorld).handle + val world = (gg.flyte.event.ChristmasEvent.WORLD as CraftWorld).handle val property = Property( "textures", "ewogICJ0aW1lc3RhbXAiIDogMTYwNzcxNjUwMzI2OCwKICAicHJvZmlsZUlkIiA6ICJlYjIwYWVkYTRiYTM0NzVmOTczZGNmZjkzNTE2OGZhYSIsCiAgInByb2ZpbGVOYW1lIiA6ICJTa3lGYWxsZWVlIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2IxYmI1NzdkZjg3OGU4NzY1YzhjMDZmZWVlY2Y5ODA3OTRlZWE5ODI4MDFjMjc5NWI4MjY4ZjA5MzI2MGEwZTAiCiAgICB9CiAgfQp9", diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 3d8143c..82759a2 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: ChristmasEvent -version: 1.0 +version: 1.0.0 main: com.learnspigot.event.ChristmasEvent api-version: 1.20 contributors: [Stephen, Josh] From 465bffdc577c22a62ec17c3a2e1cf3372e7a360f Mon Sep 17 00:00:00 2001 From: Dawson Date: Fri, 24 Nov 2023 14:06:47 -0500 Subject: [PATCH 2/7] refactor(gradle): Fixed imports to use file, refactored imports, removed Lamp Wrapper as its outdated. --- build.gradle | 90 ------------------- build.gradle.kts | 88 +++++++++--------- gradle/libs.versions.toml | 36 ++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- .../kotlin/gg/flyte/event/ChristmasEvent.kt | 27 +++--- .../kotlin/gg/flyte/event/game/GameCommand.kt | 2 +- .../kotlin/gg/flyte/event/game/GameType.kt | 12 +-- .../gg/flyte/event/game/lobby/LobbyGame.kt | 2 +- .../flyte/event/game/lobby/LobbyGameEngine.kt | 4 +- .../event/game/lobby/type/PresentHuntGame.kt | 6 +- .../gg/flyte/event/game/main/MainGame.kt | 2 +- .../flyte/event/game/main/MainGameEngine.kt | 4 +- .../event/game/main/type/BlockPartyGame.kt | 6 +- .../event/game/main/type/KingOfTheHillGame.kt | 6 +- .../game/main/type/MusicalMinecartsGame.kt | 10 +-- .../event/game/main/type/SledRacingGame.kt | 6 +- .../event/listener/ConnectionListener.kt | 6 +- .../kotlin/gg/flyte/event/util/npc/NPC.kt | 2 +- .../gg/flyte/event/visual/TablistManager.kt | 2 +- src/main/resources/plugin.yml | 8 +- 20 files changed, 134 insertions(+), 187 deletions(-) delete mode 100644 build.gradle create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 16e5dd4..0000000 --- a/build.gradle +++ /dev/null @@ -1,90 +0,0 @@ -plugins { - id 'java' - id 'org.jetbrains.kotlin.jvm' version '1.9.0' - id "io.github.patrick.remapper" version "1.4.0" - id 'com.github.johnrengelman.shadow' version '8.1.1' - id "io.papermc.paperweight.userdev" version "1.5.5" - id "xyz.jpenilla.run-paper" version "2.1.0" -} - -group = 'gg.flyte' -version = '1.0.0' - -repositories { - mavenCentral() - mavenLocal() - maven { - name = "papermc-repo" - url = "https://repo.papermc.io/repository/maven-public/" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/groups/public/" - } - maven { - name 'codemc-snapshots' - url 'https://repo.codemc.io/repository/maven-snapshots/' - } - maven { - url "https://repo.flyte.gg/releases" - } - maven { - url "https://jitpack.io" - } -} - -dependencies { - paperweight.paperDevBundle("1.20.1-R0.1-SNAPSHOT") - implementation 'net.wesjd:anvilgui:1.7.0-SNAPSHOT' - implementation "org.mongodb:mongodb-driver-sync:4.9.0" - implementation "gg.flyte:twilight:1.0.30" - implementation "com.github.SuperGlueLib:LampWrapper:709c323c17" - compileOnly "com.github.koca2000:NoteBlockAPI:1.6.2" -} - -build.dependsOn(shadowJar) -remap.mustRunAfter(build) - -tasks { - remap { - version.set("1.20.1") - mustRunAfter build - } -} - -tasks { - // Configure reobfJar to run when invoking the build task - assemble.dependsOn(reobfJar) - - shadowJar { - def pack = "com.learnspigot.event.shaded." - relocate("gg.flyte.twilight", "${pack}twilight") - relocate("com.github.supergluelib.lamp", "${pack}lamp.wrapper") - relocate("revxrsal.commands", "${pack}lamp") - relocate("com.google.gson", "${pack}gson") - relocate("kotlin", "${pack}kotlin") - relocate("com.mongodb", "${pack}mongodb") - relocate("io.github.cdimascio.dotenv", "${pack}dotenv") - relocate("net.wesjd.anvilgui", "${pack}anvilgui") - relocate("org.bson", "${pack}bson") - relocate("org.bson", "${pack}bson") - relocate("org.intellij.lang.annotations", "${pack}jetbrains.annotations") - relocate("org.jetbrains.annotations", "${pack}jetbrains.annotations") - } -} - -def targetJavaVersion = 17 -java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) - } -} - -tasks.withType(JavaCompile).configureEach { - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - options.release = targetJavaVersion - } -} diff --git a/build.gradle.kts b/build.gradle.kts index 3313bf4..c5b9aec 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,15 +1,14 @@ plugins { - id 'java' - id 'org.jetbrains.kotlin.jvm' version '1.9.0' - id "io.github.patrick.remapper" version "1.4.0" - id 'com.github.johnrengelman.shadow' version '8.1.1' - id "io.papermc.paperweight.userdev" version "1.5.5" - id "xyz.jpenilla.run-paper" version "2.1.0" // Adds runServer and runMojangMappedServer tasks for testing -} + alias(libs.plugins.kotlin) + alias(libs.plugins.shadow) + alias(libs.plugins.paperweight) + alias(libs.plugins.run.paper) -group = 'gg.flyte' -version = '1.0.0' +// id "io.github.patrick.remapper" version "1.4.0" +} +group = "gg.flyte" +version = "1.0.0" repositories { maven("https://jitpack.io") maven("https://repo.flyte.gg/releases") @@ -27,31 +26,19 @@ dependencies { implementation(libs.lamp.common) implementation(libs.lamp.bukkit) - implementation 'net.wesjd:anvilgui:1.7.0-SNAPSHOT' - implementation "org.mongodb:mongodb-driver-sync:4.9.0" - implementation "gg.flyte:twilight:1.0.30" - implementation "com.github.SuperGlueLib:LampWrapper:709c323c17" - compileOnly "com.github.koca2000:NoteBlockAPI:1.6.2" -} - -build.dependsOn(shadowJar) -remap.mustRunAfter(build) - -tasks { - remap { - version.set("1.20.1") - mustRunAfter build - } + implementation(libs.anvil.gui) + implementation(libs.mongodb) + compileOnly(libs.noteblock.api) } tasks { - // Configure reobfJar to run when invoking the build task - assemble.dependsOn(reobfJar) + build { dependsOn(shadowJar) } + runServer { minecraftVersion("1.20.2") } + compileKotlin { kotlinOptions.jvmTarget = "17" } shadowJar { - def pack = "com.learnspigot.event.shaded." + val pack = "com.learnspigot.event.shaded." relocate("gg.flyte.twilight", "${pack}twilight") - relocate("com.github.supergluelib.lamp", "${pack}lamp.wrapper") relocate("revxrsal.commands", "${pack}lamp") relocate("com.google.gson", "${pack}gson") relocate("kotlin", "${pack}kotlin") @@ -62,21 +49,38 @@ tasks { relocate("org.bson", "${pack}bson") relocate("org.intellij.lang.annotations", "${pack}jetbrains.annotations") relocate("org.jetbrains.annotations", "${pack}jetbrains.annotations") + relocate("io.papermc.lib", "${pack}paperlib") } } -def targetJavaVersion = 17 -java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) - } -} +//remap.mustRunAfter(build) -tasks.withType(JavaCompile).configureEach { - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - options.release = targetJavaVersion - } -} +//tasks { +// remap { +// version.set("1.20.1") +// mustRunAfter build +// } +//} + + + // Configure reobfJar to run when invoking the build task +// assemble.dependsOn(reobfJar) + + + + +//def targetJavaVersion = 17 +//java { +// def javaVersion = JavaVersion.toVersion(targetJavaVersion) +// sourceCompatibility = javaVersion +// targetCompatibility = javaVersion +// if (JavaVersion.current() < javaVersion) { +// toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) +// } +//} +// +//tasks.withType(JavaCompile).configureEach { +// if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { +// options.release = targetJavaVersion +// } +//} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..7a502a8 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,36 @@ +[versions] +# Plugins +kotlin = "1.9.20" +shadow = "8.1.1" +paperweight = "1.5.5" +run-paper = "2.2.0" + +# Libraries +twilight = "1.0.30" +paperlib = "1.0.7" +bstats = "3.0.2" +lamp = "3.1.7" +adventure = "4.14.0" +adventure-platform-bukkit = "4.3.1" + +[libraries] +twilight = { module = "gg.flyte:twilight", version.ref = "twilight" } +paperlib = { module = "io.papermc:paperlib", version.ref = "paperlib" } +bstats = { module = "org.bstats:bstats-bukkit", version.ref = "bstats" } + +lamp-common = { module = "com.github.Revxrsal.Lamp:common", version.ref = "lamp" } +lamp-bukkit = { module = "com.github.Revxrsal.Lamp:bukkit", version.ref = "lamp" } + +adventure = { module = "net.kyori:adventure", version.ref = "adventure" } +adventure-text-minimessage = { module = "net.kyori:adventure-text-minimessage", version.ref = "adventure" } +adventure-platform-bukkit = { module = "net.kyori:adventure-platform-bukkit", version.ref = "adventure-platform-bukkit" } + +anvil-gui = { module = "net.wesjd:anvilgui", version = "1.7.0-SNAPSHOT" } +mongodb = { module = "org.mongodb:mongodb-driver-sync", version = "4.9.0" } +noteblock-api = { module = "com.github.koca2000:NoteBlockAPI", version = "1.6.2" } + +[plugins] +kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" } +paperweight = { id = "io.papermc.paperweight.userdev", version.ref = "paperweight" } +run-paper = { id = "xyz.jpenilla.run-paper", version.ref = "run-paper" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 42defcc..744c64d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt index c609252..a407184 100644 --- a/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt +++ b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt @@ -1,12 +1,13 @@ package gg.flyte.event -import com.learnspigot.event.debug.DebugCommand -import com.learnspigot.event.game.GameCommand -import com.learnspigot.event.game.GameType -import com.learnspigot.event.listener.ConnectionListener -import com.learnspigot.event.listener.MapListener -import com.learnspigot.event.util.MapLocation -import com.learnspigot.event.util.npc.NPCListener +import gg.flyte.event.debug.DebugCommand +import gg.flyte.event.game.GameCommand +import gg.flyte.event.game.GameType +import gg.flyte.event.listener.ConnectionListener +import gg.flyte.event.listener.MapListener +import gg.flyte.event.util.MapLocation + +import gg.flyte.event.util.npc.NPCListener import gg.flyte.twilight.event.custom.admin.listener.OpEventListener import gg.flyte.twilight.event.disableCustomEventListeners import gg.flyte.twilight.extension.enumValue @@ -29,10 +30,10 @@ class ChristmasEvent : JavaPlugin() { } override fun onEnable() { - gg.flyte.event.ChristmasEvent.Companion.INSTANCE = this - gg.flyte.event.ChristmasEvent.Companion.SERVER = server - gg.flyte.event.ChristmasEvent.Companion.WORLD = Bukkit.getWorld("world")!! - gg.flyte.event.ChristmasEvent.Companion.LOBBY_SPAWN = MapLocation(-134, 80, 78, 90, 0) + INSTANCE = this + SERVER = server + WORLD = Bukkit.getWorld("world")!! + LOBBY_SPAWN = MapLocation(-134, 80, 78, 90, 0) twilight(this) disableCustomEventListeners(OpEventListener) @@ -53,10 +54,6 @@ class ChristmasEvent : JavaPlugin() { // TEST REMOVE } - override fun onDisable() { - - } - private fun commands() { BukkitCommandHandler.create(this).apply { registerValueResolver(GameType::class.java) { diff --git a/src/main/kotlin/gg/flyte/event/game/GameCommand.kt b/src/main/kotlin/gg/flyte/event/game/GameCommand.kt index 9a284d3..fa06458 100644 --- a/src/main/kotlin/gg/flyte/event/game/GameCommand.kt +++ b/src/main/kotlin/gg/flyte/event/game/GameCommand.kt @@ -1,6 +1,6 @@ package gg.flyte.event.game -import com.learnspigot.event.game.main.MainGameEngine +import gg.flyte.event.game.main.MainGameEngine import net.kyori.adventure.text.Component import net.kyori.adventure.text.format.NamedTextColor import org.bukkit.Bukkit diff --git a/src/main/kotlin/gg/flyte/event/game/GameType.kt b/src/main/kotlin/gg/flyte/event/game/GameType.kt index 8238871..617f99a 100644 --- a/src/main/kotlin/gg/flyte/event/game/GameType.kt +++ b/src/main/kotlin/gg/flyte/event/game/GameType.kt @@ -1,11 +1,11 @@ package gg.flyte.event.game -import com.learnspigot.event.game.lobby.type.PresentHuntGame -import com.learnspigot.event.game.main.MainGame -import com.learnspigot.event.game.main.type.KingOfTheHillGame -import com.learnspigot.event.game.main.type.MusicalMinecartsGame -import com.learnspigot.event.game.main.type.SledRacingGame -import com.learnspigot.event.util.MapLocation +import gg.flyte.event.game.lobby.type.PresentHuntGame +import gg.flyte.event.game.main.MainGame +import gg.flyte.event.game.main.type.KingOfTheHillGame +import gg.flyte.event.game.main.type.MusicalMinecartsGame +import gg.flyte.event.game.main.type.SledRacingGame +import gg.flyte.event.util.MapLocation import net.kyori.adventure.text.Component import org.bukkit.GameMode import org.bukkit.util.BoundingBox diff --git a/src/main/kotlin/gg/flyte/event/game/lobby/LobbyGame.kt b/src/main/kotlin/gg/flyte/event/game/lobby/LobbyGame.kt index b1f0cd6..2ce8047 100644 --- a/src/main/kotlin/gg/flyte/event/game/lobby/LobbyGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/lobby/LobbyGame.kt @@ -1,6 +1,6 @@ package gg.flyte.event.game.lobby -import com.learnspigot.event.game.Game +import gg.flyte.event.game.Game import org.bukkit.entity.Player abstract class LobbyGame : Game() { diff --git a/src/main/kotlin/gg/flyte/event/game/lobby/LobbyGameEngine.kt b/src/main/kotlin/gg/flyte/event/game/lobby/LobbyGameEngine.kt index a7308e8..5686e34 100644 --- a/src/main/kotlin/gg/flyte/event/game/lobby/LobbyGameEngine.kt +++ b/src/main/kotlin/gg/flyte/event/game/lobby/LobbyGameEngine.kt @@ -1,8 +1,8 @@ package gg.flyte.event.game.lobby import gg.flyte.event.ChristmasEvent -import com.learnspigot.event.game.GameCategory -import com.learnspigot.event.game.GameType +import gg.flyte.event.game.GameCategory +import gg.flyte.event.game.GameType import gg.flyte.twilight.event.TwilightListener import gg.flyte.twilight.extension.applyForEach import gg.flyte.twilight.extension.clearActionBar diff --git a/src/main/kotlin/gg/flyte/event/game/lobby/type/PresentHuntGame.kt b/src/main/kotlin/gg/flyte/event/game/lobby/type/PresentHuntGame.kt index cc8a8bf..41b899a 100644 --- a/src/main/kotlin/gg/flyte/event/game/lobby/type/PresentHuntGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/lobby/type/PresentHuntGame.kt @@ -1,8 +1,8 @@ package gg.flyte.event.game.lobby.type -import com.learnspigot.event.game.lobby.LobbyGame -import com.learnspigot.event.game.lobby.LobbyGameEngine -import com.learnspigot.event.util.MapLocation +import gg.flyte.event.game.lobby.LobbyGame +import gg.flyte.event.game.lobby.LobbyGameEngine +import gg.flyte.event.util.MapLocation import gg.flyte.twilight.event.custom.interact.PlayerMainHandInteractEvent import gg.flyte.twilight.event.event import gg.flyte.twilight.extension.applyForEach diff --git a/src/main/kotlin/gg/flyte/event/game/main/MainGame.kt b/src/main/kotlin/gg/flyte/event/game/main/MainGame.kt index 8b58571..5476c5d 100644 --- a/src/main/kotlin/gg/flyte/event/game/main/MainGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/MainGame.kt @@ -1,6 +1,6 @@ package gg.flyte.event.game.main -import com.learnspigot.event.game.Game +import gg.flyte.event.game.Game import org.bukkit.entity.Player import java.util.* diff --git a/src/main/kotlin/gg/flyte/event/game/main/MainGameEngine.kt b/src/main/kotlin/gg/flyte/event/game/main/MainGameEngine.kt index db38c0d..41c41ad 100644 --- a/src/main/kotlin/gg/flyte/event/game/main/MainGameEngine.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/MainGameEngine.kt @@ -1,8 +1,8 @@ package gg.flyte.event.game.main import gg.flyte.event.ChristmasEvent.Companion.LOBBY_SPAWN -import com.learnspigot.event.game.GameType -import com.learnspigot.event.game.lobby.LobbyGameEngine +import gg.flyte.event.game.GameType +import gg.flyte.event.game.lobby.LobbyGameEngine import gg.flyte.twilight.event.TwilightListener import gg.flyte.twilight.extension.applyForEach import gg.flyte.twilight.extension.clearActionBar diff --git a/src/main/kotlin/gg/flyte/event/game/main/type/BlockPartyGame.kt b/src/main/kotlin/gg/flyte/event/game/main/type/BlockPartyGame.kt index 80e3b36..4976e8d 100644 --- a/src/main/kotlin/gg/flyte/event/game/main/type/BlockPartyGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/type/BlockPartyGame.kt @@ -1,8 +1,8 @@ package gg.flyte.event.game.main.type -import com.learnspigot.event.game.main.MainGame -import com.learnspigot.event.game.main.MainGameEngine -import com.learnspigot.event.util.NBSSongType +import gg.flyte.event.game.main.MainGame +import gg.flyte.event.game.main.MainGameEngine +import gg.flyte.event.util.NBSSongType import com.xxmicloxx.NoteBlockAPI.model.RepeatMode import com.xxmicloxx.NoteBlockAPI.songplayer.RadioSongPlayer import gg.flyte.twilight.event.event diff --git a/src/main/kotlin/gg/flyte/event/game/main/type/KingOfTheHillGame.kt b/src/main/kotlin/gg/flyte/event/game/main/type/KingOfTheHillGame.kt index 30b71b4..6b005e8 100644 --- a/src/main/kotlin/gg/flyte/event/game/main/type/KingOfTheHillGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/type/KingOfTheHillGame.kt @@ -1,8 +1,8 @@ package gg.flyte.event.game.main.type -import com.learnspigot.event.game.GameType -import com.learnspigot.event.game.main.MainGame -import com.learnspigot.event.game.main.MainGameEngine +import gg.flyte.event.game.GameType +import gg.flyte.event.game.main.MainGame +import gg.flyte.event.game.main.MainGameEngine import gg.flyte.twilight.event.event import gg.flyte.twilight.extension.* import gg.flyte.twilight.scheduler.repeat diff --git a/src/main/kotlin/gg/flyte/event/game/main/type/MusicalMinecartsGame.kt b/src/main/kotlin/gg/flyte/event/game/main/type/MusicalMinecartsGame.kt index 34af8f5..02e2449 100644 --- a/src/main/kotlin/gg/flyte/event/game/main/type/MusicalMinecartsGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/type/MusicalMinecartsGame.kt @@ -1,11 +1,11 @@ package gg.flyte.event.game.main.type import gg.flyte.event.ChristmasEvent -import com.learnspigot.event.game.main.MainGame -import com.learnspigot.event.game.main.MainGameEngine -import com.learnspigot.event.game.GameType -import com.learnspigot.event.util.MapLocation -import com.learnspigot.event.util.NBSSongType +import gg.flyte.event.game.main.MainGame +import gg.flyte.event.game.main.MainGameEngine +import gg.flyte.event.game.GameType +import gg.flyte.event.util.MapLocation +import gg.flyte.event.util.NBSSongType import com.xxmicloxx.NoteBlockAPI.model.RepeatMode import com.xxmicloxx.NoteBlockAPI.songplayer.RadioSongPlayer import gg.flyte.twilight.event.event diff --git a/src/main/kotlin/gg/flyte/event/game/main/type/SledRacingGame.kt b/src/main/kotlin/gg/flyte/event/game/main/type/SledRacingGame.kt index 2faf11b..8de1457 100644 --- a/src/main/kotlin/gg/flyte/event/game/main/type/SledRacingGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/type/SledRacingGame.kt @@ -1,9 +1,9 @@ package gg.flyte.event.game.main.type import gg.flyte.event.ChristmasEvent -import com.learnspigot.event.game.main.MainGame -import com.learnspigot.event.game.main.MainGameEngine -import com.learnspigot.event.util.MapLocation +import gg.flyte.event.game.main.MainGame +import gg.flyte.event.game.main.MainGameEngine +import gg.flyte.event.util.MapLocation import gg.flyte.twilight.event.event import gg.flyte.twilight.extension.applyForEach import gg.flyte.twilight.extension.contains diff --git a/src/main/kotlin/gg/flyte/event/listener/ConnectionListener.kt b/src/main/kotlin/gg/flyte/event/listener/ConnectionListener.kt index 989a098..2bf3118 100644 --- a/src/main/kotlin/gg/flyte/event/listener/ConnectionListener.kt +++ b/src/main/kotlin/gg/flyte/event/listener/ConnectionListener.kt @@ -1,9 +1,9 @@ package gg.flyte.event.listener import gg.flyte.event.ChristmasEvent.Companion.LOBBY_SPAWN -import com.learnspigot.event.game.main.MainGameEngine -import com.learnspigot.event.util.npc.NPC -import com.learnspigot.event.visual.TablistManager +import gg.flyte.event.game.main.MainGameEngine +import gg.flyte.event.util.npc.NPC +import gg.flyte.event.visual.TablistManager import gg.flyte.twilight.event.event import gg.flyte.twilight.scheduler.delay import net.kyori.adventure.text.Component.text diff --git a/src/main/kotlin/gg/flyte/event/util/npc/NPC.kt b/src/main/kotlin/gg/flyte/event/util/npc/NPC.kt index c4c9908..9ed9eea 100644 --- a/src/main/kotlin/gg/flyte/event/util/npc/NPC.kt +++ b/src/main/kotlin/gg/flyte/event/util/npc/NPC.kt @@ -1,7 +1,7 @@ package gg.flyte.event.util.npc import gg.flyte.event.ChristmasEvent -import com.learnspigot.event.util.Skin +import gg.flyte.event.util.Skin import com.mojang.authlib.GameProfile import com.mojang.authlib.properties.Property import net.minecraft.network.protocol.game.* diff --git a/src/main/kotlin/gg/flyte/event/visual/TablistManager.kt b/src/main/kotlin/gg/flyte/event/visual/TablistManager.kt index f3ff1bc..81bc32a 100644 --- a/src/main/kotlin/gg/flyte/event/visual/TablistManager.kt +++ b/src/main/kotlin/gg/flyte/event/visual/TablistManager.kt @@ -1,7 +1,7 @@ package gg.flyte.event.visual import gg.flyte.event.ChristmasEvent -import com.learnspigot.event.util.CHRISTMAS_RED +import gg.flyte.event.util.CHRISTMAS_RED import com.mojang.authlib.GameProfile import com.mojang.authlib.properties.Property import gg.flyte.twilight.string.smallText diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 82759a2..5c7693d 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: ChristmasEvent version: 1.0.0 -main: com.learnspigot.event.ChristmasEvent -api-version: 1.20 -contributors: [Stephen, Josh] -website: https://learnspigot.com +main: gg.flyte.event.ChristmasEvent +api-version: '1.20' +contributors: [Flyte] +website: https://flyte.gg depend: [NoteBlockAPI] \ No newline at end of file From 1047e6e3c288d0faa817238ed3b3b83f629a0e76 Mon Sep 17 00:00:00 2001 From: Dawson Date: Fri, 24 Nov 2023 14:21:50 -0500 Subject: [PATCH 3/7] refactor(gradle)!: Refactored back to 1.20.1 due to NMS. --- build.gradle.kts | 6 +++--- src/main/kotlin/gg/flyte/event/ChristmasEvent.kt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c5b9aec..198252d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,6 +9,7 @@ plugins { group = "gg.flyte" version = "1.0.0" + repositories { maven("https://jitpack.io") maven("https://repo.flyte.gg/releases") @@ -18,7 +19,7 @@ repositories { } dependencies { - paperweight.paperDevBundle("1.20.2-R0.1-SNAPSHOT") + paperweight.paperDevBundle("1.20.1-R0.1-SNAPSHOT") implementation(libs.twilight) implementation(libs.paperlib) @@ -33,7 +34,7 @@ dependencies { tasks { build { dependsOn(shadowJar) } - runServer { minecraftVersion("1.20.2") } + runServer { minecraftVersion("1.20.1") } compileKotlin { kotlinOptions.jvmTarget = "17" } shadowJar { @@ -46,7 +47,6 @@ tasks { relocate("io.github.cdimascio.dotenv", "${pack}dotenv") relocate("net.wesjd.anvilgui", "${pack}anvilgui") relocate("org.bson", "${pack}bson") - relocate("org.bson", "${pack}bson") relocate("org.intellij.lang.annotations", "${pack}jetbrains.annotations") relocate("org.jetbrains.annotations", "${pack}jetbrains.annotations") relocate("io.papermc.lib", "${pack}paperlib") diff --git a/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt index a407184..4211d56 100644 --- a/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt +++ b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt @@ -23,7 +23,7 @@ import revxrsal.commands.ktx.autoCompleter class ChristmasEvent : JavaPlugin() { companion object { - lateinit var INSTANCE: gg.flyte.event.ChristmasEvent + lateinit var INSTANCE: ChristmasEvent lateinit var SERVER: Server lateinit var WORLD: World lateinit var LOBBY_SPAWN: MapLocation From 9b59e4267cf782529823c8aa4de266e6a8f90e8a Mon Sep 17 00:00:00 2001 From: Dawson Date: Fri, 24 Nov 2023 14:50:24 -0500 Subject: [PATCH 4/7] feat(commands): Improved commands to not cause any errors, better @DefaultFor which works. Removed all LampWrapper code. Updated Lamp. --- build.gradle.kts | 2 +- gradle/libs.versions.toml | 2 +- .../kotlin/gg/flyte/event/ChristmasEvent.kt | 2 +- .../kotlin/gg/flyte/event/CommandManager.kt | 48 +++++++++++++++++++ .../kotlin/gg/flyte/event/game/GameCommand.kt | 4 +- .../event/game/main/type/BlockPartyGame.kt | 3 +- 6 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 src/main/kotlin/gg/flyte/event/CommandManager.kt diff --git a/build.gradle.kts b/build.gradle.kts index 198252d..c0e6f3c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -38,7 +38,7 @@ tasks { compileKotlin { kotlinOptions.jvmTarget = "17" } shadowJar { - val pack = "com.learnspigot.event.shaded." + val pack = "gg.flyte.event.shaded." relocate("gg.flyte.twilight", "${pack}twilight") relocate("revxrsal.commands", "${pack}lamp") relocate("com.google.gson", "${pack}gson") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7a502a8..486b6d6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,7 @@ run-paper = "2.2.0" twilight = "1.0.30" paperlib = "1.0.7" bstats = "3.0.2" -lamp = "3.1.7" +lamp = "3.1.8" adventure = "4.14.0" adventure-platform-bukkit = "4.3.1" diff --git a/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt index 4211d56..f1b506f 100644 --- a/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt +++ b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt @@ -39,7 +39,7 @@ class ChristmasEvent : JavaPlugin() { disableCustomEventListeners(OpEventListener) listeners() - commands() + CommandManager // TEST REMOVE /*NPC( diff --git a/src/main/kotlin/gg/flyte/event/CommandManager.kt b/src/main/kotlin/gg/flyte/event/CommandManager.kt new file mode 100644 index 0000000..52e9e89 --- /dev/null +++ b/src/main/kotlin/gg/flyte/event/CommandManager.kt @@ -0,0 +1,48 @@ +package gg.flyte.event + +import gg.flyte.event.debug.DebugCommand +import gg.flyte.event.game.GameCommand +import gg.flyte.event.game.GameType +import gg.flyte.twilight.Twilight +import gg.flyte.twilight.extension.enumValue +import org.bukkit.Bukkit +import revxrsal.commands.bukkit.BukkitCommandHandler +import revxrsal.commands.exception.CommandErrorException +import revxrsal.commands.ktx.autoCompleter + +object CommandManager { + + init { + BukkitCommandHandler.create(Twilight.plugin).apply { + registerAutoComplete() + registerCommands() + registerBrigadier() + } + } + + fun BukkitCommandHandler.registerCommands() { + register( + GameCommand, +// DebugCommand + ) + } + + fun BukkitCommandHandler.registerAutoComplete() { + registerValueResolver(GameType::class.java) { + enumValue(it.pop()) ?: throw CommandErrorException("Invalid game type!", it.pop()) + } + + registerValueResolver(DebugCommand.WorldName::class.java) { DebugCommand.WorldName(it.pop()) } + + autoCompleter { + registerParameterSuggestions(GameType::class.java) { _, _, _ -> + GameType.entries.map { it.name.uppercase() } + } + + registerParameterSuggestions(DebugCommand.WorldName::class.java) { _, _, _ -> + Bukkit.getWorlds().map { it.name } + } + } + } + +} \ No newline at end of file diff --git a/src/main/kotlin/gg/flyte/event/game/GameCommand.kt b/src/main/kotlin/gg/flyte/event/game/GameCommand.kt index fa06458..d1ed90b 100644 --- a/src/main/kotlin/gg/flyte/event/game/GameCommand.kt +++ b/src/main/kotlin/gg/flyte/event/game/GameCommand.kt @@ -15,8 +15,8 @@ import revxrsal.commands.ktx.commandError @CommandPermission("admin") object GameCommand { - @DefaultFor - fun game() { + @DefaultFor("~", "~ help") + fun game(sender: CommandSender) { commandError("Invalid usage. Use /game set/start/stop [game].") } diff --git a/src/main/kotlin/gg/flyte/event/game/main/type/BlockPartyGame.kt b/src/main/kotlin/gg/flyte/event/game/main/type/BlockPartyGame.kt index 4976e8d..36f13a2 100644 --- a/src/main/kotlin/gg/flyte/event/game/main/type/BlockPartyGame.kt +++ b/src/main/kotlin/gg/flyte/event/game/main/type/BlockPartyGame.kt @@ -95,7 +95,8 @@ class BlockPartyGame : MainGame() { while (iterator.hasNext()) { val player = iterator.next() if (player.location.y <= RESPAWN_Y) { - Bukkit.broadcastMessage("${player.name} was elmimnated") + Bukkit.broadcast(Component.text("${player.name} was eliminated")) + player.apply { inventory.storageContents = emptyArray() inventory.setItemInOffHand(null) From 4b1d270248924724de0cdfe8c1b0915b088075f2 Mon Sep 17 00:00:00 2001 From: Dawson Date: Fri, 24 Nov 2023 14:53:40 -0500 Subject: [PATCH 5/7] refactor(commands): Removed unused code. --- .../kotlin/gg/flyte/event/ChristmasEvent.kt | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt index f1b506f..d05126f 100644 --- a/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt +++ b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt @@ -54,31 +54,6 @@ class ChristmasEvent : JavaPlugin() { // TEST REMOVE } - private fun commands() { - BukkitCommandHandler.create(this).apply { - registerValueResolver(GameType::class.java) { - enumValue(it.pop()) ?: throw CommandErrorException("Invalid game type!", it.pop()) - } - - registerValueResolver(DebugCommand.WorldName::class.java) { DebugCommand.WorldName(it.pop()) } - - autoCompleter { - registerParameterSuggestions(GameType::class.java) { _, _, _ -> - GameType.entries.map { it.name.uppercase() } - } - - registerParameterSuggestions(DebugCommand.WorldName::class.java) { _, _, _ -> - Bukkit.getWorlds().map { it.name } - } - } - - register( - GameCommand, - DebugCommand - ) - } - } - private fun listeners() { ConnectionListener NPCListener From 16f21926cc076ccd70d97baa9aaba11af8b7af26 Mon Sep 17 00:00:00 2001 From: Dawson Date: Fri, 24 Nov 2023 15:30:58 -0500 Subject: [PATCH 6/7] Revert "refactor(commands): Removed unused code." This reverts commit 4b1d270248924724de0cdfe8c1b0915b088075f2. --- .../kotlin/gg/flyte/event/ChristmasEvent.kt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt index d05126f..f1b506f 100644 --- a/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt +++ b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt @@ -54,6 +54,31 @@ class ChristmasEvent : JavaPlugin() { // TEST REMOVE } + private fun commands() { + BukkitCommandHandler.create(this).apply { + registerValueResolver(GameType::class.java) { + enumValue(it.pop()) ?: throw CommandErrorException("Invalid game type!", it.pop()) + } + + registerValueResolver(DebugCommand.WorldName::class.java) { DebugCommand.WorldName(it.pop()) } + + autoCompleter { + registerParameterSuggestions(GameType::class.java) { _, _, _ -> + GameType.entries.map { it.name.uppercase() } + } + + registerParameterSuggestions(DebugCommand.WorldName::class.java) { _, _, _ -> + Bukkit.getWorlds().map { it.name } + } + } + + register( + GameCommand, + DebugCommand + ) + } + } + private fun listeners() { ConnectionListener NPCListener From a6e0f9e814936a245fe3da21fa1291ff2b0a9d1f Mon Sep 17 00:00:00 2001 From: Dawson Date: Fri, 24 Nov 2023 15:32:19 -0500 Subject: [PATCH 7/7] feat(gradle)!: Changed remapping system, changed file name, changed workflow output name. --- .github/workflows/gradle-deploy.yml | 2 +- build.gradle.kts | 39 ++----------------- gradle/libs.versions.toml | 4 +- .../kotlin/gg/flyte/event/ChristmasEvent.kt | 25 ------------ .../kotlin/gg/flyte/event/CommandManager.kt | 6 +-- .../gg/flyte/event/visual/TablistManager.kt | 2 +- 6 files changed, 11 insertions(+), 67 deletions(-) diff --git a/.github/workflows/gradle-deploy.yml b/.github/workflows/gradle-deploy.yml index 79a53c4..842d674 100644 --- a/.github/workflows/gradle-deploy.yml +++ b/.github/workflows/gradle-deploy.yml @@ -55,7 +55,7 @@ jobs: echo $URL echo $REPO_NAME ls build/libs - file=$(ls build/libs/ls-christmas-plugin-1.0-SNAPSHOT.jar) + file=$(ls build/libs/flyte-christmas-plugin.jar) curl "$URL&directory=/plugins" \ -H 'Content-Type: multipart/form-data' \ -F "files=@$file" \ diff --git a/build.gradle.kts b/build.gradle.kts index c0e6f3c..950dd58 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,8 +3,6 @@ plugins { alias(libs.plugins.shadow) alias(libs.plugins.paperweight) alias(libs.plugins.run.paper) - -// id "io.github.patrick.remapper" version "1.4.0" } group = "gg.flyte" @@ -34,8 +32,11 @@ dependencies { tasks { build { dependsOn(shadowJar) } + assemble { dependsOn(reobfJar) } runServer { minecraftVersion("1.20.1") } compileKotlin { kotlinOptions.jvmTarget = "17" } + reobfJar { outputJar.set(layout.buildDirectory.file("libs/flyte-christmas-plugin.jar")) } + shadowJar { val pack = "gg.flyte.event.shaded." @@ -51,36 +52,4 @@ tasks { relocate("org.jetbrains.annotations", "${pack}jetbrains.annotations") relocate("io.papermc.lib", "${pack}paperlib") } -} - -//remap.mustRunAfter(build) - -//tasks { -// remap { -// version.set("1.20.1") -// mustRunAfter build -// } -//} - - - // Configure reobfJar to run when invoking the build task -// assemble.dependsOn(reobfJar) - - - - -//def targetJavaVersion = 17 -//java { -// def javaVersion = JavaVersion.toVersion(targetJavaVersion) -// sourceCompatibility = javaVersion -// targetCompatibility = javaVersion -// if (JavaVersion.current() < javaVersion) { -// toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) -// } -//} -// -//tasks.withType(JavaCompile).configureEach { -// if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { -// options.release = targetJavaVersion -// } -//} +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 486b6d6..2fba0c3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,8 +2,8 @@ # Plugins kotlin = "1.9.20" shadow = "8.1.1" -paperweight = "1.5.5" -run-paper = "2.2.0" +paperweight = "1.5.10" +run-paper = "2.2.2" # Libraries twilight = "1.0.30" diff --git a/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt index f1b506f..d05126f 100644 --- a/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt +++ b/src/main/kotlin/gg/flyte/event/ChristmasEvent.kt @@ -54,31 +54,6 @@ class ChristmasEvent : JavaPlugin() { // TEST REMOVE } - private fun commands() { - BukkitCommandHandler.create(this).apply { - registerValueResolver(GameType::class.java) { - enumValue(it.pop()) ?: throw CommandErrorException("Invalid game type!", it.pop()) - } - - registerValueResolver(DebugCommand.WorldName::class.java) { DebugCommand.WorldName(it.pop()) } - - autoCompleter { - registerParameterSuggestions(GameType::class.java) { _, _, _ -> - GameType.entries.map { it.name.uppercase() } - } - - registerParameterSuggestions(DebugCommand.WorldName::class.java) { _, _, _ -> - Bukkit.getWorlds().map { it.name } - } - } - - register( - GameCommand, - DebugCommand - ) - } - } - private fun listeners() { ConnectionListener NPCListener diff --git a/src/main/kotlin/gg/flyte/event/CommandManager.kt b/src/main/kotlin/gg/flyte/event/CommandManager.kt index 52e9e89..3af252b 100644 --- a/src/main/kotlin/gg/flyte/event/CommandManager.kt +++ b/src/main/kotlin/gg/flyte/event/CommandManager.kt @@ -20,14 +20,14 @@ object CommandManager { } } - fun BukkitCommandHandler.registerCommands() { + private fun BukkitCommandHandler.registerCommands() { register( GameCommand, -// DebugCommand + DebugCommand ) } - fun BukkitCommandHandler.registerAutoComplete() { + private fun BukkitCommandHandler.registerAutoComplete() { registerValueResolver(GameType::class.java) { enumValue(it.pop()) ?: throw CommandErrorException("Invalid game type!", it.pop()) } diff --git a/src/main/kotlin/gg/flyte/event/visual/TablistManager.kt b/src/main/kotlin/gg/flyte/event/visual/TablistManager.kt index 81bc32a..0e695f9 100644 --- a/src/main/kotlin/gg/flyte/event/visual/TablistManager.kt +++ b/src/main/kotlin/gg/flyte/event/visual/TablistManager.kt @@ -25,7 +25,7 @@ object TablistManager { private val fakePlayers = mutableListOf().apply { val server = (Bukkit.getServer() as CraftServer).server - val world = (gg.flyte.event.ChristmasEvent.WORLD as CraftWorld).handle + val world = (ChristmasEvent.WORLD as CraftWorld).handle val property = Property( "textures", "ewogICJ0aW1lc3RhbXAiIDogMTYwNzcxNjUwMzI2OCwKICAicHJvZmlsZUlkIiA6ICJlYjIwYWVkYTRiYTM0NzVmOTczZGNmZjkzNTE2OGZhYSIsCiAgInByb2ZpbGVOYW1lIiA6ICJTa3lGYWxsZWVlIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2IxYmI1NzdkZjg3OGU4NzY1YzhjMDZmZWVlY2Y5ODA3OTRlZWE5ODI4MDFjMjc5NWI4MjY4ZjA5MzI2MGEwZTAiCiAgICB9CiAgfQp9",