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:
@@ -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;
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user