Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest Geyser API, remove more usage of internals #2

Merged
merged 46 commits into from
Sep 20, 2024
Merged
Changes from 44 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
660c10e
Update Fabric/NeoForge to MC 1.20.6
lucko Apr 29, 2024
8b6c266
Update Forge to MC 1.20.6
lucko May 6, 2024
3ac58fd
Bump adventure-platform to 4.3.3
lucko Jun 2, 2024
c3aa0cd
Add note to /spark profiler open about expiry time
lucko Jun 9, 2024
49bc094
Fix ForgeGradle issue building on macOS
lucko Jun 9, 2024
26b83dd
Bump common dependency versions
lucko Jun 9, 2024
e70616b
Tweak formatting of /spark profiler open note
lucko Jun 9, 2024
1e9a237
Update Fabric to MC 1.21 (#412)
DrexHD Jun 16, 2024
dface59
Update Forge/NeoForge to MC 1.21
lucko Jun 16, 2024
c94eba9
Include server brand in viewer payloads
lucko Jul 7, 2024
45ce159
Add caveat to warning msg about Java agents
lucko Jul 14, 2024
d909d19
Ignore trailing sleeping samples for duration estimation (#413)
SirYwell Jul 14, 2024
1b75abc
Use WeakReference for command senders (#417)
lucko Jul 14, 2024
ed8eac5
Refactor ClassFinder into interface
lucko Jul 18, 2024
8379f2b
Add spark-paper module (#422)
lucko Jul 18, 2024
3907534
Add JVM information to viewer metadata
lucko Jul 18, 2024
fdbea08
Set version correctly for spark-paper
lucko Jul 18, 2024
487cd0c
Remove spark service registration in spark-paper
lucko Jul 20, 2024
c0ffb19
Redact username from vm args (#423)
lucko Jul 20, 2024
635800a
Add placeholder resolver API
lucko Jul 20, 2024
b78afab
Include gamerule settings in metadata (#425)
lucko Jul 21, 2024
4c0149b
Fix gamerule read on older Bukkit versions (#428)
lucko Jul 23, 2024
60d54cc
Add some unit tests
lucko Jul 29, 2024
9262175
Update GH actions step versions
lucko Jul 29, 2024
7076811
Check for async command completion before sleeping (#431)
SirYwell Jul 29, 2024
6e7cc88
Cleanup spark tmp dir on startup
lucko Jul 29, 2024
1fb00b1
Add more automated tests
lucko Jul 29, 2024
dcf16e3
Add missing license headers
lucko Jul 29, 2024
ac0ac93
Relocate net.kyori.option package (#432)
lucko Jul 30, 2024
613f702
Add command visibility check for Velocity and BungeeCord (#437)
RealBauHD Aug 6, 2024
8017dbd
Add uploadable health report (#436)
lucko Aug 6, 2024
0eeba9e
Allow mod/plugin author field to be null (#442)
lucko Aug 12, 2024
46704df
Update to Minecraft 1.21.1
lucko Aug 12, 2024
7eff995
Fix entity counts & chunk info with Moonrise on Fabric and NeoForge (…
jpenilla Aug 24, 2024
0cd9b01
Switch from neogradle to moddevgradle (#446)
jpenilla Aug 24, 2024
95fa45d
Update to latest api version; remove more usage of geyser internals
onebeastchris Aug 25, 2024
f5c608e
proper version string
onebeastchris Aug 25, 2024
55b3839
Add methods for spark-paper to check permissions (#444)
lucko Sep 2, 2024
35b557a
Improve unit tests
lucko Sep 2, 2024
684cc5e
Refactor sampler node export process
lucko Sep 3, 2024
ed33fd5
Include engine type in sampler proto
lucko Sep 3, 2024
8986c71
Include datapacks info in sampler proto
lucko Sep 5, 2024
f06de57
Include memory stats in ws updates
lucko Sep 8, 2024
fde4171
Merge remote-tracking branch 'refs/remotes/spark/master' into feature…
onebeastchris Sep 20, 2024
3d9e0f1
List extensions, update code to upstream changes
onebeastchris Sep 20, 2024
be20ed4
build pls
onebeastchris Sep 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -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: |
25 changes: 24 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -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'
@@ -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
}
@@ -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/" }
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
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
@@ -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/.
@@ -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
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -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 ##########################################################################
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/'
@@ -12,7 +13,6 @@ pluginManagement {
name = 'NeoForge'
url = 'https://maven.neoforged.net/releases'
}
gradlePluginPortal()
}
}

@@ -25,6 +25,7 @@ include (
'spark-api',
'spark-common',
'spark-bukkit',
'spark-paper',
'spark-bungeecord',
'spark-velocity',
'spark-velocity4',
4 changes: 2 additions & 2 deletions spark-api/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
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
@@ -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;
@@ -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
@@ -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;

/**
Original file line number Diff line number Diff line change
@@ -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;

/**
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'
@@ -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'
@@ -43,6 +48,8 @@ shadowJar {
exclude 'module-info.class'
exclude 'META-INF/maven/**'
exclude 'META-INF/proguard/**'
exclude '**/*.proto'
exclude '**/*.proto.bin'
}

artifacts {
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;

Original file line number Diff line number Diff line change
@@ -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;
@@ -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();
Original file line number Diff line number Diff line change
@@ -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;

Original file line number Diff line number Diff line change
@@ -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;
Loading