Skip to content

Commit

Permalink
Merge pull request #2 from onebeastchris/feature/geyser-api
Browse files Browse the repository at this point in the history
Update to latest Geyser API, remove more usage of internals
  • Loading branch information
rtm516 authored Sep 20, 2024
2 parents a33e404 + be20ed4 commit 8dead87
Show file tree
Hide file tree
Showing 265 changed files with 6,667 additions and 1,257 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf
25 changes: 16 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,36 @@ env:

jobs:
build-gradle:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v3

- uses: actions/setup-java@v3
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3

- name: Run build with Gradle wrapper
run: ./gradlew build
- name: Run build and tests with Gradle wrapper
run: ./gradlew test build

- name: Upload all artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest'
with:
name: jars
path: |
Expand Down
25 changes: 24 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ plugins {
id 'org.cadixdev.licenser' version '0.6.1' apply false
}

import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent

allprojects {
group = 'me.lucko'
version = '1.10-SNAPSHOT'
Expand All @@ -20,11 +23,21 @@ subprojects {
pluginDescription = 'spark is a performance profiling plugin/mod for Minecraft clients, servers and proxies.'
}

tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.release = 8
}

tasks.withType(Test).configureEach {
testLogging {
events = [TestLogEvent.PASSED, TestLogEvent.FAILED, TestLogEvent.SKIPPED]
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
}

processResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
Expand All @@ -35,6 +48,16 @@ subprojects {
}

repositories {
// Fix issue with lwjgl-freetype not being found on macOS / ForgeGradle issue
//
// Could not resolve all files for configuration ':_compileJava_1'.
// Could not find lwjgl-freetype-3.3.3-natives-macos-patch.jar (org.lwjgl:lwjgl-freetype:3.3.3).
maven {
url "https://libraries.minecraft.net"
content {
includeModule("org.lwjgl", "lwjgl-freetype")
}
}
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://repo.lucko.me/" }
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true
org.gradle.parallel=false

# thanks, forge
org.gradle.daemon=false
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.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 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 @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
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
2 changes: 2 additions & 0 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
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
Expand All @@ -12,7 +13,6 @@ pluginManagement {
name = 'NeoForge'
url = 'https://maven.neoforged.net/releases'
}
gradlePluginPortal()
}
}

Expand All @@ -25,6 +25,7 @@ include (
'spark-api',
'spark-common',
'spark-bukkit',
'spark-paper',
'spark-bungeecord',
'spark-velocity',
'spark-velocity4',
Expand Down
4 changes: 2 additions & 2 deletions spark-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ plugins {
version = '0.1-SNAPSHOT'

dependencies {
compileOnly 'org.checkerframework:checker-qual:3.8.0'
compileOnly 'org.jetbrains:annotations:20.1.0'
compileOnly 'org.checkerframework:checker-qual:3.44.0'
compileOnly 'org.jetbrains:annotations:24.1.0'
}

license {
Expand Down
10 changes: 9 additions & 1 deletion spark-api/src/main/java/me/lucko/spark/api/Spark.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
package me.lucko.spark.api;

import me.lucko.spark.api.gc.GarbageCollector;
import me.lucko.spark.api.placeholder.PlaceholderResolver;
import me.lucko.spark.api.statistic.misc.DoubleAverageInfo;
import me.lucko.spark.api.statistic.types.DoubleStatistic;
import me.lucko.spark.api.statistic.types.GenericStatistic;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.Unmodifiable;
Expand Down Expand Up @@ -84,4 +84,12 @@ public interface Spark {
*/
@NonNull @Unmodifiable Map<String, GarbageCollector> gc();

/**
* Gets a placeholder resolver.
*
* @return a placeholder resolver
*/
@NonNull
PlaceholderResolver placeholders();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* This file is part of spark, licensed under the MIT License.
*
* Copyright (c) lucko (Luck) <[email protected]>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package me.lucko.spark.api.placeholder;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

/**
* Resolves spark placeholders.
*
* <p>See <a href="https://spark.lucko.me/docs/misc/Placeholders">spark docs</a> for more info.</p>
*/
public interface PlaceholderResolver {

/**
* Resolves the given placeholder to a legacy formatted string.
*
* @param placeholder the placeholder to resolve
* @return the resolved placeholder
*/
@Nullable String resolveLegacyFormatting(@NonNull String placeholder);

/**
* Resolves the given placeholder to a text component serialised to json.
*
* @param placeholder the placeholder to resolve
* @return the resolved placeholder
*/
@Nullable String resolveComponentJson(@NonNull String placeholder);

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import me.lucko.spark.api.statistic.Statistic;
import me.lucko.spark.api.statistic.StatisticWindow;

import org.checkerframework.checker.nullness.qual.NonNull;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import me.lucko.spark.api.statistic.Statistic;
import me.lucko.spark.api.statistic.StatisticWindow;

import org.checkerframework.checker.nullness.qual.NonNull;

/**
Expand Down
13 changes: 10 additions & 3 deletions spark-bukkit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.gradleup.shadow' version '8.3.0'
}

java {
disableAutoTargetJvm()
}

dependencies {
implementation project(':spark-common')
implementation 'net.kyori:adventure-platform-bukkit:4.3.1'
compileOnly 'com.destroystokyo.paper:paper-api:1.16.4-R0.1-SNAPSHOT'
implementation 'net.kyori:adventure-platform-bukkit:4.3.3'
compileOnly 'io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT'

// placeholders
compileOnly 'me.clip:placeholderapi:2.10.3'
Expand Down Expand Up @@ -33,6 +37,7 @@ shadowJar {

relocate 'net.kyori.adventure', 'me.lucko.spark.lib.adventure'
relocate 'net.kyori.examination', 'me.lucko.spark.lib.adventure.examination'
relocate 'net.kyori.option', 'me.lucko.spark.lib.adventure.option'
relocate 'net.bytebuddy', 'me.lucko.spark.lib.bytebuddy'
relocate 'com.google.protobuf', 'me.lucko.spark.lib.protobuf'
relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm'
Expand All @@ -43,6 +48,8 @@ shadowJar {
exclude 'module-info.class'
exclude 'META-INF/maven/**'
exclude 'META-INF/proguard/**'
exclude '**/*.proto'
exclude '**/*.proto.bin'
}

artifacts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
package me.lucko.spark.bukkit;

import me.lucko.spark.common.sampler.source.ClassSourceLookup;

import org.bukkit.plugin.java.JavaPlugin;

import java.lang.reflect.Field;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
package me.lucko.spark.bukkit;

import me.lucko.spark.common.command.sender.AbstractCommandSender;

import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.Component;

import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
package me.lucko.spark.bukkit;

import me.lucko.spark.common.platform.PlatformInfo;

import org.bukkit.Server;

import java.lang.reflect.Field;
Expand All @@ -44,6 +43,11 @@ public String getName() {
return "Bukkit";
}

@Override
public String getBrand() {
return this.server.getName();
}

@Override
public String getVersion() {
return this.server.getVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
package me.lucko.spark.bukkit;

import com.google.common.collect.ImmutableMap;

import me.lucko.spark.common.monitor.ping.PlayerPingProvider;

import org.bukkit.Server;
import org.bukkit.entity.Player;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,23 @@

package me.lucko.spark.bukkit;

import co.aikar.timings.TimingsManager;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializer;

import me.lucko.spark.common.platform.serverconfig.ConfigParser;
import me.lucko.spark.common.platform.serverconfig.ExcludedConfigFilter;
import me.lucko.spark.common.platform.serverconfig.PropertiesConfigParser;
import me.lucko.spark.common.platform.serverconfig.ServerConfigProvider;

import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.configuration.MemorySection;
import org.bukkit.configuration.file.YamlConfiguration;

import co.aikar.timings.TimingsManager;

import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Files;
Expand Down
Loading

0 comments on commit 8dead87

Please sign in to comment.