Updated Via*

This commit is contained in:
RaphiMC 2023-02-20 15:34:13 +01:00
parent 20bb796f9f
commit 206ba98565
4 changed files with 12 additions and 48 deletions

View File

@ -66,7 +66,7 @@ Then you have to create a new instance of your loader class and pass it to the `
To do this you can call the ``ViaProtocolHack.init()`` method somewhere suitable in your project (You can do that async) with your desired argument values:
```java
ViaProtocolHack.init(null/*ViaPlatform*/, new CustomVPLoaderImpl(), null/*ViaInjector*/, null/*ViaCommandHandler*/, ViaBackwardsPlatformImpl::new, null/*Supplier<ViaRewindPlatform>*/, ViaLegacyPlatformImpl::new);
ViaProtocolHack.init(null/*ViaPlatform*/, new CustomVPLoaderImpl(), null/*ViaInjector*/, null/*ViaCommandHandler*/, ViaBackwardsPlatformImpl::new, ViaLegacyPlatformImpl::new);
```
After you have initialized the Via* platforms you can start implementing ViaProtocolHack into your project.
@ -90,4 +90,4 @@ Now you should have a working protocol translator implementation in your project
If you encounter any issues, please report them on the
[issue tracker](https://github.com/RaphiMC/ViaProtocolHack/issues).
If you just want to talk or need help implementing ViaProtocolHack feel free to join my
[Discord](https://discord.gg/dCzT9XHEWu).
[Discord](https://discord.gg/dCzT9XHEWu).

View File

@ -24,12 +24,12 @@ repositories {
}
dependencies {
compileOnly "com.viaversion:viaversion:4.6.0-23w06a-SNAPSHOT"
compileOnly("com.viaversion:viabackwards-common:4.6.0-23w06a-SNAPSHOT") {
compileOnly "com.viaversion:viaversion:4.6.0-23w07a-SNAPSHOT"
compileOnly("com.viaversion:viabackwards-common:4.6.0-23w07a-SNAPSHOT") {
exclude group: "com.viaversion", module: "viaversion"
}
compileOnly "com.viaversion:viarewind-core:2.0.3-SNAPSHOT"
compileOnly "net.raphimc:ViaLegacy:2.1.0"
compileOnly "net.raphimc:ViaLegacy:2.2.6"
api "org.slf4j:slf4j-api:2.0.6"
api "org.yaml:snakeyaml:1.33"

View File

@ -17,7 +17,6 @@
*/
package net.raphimc.viaprotocolhack;
import com.viaversion.viabackwards.api.ViaBackwardsPlatform;
import com.viaversion.viaversion.ViaManagerImpl;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.MappingDataLoader;
@ -26,8 +25,6 @@ import com.viaversion.viaversion.api.platform.ViaPlatform;
import com.viaversion.viaversion.api.platform.ViaPlatformLoader;
import com.viaversion.viaversion.commands.ViaCommandHandler;
import com.viaversion.viaversion.protocol.ProtocolManagerImpl;
import de.gerrygames.viarewind.api.ViaRewindPlatform;
import net.raphimc.vialegacy.platform.ViaLegacyPlatform;
import net.raphimc.viaprotocolhack.impl.platform.ViaVersionPlatformImpl;
import net.raphimc.viaprotocolhack.impl.viaversion.VPCommandHandler;
import net.raphimc.viaprotocolhack.impl.viaversion.VPInjector;
@ -46,7 +43,7 @@ public class ViaProtocolHack {
private static final Logger LOGGER = new JLoggerToSLF4J(LoggerFactory.getLogger("ViaProtocolHack"));
@SuppressWarnings("ReassignedVariable")
public static void init(ViaPlatform<?> platform, ViaPlatformLoader loader, ViaInjector injector, ViaCommandHandler commandHandler, Supplier<ViaBackwardsPlatform> viaBackwardsPlatformSupplier, Supplier<ViaRewindPlatform> viaRewindPlatformSupplier, Supplier<ViaLegacyPlatform> viaLegacyPlatformSupplier, final Supplier<?>... additionalPlatformSuppliers) {
public static void init(ViaPlatform<?> platform, ViaPlatformLoader loader, ViaInjector injector, ViaCommandHandler commandHandler, final Supplier<?>... platformSuppliers) {
if (platform == null) platform = new ViaVersionPlatformImpl(null);
if (loader == null) loader = new VPLoader();
if (injector == null) injector = new VPInjector();
@ -61,39 +58,12 @@ public class ViaProtocolHack {
MappingDataLoader.enableMappingsCache();
Via.getManager().addEnableListener(() -> {
if (viaBackwardsPlatformSupplier != null) {
try {
viaBackwardsPlatformSupplier.get();
} catch (Throwable e) {
LOGGER.log(Level.SEVERE, "ViaBackwards failed to load", e);
}
} else {
LOGGER.info("ViaBackwards is not loaded.");
}
if (viaRewindPlatformSupplier != null) {
try {
viaRewindPlatformSupplier.get();
} catch (Throwable e) {
LOGGER.log(Level.SEVERE, "ViaRewind failed to load", e);
}
} else {
LOGGER.info("ViaRewind is not loaded.");
}
if (viaLegacyPlatformSupplier != null) {
try {
viaLegacyPlatformSupplier.get();
} catch (Throwable e) {
LOGGER.log(Level.SEVERE, "ViaLegacy failed to load", e);
}
} else {
LOGGER.info("ViaLegacy is not loaded.");
}
if (additionalPlatformSuppliers != null) {
for (Supplier<?> additionalPlatformSupplier : additionalPlatformSuppliers) {
if (platformSuppliers != null) {
for (Supplier<?> additionalPlatformSupplier : platformSuppliers) {
try {
additionalPlatformSupplier.get();
} catch (Throwable e) {
LOGGER.log(Level.SEVERE, "Additional platform failed to load", e);
LOGGER.log(Level.SEVERE, "Platform failed to load", e);
}
}
}

View File

@ -31,10 +31,9 @@ public class VPViaConfig extends AbstractViaConfig {
protected final List<String> UNSUPPORTED = Lists.newArrayList(
"checkforupdates", "bungee-ping-interval", "bungee-ping-save", "bungee-servers",
"velocity-ping-interval", "velocity-ping-save", "velocity-servers",
"block-protocols", "block-disconnect-msg", "reload-disconnect-msg",
"max-pps", "max-pps-kick-msg", "tracking-period", "tracking-warning-pps", "tracking-max-warnings", "tracking-max-kick-msg",
"blockconnection-method", "anti-xray-patch", "quick-move-action-fix", "item-cache",
"change-1_9-hitbox", "change-1_14-hitbox",
"block-protocols", "block-disconnect-msg", "reload-disconnect-msg", "max-pps",
"max-pps-kick-msg", "tracking-period", "tracking-warning-pps", "tracking-max-warnings", "tracking-max-kick-msg",
"blockconnection-method", "quick-move-action-fix", "item-cache", "change-1_9-hitbox", "change-1_14-hitbox",
"use-new-deathmessages", "nms-player-ticking"
);
@ -61,11 +60,6 @@ public class VPViaConfig extends AbstractViaConfig {
return "packet";
}
@Override
public boolean isAntiXRay() {
return false;
}
@Override
public boolean is1_12QuickMoveActionFix() {
return false;