rework for 1.21, and it works!

This commit is contained in:
Alex Zenla 2025-04-10 21:42:29 -07:00
parent abd0a47424
commit c0499c0b58
No known key found for this signature in database
GPG Key ID: 067B238899B51269
20 changed files with 80 additions and 63 deletions

View File

@ -29,17 +29,17 @@ subprojects {
group = "gay.pizza.foundation"
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs += "-opt-in=kotlinx.serialization.ExperimentalSerializationApi"
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlinx.serialization.ExperimentalSerializationApi")
}
}
}
val paperServerVersion: String = project.properties["paperServerVersion"]?.toString() ?: "1.18"
val paperServerVersion: String = project.properties["paperServerVersion"]?.toString() ?: "1.21"
concreteRoot {
minecraftServerPath.set("server")
paperServerVersionGroup.set(paperServerVersion)
paperApiVersion.set("1.18.2-R0.1-SNAPSHOT")
paperApiVersion.set("1.21.4-R0.1-SNAPSHOT")
acceptServerEula.set(true)
}

View File

@ -3,17 +3,18 @@ package gay.pizza.foundation.bifrost
import gay.pizza.foundation.bifrost.model.BifrostConfig
import gay.pizza.foundation.common.BaseFoundationPlugin
import gay.pizza.foundation.common.FoundationCoreLoader
import gay.pizza.foundation.shared.*
import gay.pizza.foundation.shared.AdvancementTitleCache
import gay.pizza.foundation.shared.PluginMainClass
import io.papermc.paper.event.player.AsyncChatEvent
import net.dv8tion.jda.api.EmbedBuilder
import net.dv8tion.jda.api.JDA
import net.dv8tion.jda.api.JDABuilder
import net.dv8tion.jda.api.MessageBuilder
import net.dv8tion.jda.api.entities.Message
import net.dv8tion.jda.api.entities.TextChannel
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel
import net.dv8tion.jda.api.events.GenericEvent
import net.dv8tion.jda.api.events.ReadyEvent
import net.dv8tion.jda.api.events.message.MessageReceivedEvent
import net.dv8tion.jda.api.events.session.ReadyEvent
import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder
import net.dv8tion.jda.api.utils.messages.MessageCreateData
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
import org.bukkit.event.EventHandler
@ -98,12 +99,12 @@ class FoundationBifrostPlugin : BaseFoundationPlugin(), DiscordEventListener, Bu
return channel
}
private fun message(f: MessageBuilder.() -> Unit) = MessageBuilder().apply(f).build()
private fun MessageBuilder.embed(f: EmbedBuilder.() -> Unit) {
private fun message(f: MessageCreateBuilder.() -> Unit) = MessageCreateBuilder().apply(f).build()
private fun MessageCreateBuilder.embed(f: EmbedBuilder.() -> Unit) {
setEmbeds(EmbedBuilder().apply(f).build())
}
private fun sendChannelMessage(message: Message, debug: () -> String) {
private fun sendChannelMessage(message: MessageCreateData, debug: () -> String) {
val channel = getTextChannel()
channel?.sendMessage(message)?.queue()

View File

@ -3,8 +3,9 @@ package gay.pizza.foundation.core.features.update
import gay.pizza.foundation.concrete.ExtensibleManifest
import kotlinx.serialization.json.Json
import org.bukkit.Server
import java.net.URL
import java.net.URI
@Suppress("UnstableApiUsage")
class UpdateResolver {
fun fetchCurrentManifest(): ExtensibleManifest {
val jsonContentString = latestManifestUrl.openStream().readAllBytes().decodeToString()
@ -39,7 +40,7 @@ class UpdateResolver {
if (entry.value == null) {
true
} else {
val installed = entry.value!!.description.version
val installed = entry.value!!.pluginMeta.version
if (installed == "DEV") {
false
} else {
@ -51,7 +52,7 @@ class UpdateResolver {
}
companion object {
internal val latestManifestUrl = URL("https://artifacts.gay.pizza/foundation/manifest.json")
internal val latestManifestUrl = URI("https://artifacts.gay.pizza/foundation/manifest.json").toURL()
private val jsonRelaxed = Json { ignoreUnknownKeys = true }
private val pluginToManifestNameMappings = mapOf(

View File

@ -1,6 +1,7 @@
package gay.pizza.foundation.shared
import com.charleskorn.kaml.Yaml
import com.charleskorn.kaml.decodeFromStream
import kotlinx.serialization.DeserializationStrategy
import org.slf4j.Logger
import java.nio.file.Path

Binary file not shown.

View File

@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

33
gradlew vendored
View File

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -83,10 +85,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -133,18 +133,21 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@ -152,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -197,11 +200,15 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

22
gradlew.bat vendored
View File

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail

View File

@ -1,4 +1,3 @@
@file:Suppress("UnstableApiUsage")
rootProject.name = "foundation"
pluginManagement {
@ -40,8 +39,8 @@ include(
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
version("versions-plugin", "0.45.0")
version("concrete", "0.16.0")
version("versions-plugin", "0.52.0")
version("concrete", "0.17.0")
plugin("versions", "com.github.ben-manes.versions").versionRef("versions-plugin")
@ -60,19 +59,19 @@ dependencyResolutionManagement {
}
}
version("clikt", "3.5.1")
version("clikt", "5.0.3")
version("xodus", "2.0.1")
version("quartz", "2.3.2")
version("guava", "31.1-jre")
version("koin", "3.3.2")
version("aws-sdk-s3", "2.19.31")
version("slf4j-simple", "2.0.6")
version("discord-jda", "5.0.0-alpha.2")
version("kaml", "0.51.0")
version("kotlin-serialization-json", "1.3.1")
version("postgresql", "42.5.3")
version("exposed", "0.41.1")
version("hikaricp", "5.0.1")
version("quartz", "2.5.0")
version("guava", "33.4.7-jre")
version("koin", "4.0.4")
version("aws-sdk-s3", "2.31.19")
version("slf4j-simple", "2.0.17")
version("discord-jda", "5.3.2")
version("kaml", "0.76.0")
version("kotlin-serialization-json", "1.8.1")
version("postgresql", "42.7.5")
version("exposed", "0.61.0")
version("hikaricp", "6.3.0")
version("libtailscale", "0.1.6-SNAPSHOT")
library("clikt", "com.github.ajalt.clikt", "clikt").versionRef("clikt")

View File

@ -1,6 +1,6 @@
plugins {
id("gay.pizza.foundation.concrete-base")
id("com.github.johnrengelman.shadow")
id("com.gradleup.shadow")
}
dependencies {
@ -24,6 +24,6 @@ concreteItem {
type.set("tool")
fileInclusion {
tasks.shadowJar.get().outputs.files.associateWith { "tool-jar" }
tasks.getByName("shadowJar").outputs.files.associateWith { "tool-jar" }
}
}

View File

@ -9,7 +9,7 @@ import com.zaxxer.hikari.HikariDataSource
import org.jetbrains.exposed.sql.Database
import java.time.Duration
class GjallarhornCommand : CliktCommand(invokeWithoutSubcommand = true) {
class GjallarhornCommand : CliktCommand() {
private val jdbcConnectionUrl by option("-c", "--connection-url", help = "JDBC Connection URL")
.default("jdbc:postgresql://localhost/heimdall")

View File

@ -1,6 +1,7 @@
package gay.pizza.foundation.heimdall.tool.commands
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.Context
import com.github.ajalt.clikt.core.requireObject
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.flag
@ -31,7 +32,7 @@ import java.util.UUID
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ScheduledThreadPoolExecutor
class BlockChangeTimelapseCommand : CliktCommand("Block Change Timelapse", name = "block-change-timelapse") {
class BlockChangeTimelapseCommand : CliktCommand("block-change-timelapse") {
private val db by requireObject<Database>()
private val timelapseIntervalLimit by option("--timelapse-limit", help = "Timelapse Limit Intervals").int()
private val timelapseMode by option("--timelapse", help = "Timelapse Mode").enum<TimelapseMode> { it.id }.required()

View File

@ -19,7 +19,7 @@ import kotlinx.serialization.json.decodeFromStream
import kotlinx.serialization.json.encodeToStream
import org.jetbrains.exposed.sql.Database
class ChunkExportLoaderCommand : CliktCommand("Chunk Export Loader", name = "chunk-export-loader") {
class ChunkExportLoaderCommand : CliktCommand(name = "chunk-export-loader") {
private val db by requireObject<Database>()
private val exportDirectoryPath by argument("export-directory-path").path()

View File

@ -19,7 +19,7 @@ import org.jetbrains.exposed.sql.transactions.transaction
import kotlin.io.path.deleteIfExists
import kotlin.io.path.outputStream
class GenerateWorldLoadFile : CliktCommand(name = "generate-world-load", help = "Generate World Load File") {
class GenerateWorldLoadFile : CliktCommand(name = "generate-world-load") {
private val db by requireObject<Database>()
val path by argument("load-format-file").path()

View File

@ -15,7 +15,7 @@ import org.jetbrains.exposed.sql.transactions.transaction
import java.time.Instant
import java.util.*
class PlayerPositionExport : CliktCommand(name = "export-player-positions", help = "Export Player Positions") {
class PlayerPositionExport : CliktCommand(name = "export-player-positions") {
private val db by requireObject<Database>()
private val playerIdString by option("--player", help = "Player ID")

View File

@ -12,7 +12,7 @@ import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction
import java.util.*
class PlayerSessionExport : CliktCommand(name = "export-player-sessions", help = "Export Player Sessions") {
class PlayerSessionExport : CliktCommand(name = "export-player-sessions") {
private val db by requireObject<Database>()
private val playerIdString by option("--player-id", help = "Player ID")

View File

@ -1,5 +1,6 @@
package gay.pizza.foundation.heimdall.tool
import com.github.ajalt.clikt.core.main
import com.github.ajalt.clikt.core.subcommands
import gay.pizza.foundation.heimdall.tool.commands.*

View File

@ -4,8 +4,11 @@ import gay.pizza.foundation.heimdall.table.PlayerPositionTable
import gay.pizza.foundation.heimdall.tool.state.*
import gay.pizza.foundation.heimdall.tool.util.BlockColorKey
import org.jetbrains.exposed.sql.Database
import org.jetbrains.exposed.sql.SqlExpressionBuilder.greater
import org.jetbrains.exposed.sql.SqlExpressionBuilder.lessEq
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.transactions.transaction
import java.awt.Color
import java.awt.image.BufferedImage
@ -25,7 +28,7 @@ class PlayerLocationShareRenderer(
val playerSparseMap = BlockCoordinateSparseMap<MutableList<UUID>>()
val allPlayerIds = HashSet<UUID>()
transaction(db) {
PlayerPositionTable.select {
PlayerPositionTable.selectAll().where {
(PlayerPositionTable.time greater start) and
(PlayerPositionTable.time lessEq end)
}.forEach {