mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-20 15:29:20 +00:00
Added an option to require linked accounts
This commit is contained in:
@@ -67,6 +67,7 @@ public class FloodgateConfig {
|
|||||||
@Getter
|
@Getter
|
||||||
public static class PlayerLinkConfig {
|
public static class PlayerLinkConfig {
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
private boolean requireLink;
|
||||||
private boolean enableOwnLinking = false;
|
private boolean enableOwnLinking = false;
|
||||||
private boolean allowed;
|
private boolean allowed;
|
||||||
private long linkCodeTimeout;
|
private long linkCodeTimeout;
|
||||||
|
|||||||
@@ -143,6 +143,11 @@ public final class FloodgateHandshakeHandler {
|
|||||||
HandshakeData handshakeData = new HandshakeDataImpl(
|
HandshakeData handshakeData = new HandshakeDataImpl(
|
||||||
channel, true, bedrockData.clone(), configHolder.get(),
|
channel, true, bedrockData.clone(), configHolder.get(),
|
||||||
linkedPlayer != null ? linkedPlayer.clone() : null, hostname);
|
linkedPlayer != null ? linkedPlayer.clone() : null, hostname);
|
||||||
|
|
||||||
|
if (configHolder.get().getPlayerLink().isRequireLink() && linkedPlayer == null) {
|
||||||
|
handshakeData.setDisconnectReason("floodgate.core.not_linked");
|
||||||
|
}
|
||||||
|
|
||||||
handshakeHandlers.callHandshakeHandlers(handshakeData);
|
handshakeHandlers.callHandshakeHandlers(handshakeData);
|
||||||
|
|
||||||
if (!handshakeData.shouldDisconnect()) {
|
if (!handshakeData.shouldDisconnect()) {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import com.google.gson.JsonObject;
|
|||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import javax.net.ssl.SSLException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.geysermc.floodgate.api.FloodgateApi;
|
import org.geysermc.floodgate.api.FloodgateApi;
|
||||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||||
@@ -138,8 +139,13 @@ final class SkinUploadSocket extends WebSocketClient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception exception) {
|
public void onError(Exception exception) {
|
||||||
// skip can't connect exceptions and the syntax error in onClose because of that.
|
// skip can't connect exceptions and the syntax error in onClose that happens because of it.
|
||||||
if (exception instanceof ConnectException || exception instanceof JsonSyntaxException) {
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
logger.error("Got an error", exception);
|
logger.error("Got an error", exception);
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ player-link:
|
|||||||
# players from using the linking feature even if they are already linked.
|
# players from using the linking feature even if they are already linked.
|
||||||
enabled: true
|
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.
|
# Uncomment the following line when you want to host your own linking database.
|
||||||
# -> This can work in addition to global linking.
|
# -> This can work in addition to global linking.
|
||||||
# Note that you have to install a linking database implementation before enabling this, because
|
# Note that you have to install a linking database implementation before enabling this, because
|
||||||
|
|||||||
Reference in New Issue
Block a user