1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-19 14:59:20 +00:00

Added an option to require linked accounts

This commit is contained in:
Tim203
2021-04-03 21:10:17 +02:00
parent 30ca8e6e25
commit 98df9179ae
4 changed files with 17 additions and 2 deletions

View File

@@ -67,6 +67,7 @@ public class FloodgateConfig {
@Getter
public static class PlayerLinkConfig {
private boolean enabled;
private boolean requireLink;
private boolean enableOwnLinking = false;
private boolean allowed;
private long linkCodeTimeout;

View File

@@ -143,6 +143,11 @@ public final class FloodgateHandshakeHandler {
HandshakeData handshakeData = new HandshakeDataImpl(
channel, true, bedrockData.clone(), configHolder.get(),
linkedPlayer != null ? linkedPlayer.clone() : null, hostname);
if (configHolder.get().getPlayerLink().isRequireLink() && linkedPlayer == null) {
handshakeData.setDisconnectReason("floodgate.core.not_linked");
}
handshakeHandlers.callHandshakeHandlers(handshakeData);
if (!handshakeData.shouldDisconnect()) {

View File

@@ -32,6 +32,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import java.net.ConnectException;
import java.net.URI;
import javax.net.ssl.SSLException;
import lombok.Getter;
import org.geysermc.floodgate.api.FloodgateApi;
import org.geysermc.floodgate.api.logger.FloodgateLogger;
@@ -138,8 +139,13 @@ final class SkinUploadSocket extends WebSocketClient {
@Override
public void onError(Exception exception) {
// skip can't connect exceptions and the syntax error in onClose because of that.
if (exception instanceof ConnectException || exception instanceof JsonSyntaxException) {
// skip can't connect exceptions and the syntax error in onClose that happens because of it.
// they might however help during debugging so we'll log them when debug is enabled
if (exception instanceof ConnectException || exception instanceof JsonSyntaxException ||
exception instanceof SSLException) {
if (logger.isDebug()) {
logger.error("[debug] Got an error", exception);
}
return;
}
logger.error("Got an error", exception);

View File

@@ -28,6 +28,9 @@ player-link:
# players from using the linking feature even if they are already linked.
enabled: true
# Whether to require a linked account in order to be able to join the server.
require-link: false
# Uncomment the following line when you want to host your own linking database.
# -> This can work in addition to global linking.
# Note that you have to install a linking database implementation before enabling this, because