Skip to content

Commit

Permalink
Merge pull request #26 from GeyserMC/rewrite
Browse files Browse the repository at this point in the history
Rewrite: Let's make this a plugin
  • Loading branch information
Tim203 authored Jan 19, 2025
2 parents 4b10b9e + acf0853 commit 9f4608e
Show file tree
Hide file tree
Showing 50 changed files with 1,335 additions and 1,926 deletions.
25 changes: 7 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
distribution: temurin

- name: Build
Expand All @@ -27,23 +27,12 @@ jobs:
arguments: build
cache-read-only: ${{ github.ref_name != 'master' && github.ref_name != 'development' }}

- name: Build image
if: ${{ github.repository == 'GeyserMC/GlobalLinkServer' && github.ref_name == 'master' }}
run: docker build . -t $IMAGE_NAME --label "run-number=${GITHUB_RUN_ID}"
- name: Registry login
if: ${{ github.repository == 'GeyserMC/GlobalLinkServer' && github.ref_name == 'master' }}
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
if: ${{ github.repository == 'GeyserMC/GlobalLinkServer' && github.ref_name == 'master' }}
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: Archive Artifacts
uses: GeyserMC/actions/upload-multi-artifact@master
if: success()
with:
artifacts: |
GlobalLinkPlugin:build/libs/GlobalLinkPlugin.jar
- name: Notify Discord
if: ${{ (success() || failure()) && github.repository == 'GeyserMC/GlobalLinkServer' }}
Expand Down
6 changes: 0 additions & 6 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2021-2024 GeyserMC
Copyright (c) 2021-2025 GeyserMC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# GlobalLinkServer Plugin

> [!IMPORTANT]
> This repo contains the code for the Geyser Global Linking Server plugin.
> If you want to just link your account, join link.geysermc.org on Minecraft Java or Bedrock.
> For more information visit https://link.geysermc.org/
### `server.properties`
```properties
allow-nether=false
generate-structures=false
generator-settings={"biome"\:"minecraft\:the_void","layers"\:[{"block"\:"minecraft\:air","height"\:1}]}
level-type=minecraft\:flat
spawn-protection=200
```

### `spigot.yml`
```yaml
commands:
send-namespaced: false
```
### `bukkit.yml`
```yaml
settings:
allow-end: false
```

47 changes: 24 additions & 23 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
plugins {
application
alias(libs.plugins.indra)
alias(libs.plugins.indra.licenser.spotless)
alias(libs.plugins.paperweight)
alias(libs.plugins.runpaper)
}

group = "org.geysermc.globallinkserver"

dependencies {
implementation(libs.gson) // newer version required for record support
implementation(libs.fastutil.common)
paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT")

implementation(libs.bundles.protocol)
implementation(libs.mcprotocollib) {
exclude("io.netty", "netty-all")
}

// mcprotocollib won't work without this
implementation(libs.netty.handler)

implementation(libs.adventure.text.legacy)
compileOnly(libs.floodgate.api)
implementation(libs.mariadb.client)
implementation(libs.bundles.fastutil)

compileOnly(libs.checker.qual)
}

application {
mainClass.set("org.geysermc.globallinkserver.GlobalLinkServer")
}

indra {
github("GeyserMC", "GlobalLinkServer") {
ci(true)
Expand All @@ -38,27 +27,39 @@ indra {
mitLicense()

javaVersions {
target(17)
target(21)
}

spotless {
java {
palantirJavaFormat()
// Broken until paperweight updates to a newer version of spotless (6.23.3+)
// palantirJavaFormat()
formatAnnotations()
}
ratchetFrom("origin/master")
}
}

repositories {
mavenLocal()

maven("https://repo.opencollab.dev/main")
maven("https://repo.papermc.io/repository/maven-public/")

mavenCentral()

maven("https://jitpack.io") {
content { includeGroupByRegex("com\\.github\\..*") }
}
}

paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION

tasks.jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })

archiveBaseName = "GlobalLinkServer"
archiveBaseName = "GlobalLinkPlugin"
archiveVersion = ""
archiveClassifier = ""

manifest {
attributes["Main-Class"] = application.mainClass
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.0-SNAPSHOT
version=2.0-SNAPSHOT
31 changes: 14 additions & 17 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
[versions]
gson = "2.10.1"
protocol = "3.0.0.Beta5-20241022.154658-14"
netty = "4.1.110.Final"
fastutil = "8.5.2"
mcprotocollib = "86903ec" # Revert from jitpack after release
adventure-text = "4.15.0-20231207.074016-23" # Match version to MCPL
floodgate = "2.2.3-SNAPSHOT"
mariadb-client = "2.7.3"
fastutil = "8.5.2"
checker-qual = "3.21.1"

indra = "3.1.2"
paperweight = "2.0.0-beta.12"
runpaper = "2.3.1"

[libraries]
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
protocol-codec = { module = "org.cloudburstmc.protocol:bedrock-codec", version.ref = "protocol" }
protocol-connection = { module = "org.cloudburstmc.protocol:bedrock-connection", version.ref = "protocol" }
protocol-common = { module = "org.cloudburstmc.protocol:common", version.ref = "protocol" }

netty-handler = { group = "io.netty", name = "netty-handler", version.ref = "netty" }

fastutil-common = { module = "com.nukkitx.fastutil:fastutil-common", version.ref = "fastutil" }
mcprotocollib = { module = "com.github.GeyserMC:mcprotocollib", version.ref = "mcprotocollib" }
adventure-text-legacy = { module = "net.kyori:adventure-text-serializer-legacy", version.ref = "adventure-text" }
floodgate-api = { group = "org.geysermc.floodgate", name = "api", version.ref = "floodgate" }
mariadb-client = { module = "org.mariadb.jdbc:mariadb-java-client", version.ref = "mariadb-client" }

fastutil-int-int-maps = { group = "com.nukkitx.fastutil", name = "fastutil-int-int-maps", version.ref = "fastutil" }
fastutil-int-object-maps = { group = "com.nukkitx.fastutil", name = "fastutil-int-object-maps", version.ref = "fastutil" }
fastutil-object-int-maps = { group = "com.nukkitx.fastutil", name = "fastutil-object-int-maps", version.ref = "fastutil" }
fastutil-object-object-maps = { group = "com.nukkitx.fastutil", name = "fastutil-object-object-maps", version.ref = "fastutil" }

checker-qual = { module = "org.checkerframework:checker-qual", version.ref = "checker-qual" }

[plugins]
indra = { id = "net.kyori.indra", version.ref = "indra" }
indra-publishing = { id = "net.kyori.indra.publishing", version.ref = "indra" }
indra-licenser-spotless = { id = "net.kyori.indra.licenser.spotless", version.ref = "indra" }
paperweight = { id = "io.papermc.paperweight.userdev", version.ref = "paperweight" }
runpaper = { id = "xyz.jpenilla.run-paper", version.ref = "runpaper" }

[bundles]
protocol = ["protocol-codec", "protocol-connection", "protocol-common"]
fastutil = [ "fastutil-int-int-maps", "fastutil-int-object-maps", "fastutil-object-int-maps", "fastutil-object-object-maps" ]
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
22 changes: 13 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -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/.
Expand Down Expand Up @@ -83,7 +85,9 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# 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
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -144,15 +148,15 @@ 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
case $MAX_FD in #(
'' | 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
Expand Down Expand Up @@ -201,11 +205,11 @@ fi
# 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 $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.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_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" \
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##########################################################################
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
14 changes: 3 additions & 11 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
@file:Suppress("UnstableApiUsage")

dependencyResolutionManagement {
repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS
pluginManagement {
repositories {
mavenLocal()

maven("https://repo.opencollab.dev/main")

mavenCentral()

maven("https://jitpack.io") {
content { includeGroupByRegex("com\\.github\\..*") }
}
gradlePluginPortal()
maven("https://repo.papermc.io/repository/maven-public/")
}
}

Expand Down
Loading

0 comments on commit 9f4608e

Please sign in to comment.