Skip to content
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

dependencies {
implementation("net.raphimc:ViaProxy:3.4.12") {
implementation("net.raphimc:ViaProxy:3.5.0-SNAPSHOT") {
transitive = false
}
}
6 changes: 3 additions & 3 deletions src/main/java/net/raphimc/authhook/AuthHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public void onEnable() {

@EventHandler
private void onViaProxyLoaded(final ViaProxyLoadedEvent event) {
if (!ViaProxy.getConfig().isProxyOnlineMode()) {
if (!ViaProxy.getConfig().getFrontend().isOnlineMode()) {
Logger.LOGGER.warn("Proxy online mode is disabled, please enable it to use the AuthHook plugin!");
Logger.LOGGER.warn("Without online mode the AuthHook plugin would be effectively useless and allow anyone to connect to your server without authentication.");
Logger.LOGGER.info("Force enabling online mode");
ViaProxy.getConfig().setProxyOnlineMode(true);
ViaProxy.getConfig().getFrontend().setOnlineMode(true);
}

final Map<String, Properties> locales = RStream.of(I18n.class).fields().by("LOCALES").get();
Expand All @@ -67,7 +67,7 @@ private void onViaProxyLoaded(final ViaProxyLoadedEvent event) {

@EventHandler
private void onJoinServerRequest(final JoinServerRequestEvent event) {
if (ViaProxy.getConfig().getAuthMethod() == AUTH_HOOK) {
if (ViaProxy.getConfig().getBackend().getAuthMethod() == AUTH_HOOK) {
this.httpServer.addPendingConnection(event.getServerIdHash(), event.getProxyConnection());
event.setCancelled(true);
}
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/net/raphimc/authhook/config/AuthHookConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
*/
package net.raphimc.authhook.config;

import java.io.File;
import java.net.SocketAddress;
import java.util.UUID;

import net.lenni0451.optconfig.ConfigLoader;
import net.lenni0451.optconfig.annotations.Description;
import net.lenni0451.optconfig.annotations.NotReloadable;
Expand All @@ -25,12 +29,9 @@
import net.lenni0451.optconfig.annotations.TypeSerializer;
import net.lenni0451.optconfig.provider.ConfigProvider;
import net.raphimc.viaproxy.util.AddressUtil;
import net.raphimc.viaproxy.util.config.SocketAddressTypeSerializer;
import net.raphimc.viaproxy.util.logging.Logger;

import java.io.File;
import java.net.SocketAddress;
import java.util.UUID;

@OptConfig
@SuppressWarnings("checkstyle:VisibilityModifier")
public final class AuthHookConfig {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public HttpServer(final InetSocketAddress bindAddress) {
}

public void addPendingConnection(final String serverIdHash, final ProxyConnection connection) {
this.pendingConnections.put(serverIdHash + "_" + connection.getGameProfile().getName(), connection);
this.pendingConnections.put(serverIdHash + "_" + connection.getGameProfile().name(), connection);
}

public void stop() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public Either<URI, FullHttpResponse> handleRequest(final String host, final Http
if (proxyConnection != null) {
final GameProfile gameProfile = proxyConnection.getGameProfile();
final JsonObject responseObj = new JsonObject();
responseObj.addProperty("name", gameProfile.getName());
responseObj.addProperty("id", gameProfile.getId().toString().replace("-", ""));
if (!gameProfile.getProperties().isEmpty()) {
responseObj.addProperty("name", gameProfile.name());
responseObj.addProperty("id", gameProfile.id().toString().replace("-", ""));
if (!gameProfile.properties().isEmpty()) {
final JsonArray propertiesArray = new JsonArray();
gameProfile.getProperties().forEach((key, value) -> {
gameProfile.properties().forEach((key, value) -> {
final JsonObject propertyObj = new JsonObject();
propertyObj.addProperty("name", key);
propertyObj.addProperty("value", value.value());
Expand Down