mirror of
https://github.com/jonesdevelopment/sonar.git
synced 2026-11-05 09:20:15 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
326a1ecc07 | ||
|
|
6af5a9fc4b | ||
|
|
ac78d88721 |
No files matched your search
@@ -22,10 +22,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 11
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
- name: Build with Gradle
|
||||
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
group=xyz.jonesdev.sonar
|
||||
version=2.0.12
|
||||
version=2.0.13
|
||||
description=Effective Anti-bot plugin for Velocity, BungeeCord, and Bukkit (1.7-latest)
|
||||
@@ -1,4 +1,4 @@
|
||||
val velocityVersion = "3.2.0-SNAPSHOT"
|
||||
val velocityVersion = "3.3.0-SNAPSHOT"
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":api"))
|
||||
@@ -26,5 +26,5 @@ tasks {
|
||||
}
|
||||
}
|
||||
|
||||
java.sourceCompatibility = JavaVersion.VERSION_11
|
||||
java.targetCompatibility = JavaVersion.VERSION_11
|
||||
java.sourceCompatibility = JavaVersion.VERSION_17
|
||||
java.targetCompatibility = JavaVersion.VERSION_17
|
||||
+8
-19
@@ -76,7 +76,6 @@ public final class FallbackListener {
|
||||
private static final MethodHandle INITIAL_CONNECTION;
|
||||
private static final MethodHandle CONNECTED_PLAYER;
|
||||
private static final Field CONNECTION_FIELD;
|
||||
private static Field SESSION_HANDLER_FIELD;
|
||||
|
||||
static {
|
||||
CLOSED_MINECRAFT_CONNECTION = new DummyConnection(null);
|
||||
@@ -94,14 +93,6 @@ public final class FallbackListener {
|
||||
IdentifiedKey.class
|
||||
));
|
||||
|
||||
try {
|
||||
SESSION_HANDLER_FIELD = MinecraftConnection.class.getDeclaredField("activeSessionHandler");
|
||||
} catch (Throwable throwable) {
|
||||
// Velocity b266 changed the field name to "activeSessionHandler"
|
||||
SESSION_HANDLER_FIELD = MinecraftConnection.class.getDeclaredField("sessionHandler");
|
||||
}
|
||||
SESSION_HANDLER_FIELD.setAccessible(true);
|
||||
|
||||
CONNECTION_FIELD = InitialLoginSessionHandler.class.getDeclaredField("mcConnection");
|
||||
CONNECTION_FIELD.setAccessible(true);
|
||||
|
||||
@@ -148,8 +139,7 @@ public final class FallbackListener {
|
||||
Statistics.TOTAL_TRAFFIC.increment();
|
||||
|
||||
try {
|
||||
// Backwards compatibility for Velocity b265 and below
|
||||
val activeSessionHandler = (MinecraftSessionHandler) SESSION_HANDLER_FIELD.get(mcConnection);
|
||||
val activeSessionHandler = mcConnection.getActiveSessionHandler();
|
||||
|
||||
// Check the blacklist here since we cannot let the player "ghost join"
|
||||
if (fallback.getBlacklisted().has(inetAddress)) {
|
||||
@@ -157,7 +147,7 @@ public final class FallbackListener {
|
||||
markConnectionAsDead(activeSessionHandler);
|
||||
initialConnection.getConnection().closeWith(Disconnect.create(
|
||||
Sonar.get().getConfig().getVerification().getBlacklisted(),
|
||||
inboundConnection.getProtocolVersion()
|
||||
inboundConnection.getProtocolVersion(), false
|
||||
));
|
||||
return;
|
||||
}
|
||||
@@ -179,7 +169,7 @@ public final class FallbackListener {
|
||||
markConnectionAsDead(activeSessionHandler);
|
||||
initialConnection.getConnection().closeWith(Disconnect.create(
|
||||
Sonar.get().getConfig().getVerification().getProtocolBlacklisted(),
|
||||
inboundConnection.getProtocolVersion()
|
||||
inboundConnection.getProtocolVersion(), false
|
||||
));
|
||||
return;
|
||||
}
|
||||
@@ -201,7 +191,7 @@ public final class FallbackListener {
|
||||
if (fallback.getQueue().getQueuedPlayers().containsKey(inetAddress)) {
|
||||
initialConnection.getConnection().closeWith(Disconnect.create(
|
||||
Sonar.get().getConfig().getVerification().getAlreadyQueued(),
|
||||
inboundConnection.getProtocolVersion()
|
||||
inboundConnection.getProtocolVersion(), false
|
||||
));
|
||||
return;
|
||||
}
|
||||
@@ -212,7 +202,7 @@ public final class FallbackListener {
|
||||
|| fallback.getConnected().containsValue(inetAddress)) {
|
||||
initialConnection.getConnection().closeWith(Disconnect.create(
|
||||
Sonar.get().getConfig().getVerification().getAlreadyVerifying(),
|
||||
inboundConnection.getProtocolVersion()
|
||||
inboundConnection.getProtocolVersion(), false
|
||||
));
|
||||
return;
|
||||
}
|
||||
@@ -221,7 +211,7 @@ public final class FallbackListener {
|
||||
if (!fallback.getRatelimiter().attempt(inetAddress)) {
|
||||
initialConnection.getConnection().closeWith(Disconnect.create(
|
||||
Sonar.get().getConfig().getVerification().getTooFastReconnect(),
|
||||
inboundConnection.getProtocolVersion()
|
||||
inboundConnection.getProtocolVersion(), false
|
||||
));
|
||||
return;
|
||||
}
|
||||
@@ -240,7 +230,7 @@ public final class FallbackListener {
|
||||
// UTF-16 names or other types of exploits
|
||||
if (!Sonar.get().getConfig().getVerification().getValidNameRegex().matcher(event.getUsername()).matches()) {
|
||||
mcConnection.closeWith(Disconnect.create(Sonar.get().getConfig().getVerification().getInvalidUsername(),
|
||||
mcConnection.getProtocolVersion()));
|
||||
mcConnection.getProtocolVersion(), false));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -359,8 +349,7 @@ public final class FallbackListener {
|
||||
// We use '>=' because the player connecting to the server hasn't joined yet
|
||||
if (onlinePerIp >= maxOnlinePerIp) {
|
||||
connectedPlayer.getConnection().closeWith(Disconnect.create(
|
||||
Sonar.get().getConfig().getTooManyOnlinePerIp(), connectedPlayer.getProtocolVersion()
|
||||
));
|
||||
Sonar.get().getConfig().getTooManyOnlinePerIp(), connectedPlayer.getProtocolVersion(), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user