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()) {
|
||||
case EXCEPTION:
|
||||
ctx.channel().attr(kickMessageAttribute)
|
||||
.set(Constants.INTERNAL_ERROR_MESSAGE);
|
||||
break;
|
||||
case DECRYPT_ERROR:
|
||||
ctx.channel().attr(kickMessageAttribute)
|
||||
.set(config.getDisconnect().getInvalidKey());
|
||||
break;
|
||||
|
||||
@@ -180,7 +180,7 @@ public final class FloodgateHandshakeHandler {
|
||||
formatException.printStackTrace();
|
||||
|
||||
throw callHandlerAndReturnResult(
|
||||
ResultType.EXCEPTION,
|
||||
ResultType.DECRYPT_ERROR,
|
||||
channel, null, hostname
|
||||
);
|
||||
} catch (Exception exception) {
|
||||
@@ -203,6 +203,8 @@ public final class FloodgateHandshakeHandler {
|
||||
return (HandshakeResult) error;
|
||||
}
|
||||
|
||||
error.printStackTrace();
|
||||
|
||||
return callHandlerAndReturnResult(
|
||||
ResultType.EXCEPTION,
|
||||
channel, null, hostname
|
||||
@@ -298,6 +300,7 @@ public final class FloodgateHandshakeHandler {
|
||||
public enum ResultType {
|
||||
EXCEPTION,
|
||||
NOT_FLOODGATE_DATA,
|
||||
DECRYPT_ERROR,
|
||||
INVALID_DATA_LENGTH,
|
||||
TIMESTAMP_DENIED,
|
||||
SUCCESS
|
||||
|
||||
@@ -52,6 +52,9 @@ public final class Constants {
|
||||
public static final String TIMESTAMP_DENIED_MESSAGE =
|
||||
"Something isn't right with this data." +
|
||||
" 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;
|
||||
|
||||
@@ -94,6 +94,10 @@ public final class SpigotDataHandler extends ChannelInboundHandlerAdapter {
|
||||
case SUCCESS:
|
||||
break;
|
||||
case EXCEPTION:
|
||||
logger.info(Constants.INTERNAL_ERROR_MESSAGE);
|
||||
ctx.close();
|
||||
return true;
|
||||
case DECRYPT_ERROR:
|
||||
logger.info(config.getDisconnect().getInvalidKey());
|
||||
ctx.close();
|
||||
return true;
|
||||
|
||||
@@ -128,6 +128,10 @@ public final class VelocityProxyDataHandler extends ChannelInboundHandlerAdapter
|
||||
case SUCCESS:
|
||||
break;
|
||||
case EXCEPTION:
|
||||
ctx.channel().attr(kickMessageAttribute)
|
||||
.set(Constants.INTERNAL_ERROR_MESSAGE);
|
||||
return;
|
||||
case DECRYPT_ERROR:
|
||||
ctx.channel().attr(kickMessageAttribute)
|
||||
.set(config.getDisconnect().getInvalidKey());
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user