mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-19 14:59:20 +00:00
Make a difference between a decrypt error and an exception
This commit is contained in:
@@ -128,6 +128,10 @@ public class BungeeProxyDataHandler extends ChannelInboundHandlerAdapter {
|
|||||||
|
|
||||||
switch (result.getResultType()) {
|
switch (result.getResultType()) {
|
||||||
case EXCEPTION:
|
case EXCEPTION:
|
||||||
|
ctx.channel().attr(kickMessageAttribute)
|
||||||
|
.set(Constants.INTERNAL_ERROR_MESSAGE);
|
||||||
|
break;
|
||||||
|
case DECRYPT_ERROR:
|
||||||
ctx.channel().attr(kickMessageAttribute)
|
ctx.channel().attr(kickMessageAttribute)
|
||||||
.set(config.getDisconnect().getInvalidKey());
|
.set(config.getDisconnect().getInvalidKey());
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public final class FloodgateHandshakeHandler {
|
|||||||
formatException.printStackTrace();
|
formatException.printStackTrace();
|
||||||
|
|
||||||
throw callHandlerAndReturnResult(
|
throw callHandlerAndReturnResult(
|
||||||
ResultType.EXCEPTION,
|
ResultType.DECRYPT_ERROR,
|
||||||
channel, null, hostname
|
channel, null, hostname
|
||||||
);
|
);
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
@@ -203,6 +203,8 @@ public final class FloodgateHandshakeHandler {
|
|||||||
return (HandshakeResult) error;
|
return (HandshakeResult) error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error.printStackTrace();
|
||||||
|
|
||||||
return callHandlerAndReturnResult(
|
return callHandlerAndReturnResult(
|
||||||
ResultType.EXCEPTION,
|
ResultType.EXCEPTION,
|
||||||
channel, null, hostname
|
channel, null, hostname
|
||||||
@@ -298,6 +300,7 @@ public final class FloodgateHandshakeHandler {
|
|||||||
public enum ResultType {
|
public enum ResultType {
|
||||||
EXCEPTION,
|
EXCEPTION,
|
||||||
NOT_FLOODGATE_DATA,
|
NOT_FLOODGATE_DATA,
|
||||||
|
DECRYPT_ERROR,
|
||||||
INVALID_DATA_LENGTH,
|
INVALID_DATA_LENGTH,
|
||||||
TIMESTAMP_DENIED,
|
TIMESTAMP_DENIED,
|
||||||
SUCCESS
|
SUCCESS
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ public final class Constants {
|
|||||||
public static final String TIMESTAMP_DENIED_MESSAGE =
|
public static final String TIMESTAMP_DENIED_MESSAGE =
|
||||||
"Something isn't right with this data." +
|
"Something isn't right with this data." +
|
||||||
" Try logging in again or contact a server administrator if the issue persists.";
|
" Try logging in again or contact a server administrator if the issue persists.";
|
||||||
|
public static final String INTERNAL_ERROR_MESSAGE =
|
||||||
|
"An internal error happened while handling Floodgate data." +
|
||||||
|
" Try logging in again or contact a server administrator if the issue persists.";
|
||||||
|
|
||||||
|
|
||||||
public static final int HANDSHAKE_PACKET_ID = 0;
|
public static final int HANDSHAKE_PACKET_ID = 0;
|
||||||
|
|||||||
@@ -94,6 +94,10 @@ public final class SpigotDataHandler extends ChannelInboundHandlerAdapter {
|
|||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
break;
|
break;
|
||||||
case EXCEPTION:
|
case EXCEPTION:
|
||||||
|
logger.info(Constants.INTERNAL_ERROR_MESSAGE);
|
||||||
|
ctx.close();
|
||||||
|
return true;
|
||||||
|
case DECRYPT_ERROR:
|
||||||
logger.info(config.getDisconnect().getInvalidKey());
|
logger.info(config.getDisconnect().getInvalidKey());
|
||||||
ctx.close();
|
ctx.close();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -128,6 +128,10 @@ public final class VelocityProxyDataHandler extends ChannelInboundHandlerAdapter
|
|||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
break;
|
break;
|
||||||
case EXCEPTION:
|
case EXCEPTION:
|
||||||
|
ctx.channel().attr(kickMessageAttribute)
|
||||||
|
.set(Constants.INTERNAL_ERROR_MESSAGE);
|
||||||
|
return;
|
||||||
|
case DECRYPT_ERROR:
|
||||||
ctx.channel().attr(kickMessageAttribute)
|
ctx.channel().attr(kickMessageAttribute)
|
||||||
.set(config.getDisconnect().getInvalidKey());
|
.set(config.getDisconnect().getInvalidKey());
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user