Skip to content

Commit

Permalink
Merge branch 'nightly' into mc/1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
0utplay committed Sep 3, 2024
2 parents e7257db + 1ef60be commit 272748d
Show file tree
Hide file tree
Showing 33 changed files with 300 additions and 199 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ jobs:
check-latest: true
distribution: 'zulu'

- name: Setup gradle cache
uses: gradle/actions/setup-gradle@v3
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: true
add-job-summary: always

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
tools: latest
tools: linked
languages: 'java'

- name: Autobuild
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/gradle-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,18 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Validate gradle wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Setup java
uses: actions/setup-java@v4
with:
java-version: 22
check-latest: true
distribution: 'zulu'

- name: Setup gradle cache
uses: gradle/actions/setup-gradle@v3
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: true
add-job-summary: always

- name: Publish release to Sonatype
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,18 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Validate gradle wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Setup java
uses: actions/setup-java@v4
with:
java-version: 22
check-latest: true
distribution: 'zulu'

- name: Setup gradle cache
uses: gradle/actions/setup-gradle@v3
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
add-job-summary: always
cache-cleanup: on-success
cache-read-only: ${{ github.ref != 'refs/heads/nightly' }}

- name: Setup Loom cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prbranch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
check-branch:
runs-on: ubuntu-latest
steps:
- uses: Vankka/pr-target-branch-action@v2.1
- uses: Vankka/pr-target-branch-action@v3
with:
target: release
exclude: nightly
exclude: beta
2 changes: 1 addition & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="(module\-info\.java$)|(.*[\\|\/]fabric[\\|\/].*$)"/>
<property name="fileNamePattern" value="(module\-info\.java$)|(.*[\\|\/]fabric[\\|\/].*|(JVM|Dockerized)Service\.java$)"/>
</module>
<module name="SuppressionFilter">
<property default="checkstyle-suppressions.xml" name="file"
Expand Down
9 changes: 7 additions & 2 deletions driver/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="STDOUT" />
<root level="DEBUG">
<appender-ref ref="STDOUT"/>
</root>

<logger name="tc" level="INFO"/>
<logger name="org.testcontainers" level="INFO"/>
<logger name="com.github.dockerjava" level="WARN"/>
<logger name="com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire" level="OFF"/>
</configuration>
24 changes: 12 additions & 12 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ juppiter = "0.4.0"
spotless = "6.25.0"
fabricLoom = "1.7.3"
nexusPublish = "2.0.0"
checkstyleTools = "10.17.0"
checkstyleTools = "10.18.1"

# google libs
gson = "2.11.0"
guava = "33.2.1-jre"
guava = "33.3.0-jre"

# testing
junit = "5.10.3"
mockito = "5.12.0"
junitLauncher = "1.10.3"
junit = "5.11.0"
mockito = "5.13.0"
junitLauncher = "1.11.0"
testcontainers = "1.20.1"

# compile time processing
Expand All @@ -35,25 +35,25 @@ hikariCp = "5.1.0"
mysqlConnector = "9.0.0"

# general
oshi = "6.6.2"
oshi = "6.6.3"
vavr = "0.10.4"
sshj = "0.38.0"
aerogel = "2.1.0"
awsSdk = "2.27.1"
awsSdk = "2.27.9"
unirest = "4.4.4"
caffeine = "3.1.8"
reflexion = "1.8.0"
geantyref = "1.3.15"
dockerJava = "3.4.0"
nightConfig = "3.8.1"
annotations = "24.1.0"
influxClient = "7.1.0"
influxClient = "7.2.0"
netty = "5.0.0.Alpha5"
gulf = "1.0.0-SNAPSHOT"

# logging
slf4j = "2.0.15"
logback = "1.5.6"
slf4j = "2.0.16"
logback = "1.5.7"

# platform api versions
sponge = "9.0.0"
Expand All @@ -70,14 +70,14 @@ limboloohp = "0.7.9-ALPHA"
vault = "1.7.1"
adventure = "4.17.0"
modlauncher = "8.1.3"
npcLib = "3.0.0-beta7"
npcLib = "3.0.0-beta8"
placeholderApi = "2.11.6"
adventure-serializer-bungee = "4.3.4"
luckPermsApi = "5.4"

# fabric platform special dependencies
minecraft = "1.21.1"
fabricLoader = "0.16.0"
fabricLoader = "0.16.2"


[libraries]
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionSha256Sum=5b9c5eb3f9fc2c94abaea57d90bd78747ca117ddbbf96c859d3741181a12bf2a
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion modules/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ subprojects {
"annotationProcessor"(rootProject.projects.ext.platformInjectSupport.platformInjectProcessor)

// internal dependencies
"implementation"(rootProject.libs.guava)
"compileOnly"(rootProject.libs.guava)
}

tasks.create<Sync>("processSources") {
Expand Down
9 changes: 7 additions & 2 deletions modules/database-mongodb/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="STDOUT" />
<root level="DEBUG">
<appender-ref ref="STDOUT"/>
</root>

<logger name="tc" level="INFO"/>
<logger name="org.testcontainers" level="INFO"/>
<logger name="com.github.dockerjava" level="WARN"/>
<logger name="com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire" level="OFF"/>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class MySQLDatabaseTest {
.withEnv("MYSQL_USER", "test")
.withEnv("MYSQL_PASSWORD", "test")
.withEnv("MYSQL_ROOT_PASSWORD", "test")
.withEnv("MYSQL_DATABASE", "cn_testing");
.withEnv("MYSQL_DATABASE", "cn_testing")
.withCommand("mariadbd", "--ssl=0");

private MySQLDatabaseProvider databaseProvider;

Expand Down
9 changes: 7 additions & 2 deletions modules/database-mysql/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="STDOUT" />
<root level="DEBUG">
<appender-ref ref="STDOUT"/>
</root>

<logger name="tc" level="INFO"/>
<logger name="org.testcontainers" level="INFO"/>
<logger name="com.github.dockerjava" level="WARN"/>
<logger name="com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire" level="OFF"/>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public class DockerizedService extends JVMService {

protected final DockerClient dockerClient;
protected final DockerConfiguration configuration;
protected final DockerizedServiceLogCache logCache;

protected volatile String containerId;

Expand All @@ -104,13 +103,19 @@ protected DockerizedService(
@NonNull DockerClient dockerClient,
@NonNull DockerConfiguration dockerConfiguration
) {
super(tickLoop, nodeConfig, configuration, manager, eventManager, versionProvider, serviceConfigurationPreparer);
var logCache = new DockerizedServiceLogCache(nodeConfig, configuration.serviceId());
super(
tickLoop,
nodeConfig,
configuration,
manager,
eventManager,
logCache,
versionProvider,
serviceConfigurationPreparer);

this.dockerClient = dockerClient;
this.configuration = dockerConfiguration;

super.logCache = this.logCache = new DockerizedServiceLogCache(nodeConfig, this);
this.initLogHandler();
}

@Override
Expand Down Expand Up @@ -356,8 +361,8 @@ protected boolean needsImagePull(@NonNull DockerImage image) {
public final class ServiceLogCacheAdapter extends ResultCallback.Adapter<Frame> {

@Override
public void onNext(Frame object) {
DockerizedService.this.logCache.handle(object);
public void onNext(@NonNull Frame object) {
((DockerizedServiceLogCache) DockerizedService.this.logCache).handle(object);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,16 @@
package eu.cloudnetservice.modules.docker;

import com.github.dockerjava.api.model.Frame;
import eu.cloudnetservice.driver.service.ServiceId;
import eu.cloudnetservice.node.config.Configuration;
import eu.cloudnetservice.node.service.CloudService;
import eu.cloudnetservice.node.service.ServiceConsoleLogCache;
import eu.cloudnetservice.node.service.defaults.log.AbstractServiceLogCache;
import java.nio.charset.StandardCharsets;
import lombok.NonNull;

public class DockerizedServiceLogCache extends AbstractServiceLogCache {

public DockerizedServiceLogCache(@NonNull Configuration configuration, @NonNull CloudService service) {
super(configuration, service);
}

@Override
public @NonNull ServiceConsoleLogCache update() {
return this;
public DockerizedServiceLogCache(@NonNull Configuration configuration, @NonNull ServiceId associatedServiceId) {
super(configuration, associatedServiceId);
}

public void handle(@NonNull Frame frame) {
Expand All @@ -49,9 +43,7 @@ protected void handleItem(@NonNull String content, boolean comesFromErrorStream)
if (content.contains("\n") || content.contains("\r")) {
for (var input : content.split("\r")) {
for (var text : input.split("\n")) {
if (!text.trim().isEmpty()) {
super.handleItem(text, comesFromErrorStream);
}
super.handleItem(text, comesFromErrorStream);
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions modules/npcs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import eu.cloudnetservice.gradle.juppiter.ModuleConfiguration

plugins {
Expand All @@ -28,6 +29,23 @@ tasks.withType<Jar> {
}
}

tasks.withType<ShadowJar> {
relocate("net.kyori", "eu.cloudnetservice.modules.npc.relocate.net.kyori")
relocate("io.papermc.lib", "eu.cloudnetservice.modules.npc.relocate.paperlib")
relocate("io.leangen.geantyref", "eu.cloudnetservice.modules.npc.relocate.geantyref")
relocate("io.github.retrooper", "eu.cloudnetservice.modules.npc.relocate.io.packetevents")
relocate("com.github.retrooper", "eu.cloudnetservice.modules.npc.relocate.com.packetevents")
relocate("com.github.juliarn.npclib", "eu.cloudnetservice.modules.npc.relocate.com.github.juliarn.npclib")

archiveClassifier.set(null as String?)
dependencies {
exclude("plugin.yml")
// excludes the META-INF directory, module infos & html files of all dependencies
// this includes for example maven lib files & multi-release module-json files
exclude("META-INF/**", "**/*.html", "module-info.*")
}
}

repositories {
maven("https://repo.codemc.io/repository/maven-releases/") {
mavenContent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

import com.github.juliarn.npclib.api.NpcActionController;
import com.github.juliarn.npclib.api.Platform;
import com.github.juliarn.npclib.api.protocol.PlatformPacketAdapter;
import com.github.juliarn.npclib.bukkit.BukkitPlatform;
import com.github.juliarn.npclib.bukkit.BukkitWorldAccessor;
import com.github.juliarn.npclib.bukkit.protocol.BukkitProtocolAdapter;
import com.github.juliarn.npclib.ext.labymod.LabyModExtension;
import com.google.common.base.Preconditions;
import eu.cloudnetservice.driver.ComponentInfo;
Expand Down Expand Up @@ -97,11 +99,13 @@ public BukkitPlatformNPCManagement(
.flag(NpcActionController.IMITATE_DISTANCE, entry.npcPoolOptions().actionDistance())
.flag(NpcActionController.TAB_REMOVAL_TICKS, entry.npcPoolOptions().tabListRemoveTicks()))
.worldAccessor(BukkitWorldAccessor.nameBasedAccessor())
.packetFactory(this.resolvePacketAdapter())
.build();
} else {
this.npcPlatform = BukkitPlatform.bukkitNpcPlatformBuilder()
.extension(plugin)
.worldAccessor(BukkitWorldAccessor.nameBasedAccessor())
.packetFactory(this.resolvePacketAdapter())
.build();
}

Expand Down Expand Up @@ -273,4 +277,19 @@ protected void startEmoteTask(boolean force) {
}
}
}

protected @NonNull PlatformPacketAdapter<World, Player, ItemStack, Plugin> resolvePacketAdapter() {
var protocolLibAdapter = BukkitProtocolAdapter.protocolLib();
try {
//noinspection DataFlowIssue
protocolLibAdapter.createCustomPayloadPacket("minecraft:test", new byte[0]).schedule((Player) null, null);
return protocolLibAdapter;
} catch (NullPointerException _) {
// the above test code will always throw an NPE if the test passes. We need to handle this as success.
return protocolLibAdapter;
} catch (Throwable _) {
// protocollib is not working, fallback to packet events
return BukkitProtocolAdapter.packetEvents();
}
}
}
Loading

0 comments on commit 272748d

Please sign in to comment.