Update Sponge module to API v8

This commit is contained in:
Nassim Jahnke 2022-01-09 18:58:44 +01:00
parent 0d5661f8a6
commit 54eaccca0d
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
9 changed files with 70 additions and 29 deletions

View File

@ -6,7 +6,7 @@ plugins {
tasks {
// Variable replacements
processResources {
filesMatching(listOf("plugin.yml", "mcmod.info", "fabric.mod.json", "bungee.yml")) {
filesMatching(listOf("plugin.yml", "META-INF/sponge_plugins.json", "fabric.mod.json", "bungee.yml")) {
expand("version" to project.version, "description" to project.description, "url" to "https://github.com/ViaVersion/ViaBackwards")
}
}

View File

@ -5,7 +5,7 @@ plugins {
allprojects {
group = "com.viaversion"
version = "4.1.2-SNAPSHOT"
version = "4.2.0-SNAPSHOT"
description = "Allow older clients to join newer server versions."
}

View File

@ -56,7 +56,7 @@ import java.util.logging.Logger;
public interface ViaBackwardsPlatform {
String MINIMUM_VV_VERSION = "4.1.1";
String MINIMUM_VV_VERSION = "4.2.0";
String IMPL_VERSION = "$IMPL_VERSION";
/**

View File

@ -3,7 +3,7 @@ metadata.format.version = "1.1"
[versions]
# ViaVersion
viaver = "4.1.0"
viaver = "4.2.0-SNAPSHOT"
# Common provided
netty = "4.0.20.Final"
@ -15,8 +15,8 @@ checkerQual = "3.18.0"
# Platforms
paper = "1.16.5-R0.1-SNAPSHOT"
bungee = "1.16-R0.5-SNAPSHOT"
sponge = "5.0.0"
velocity = "3.0.0-SNAPSHOT"
sponge = "8.0.0"
velocity = "3.1.0-SNAPSHOT"
fabricLoader = "0.11.6"

View File

@ -8,7 +8,6 @@ dependencyResolutionManagement {
maven("https://repo.viaversion.com")
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://nexus.velocitypowered.com/repository/velocity-artifacts-snapshots/")
maven("https://repo.spongepowered.org/maven")
mavenCentral()
}

View File

@ -1,5 +1,4 @@
dependencies {
implementation(projects.viabackwardsCommon)
compileOnly(libs.sponge)
annotationProcessor(libs.sponge)
}

View File

@ -20,46 +20,39 @@ package com.viaversion.viabackwards;
import com.google.inject.Inject;
import com.viaversion.viabackwards.api.ViaBackwardsPlatform;
import com.viaversion.viabackwards.utils.VersionInfo;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.sponge.util.LoggerWrapper;
import org.spongepowered.api.config.ConfigDir;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order;
import org.spongepowered.api.event.game.state.GameInitializationEvent;
import org.spongepowered.api.plugin.Dependency;
import org.spongepowered.api.plugin.Plugin;
import org.spongepowered.api.event.lifecycle.ConstructPluginEvent;
import org.spongepowered.plugin.builtin.jvm.Plugin;
import java.io.File;
import java.nio.file.Path;
import java.util.logging.Logger;
@Plugin(id = "viabackwards",
name = "ViaBackwards",
version = VersionInfo.VERSION,
authors = {"Matsv", "kennytv", "Gerrygames", "creeper123123321", "ForceUpdate1"},
description = "Allow older Minecraft versions to connect to a newer server version.",
dependencies = {@Dependency(id = "viaversion")}
)
@Plugin("viabackwards")
public class SpongePlugin implements ViaBackwardsPlatform {
private Logger logger;
@Inject
private org.slf4j.Logger loggerSlf4j;
@SuppressWarnings("SpongeLogging")
private final Logger logger;
@Inject
@ConfigDir(sharedRoot = false)
private Path configPath;
@Listener(order = Order.LATE)
public void onGameStart(GameInitializationEvent e) {
// Setup Logger
this.logger = new LoggerWrapper(loggerSlf4j);
@SuppressWarnings("SpongeInjection")
@Inject
SpongePlugin(final org.apache.logging.log4j.Logger logger) {
this.logger = new LoggerWrapper(logger);
}
@Listener
public void constructPlugin(ConstructPluginEvent event) {
// Init!
Via.getManager().addEnableListener(() -> this.init(configPath.resolve("config.yml").toFile()));
}
@Override
public void disable() {
// Not possible
}
@Override

View File

@ -0,0 +1,50 @@
{
"loader": {
"name": "java_plain",
"version": "1.0"
},
"license": "GNU GPLv3",
"global": {
"version": "${version}",
"links": {
"source": "https://github.com/ViaVersion/ViaBackwards",
"issues": "https://github.com/ViaVersion/ViaBackwards/issues"
},
"contributors": [
{
"name": "Matsv",
"description": "Maintainer"
},
{
"name": "kennytv",
"description": "Maintainer"
},
{
"name": "Gerrygames",
"description": "Contributor"
},
{
"name": "creeper123123321",
"description": "Contributor"
}
],
"dependencies": [
{
"id": "spongeapi",
"version": "8.0.0"
},
{
"id": "viaversion",
"version": "[4.2.0,)"
}
]
},
"plugins": [
{
"id": "viabackwards",
"name": "ViaBackwards",
"entrypoint": "com.viaversion.viabackwards.SpongePlugin",
"description": "${description}"
}
]
}

View File

@ -28,7 +28,7 @@ import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.viaversion.viabackwards.api.ViaBackwardsPlatform;
import com.viaversion.viabackwards.utils.VersionInfo;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.sponge.util.LoggerWrapper;
import com.viaversion.viaversion.velocity.util.LoggerWrapper;
import java.io.File;
import java.nio.file.Path;