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 ViaProxy platform #4607

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
import net.raphimc.viaproxy.cli.options.Options;
import net.raphimc.viaproxy.ViaProxy;
import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;

import java.io.File;
Expand All @@ -43,7 +43,7 @@ public Path getFloodgateKeyPath() {
@Override
public int getPingPassthroughInterval() {
int interval = super.getPingPassthroughInterval();
if (interval < 15 && Options.PROTOCOL_VERSION != null && Options.PROTOCOL_VERSION.olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
if (interval < 15 && ViaProxy.getConfig().getTargetVersion() != null && ViaProxy.getConfig().getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
// <= 1.6.4 servers sometimes block incoming connections from an IP address if too many connections are made
interval = 15;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import lombok.Getter;
import net.raphimc.viaproxy.ViaProxy;
import net.raphimc.viaproxy.cli.options.Options;
import net.raphimc.viaproxy.plugins.ViaProxyPlugin;
import org.geysermc.geyser.dump.BootstrapDumpInfo;
import org.geysermc.geyser.text.AsteriskSerializer;
Expand All @@ -49,8 +48,8 @@ public class GeyserViaProxyDumpInfo extends BootstrapDumpInfo {

public GeyserViaProxyDumpInfo() {
this.platformVersion = ViaProxy.VERSION;
this.onlineMode = Options.ONLINE_MODE;
if (Options.BIND_ADDRESS instanceof InetSocketAddress inetSocketAddress) {
this.onlineMode = ViaProxy.getConfig().isProxyOnlineMode();
if (ViaProxy.getConfig().getBindAddress() instanceof InetSocketAddress inetSocketAddress) {
this.serverIP = inetSocketAddress.getHostString();
this.serverPort = inetSocketAddress.getPort();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

package org.geysermc.geyser.platform.viaproxy;

import net.raphimc.viaproxy.plugins.PluginManager;
import org.geysermc.geyser.GeyserMain;

public class GeyserViaProxyMain extends GeyserMain {
Expand All @@ -39,7 +38,7 @@ public String getPluginType() {
}

public String getPluginFolder() {
return PluginManager.PLUGINS_DIR.getName();
return "plugins";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import net.lenni0451.lambdaevents.EventHandler;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
import net.raphimc.viaproxy.ViaProxy;
import net.raphimc.viaproxy.cli.options.Options;
import net.raphimc.viaproxy.plugins.PluginManager;
import net.raphimc.viaproxy.plugins.ViaProxyPlugin;
import net.raphimc.viaproxy.plugins.events.ConsoleCommandEvent;
Expand Down Expand Up @@ -137,7 +136,7 @@ public void onGeyserEnable() {

GeyserImpl.start();

if (Options.PROTOCOL_VERSION != null && Options.PROTOCOL_VERSION.newerThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) {
if (ViaProxy.getConfig().getTargetVersion() != null && ViaProxy.getConfig().getTargetVersion().newerThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) {
// Only initialize the ping passthrough if the protocol version is above beta 1.7.3, as that's when the status protocol was added
this.pingPassthrough = GeyserLegacyPingPassthrough.init(this.geyser);
}
Expand Down Expand Up @@ -186,19 +185,19 @@ public BootstrapDumpInfo getDumpInfo() {
@NotNull
@Override
public String getServerBindAddress() {
if (Options.BIND_ADDRESS instanceof InetSocketAddress socketAddress) {
if (ViaProxy.getConfig().getBindAddress() instanceof InetSocketAddress socketAddress) {
return socketAddress.getHostString();
} else {
throw new IllegalStateException("Unsupported bind address type: " + Options.BIND_ADDRESS.getClass().getName());
throw new IllegalStateException("Unsupported bind address type: " + ViaProxy.getConfig().getBindAddress().getClass().getName());
}
}

@Override
public int getServerPort() {
if (Options.BIND_ADDRESS instanceof InetSocketAddress socketAddress) {
if (ViaProxy.getConfig().getBindAddress() instanceof InetSocketAddress socketAddress) {
return socketAddress.getPort();
} else {
throw new IllegalStateException("Unsupported bind address type: " + Options.BIND_ADDRESS.getClass().getName());
throw new IllegalStateException("Unsupported bind address type: " + ViaProxy.getConfig().getBindAddress().getClass().getName());
}
}

Expand Down
2 changes: 1 addition & 1 deletion bootstrap/viaproxy/src/main/resources/viaproxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: "${name}-ViaProxy"
version: "${version}"
author: "${author}"
main: "org.geysermc.geyser.platform.viaproxy.GeyserViaProxyPlugin"
min-version: "3.2.0"
min-version: "3.2.1"
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ adapters = "1.11-SNAPSHOT"
commodore = "2.2"
bungeecord = "a7c6ede"
velocity = "3.1.1"
viaproxy = "3.2.0-SNAPSHOT"
viaproxy = "3.2.1"
fabric-minecraft = "1.20.4"
fabric-loader = "0.15.2"
fabric-api = "0.91.2+1.20.4"
Expand Down