mirror of
https://github.com/jonesdevelopment/sonar.git
synced 2026-11-05 17:22:34 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f0d70650b | ||
|
|
2ad0ce11c0 | ||
|
|
fd1e5c9d72 | ||
|
|
e036ce421d | ||
|
|
cf2628a41f | ||
|
|
fcea8e5f11 | ||
|
|
ad5de38b1d | ||
|
|
bc0661c10c | ||
|
|
5e233b4f73 | ||
|
|
e7f816fcaa | ||
|
|
d87b775b76 |
No files matched your search
@@ -26,6 +26,12 @@
|
||||
[License](https://github.com/jonesdevelopment/sonar/?tab=readme-ov-file#license)
|
||||
</div>
|
||||
|
||||
> ### Notice about Sonar 3.0
|
||||
>
|
||||
> We're excited to announce the public release of Sonar 3.0.
|
||||
> If you are interested, please check out https://sonar.top/. You can read more about what sets Sonar 3.0 apart from Sonar 2.0 [here](<https://docs.sonar.top/faq>).
|
||||
> If you want more robust protection, better performance, and awesome new features, check out Sonar 3.0!
|
||||
|
||||
## Design and Goal
|
||||
* Effective, lightweight, and easy-to-use
|
||||
* No unnecessary features and clean code
|
||||
|
||||
@@ -43,7 +43,7 @@ class StandardTTFFontProvider {
|
||||
// Set the font size and style
|
||||
return customFont.deriveFont(Font.PLAIN, STANDARD_FONT_SIZE);
|
||||
} catch (Exception exception) {
|
||||
throw new IllegalStateException(exception);
|
||||
throw new IllegalStateException("Error loading font. Does your environment support fonts?", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
-12
@@ -93,9 +93,9 @@ public final class FallbackGravityHandler extends FallbackVerificationHandler {
|
||||
|
||||
private final FallbackPreJoinHandler preJoinHandler;
|
||||
private final boolean enableGravityCheck, enableCollisionsCheck;
|
||||
private boolean teleported, canFall, checkMovement;
|
||||
private boolean teleported, canFall, checkMovement, expectClientTick, expectTeleportPosRot;
|
||||
private double y, deltaY, blockHeight;
|
||||
private int movementTick, clientTick, expectedTeleportId = FIRST_TELEPORT_ID;
|
||||
private int movementTick, tickWithoutMove, expectedTeleportId = FIRST_TELEPORT_ID;
|
||||
private SetPlayerPositionRotationPacket lastPositionPacket;
|
||||
|
||||
@Override
|
||||
@@ -105,8 +105,14 @@ public final class FallbackGravityHandler extends FallbackVerificationHandler {
|
||||
final SetPlayerPositionRotationPacket position = (SetPlayerPositionRotationPacket) packet;
|
||||
if (teleported) {
|
||||
handleMovement(position.getX(), position.getY(), position.getZ(), position.isOnGround(), true);
|
||||
} else if (user.getProtocolVersion().greaterThanOrEquals(ProtocolVersion.MINECRAFT_1_21_2)) {
|
||||
} else if (user.getProtocolVersion().equals(ProtocolVersion.MINECRAFT_1_21_2)) {
|
||||
lastPositionPacket = position;
|
||||
return;
|
||||
}
|
||||
if (expectTeleportPosRot) {
|
||||
expectTeleportPosRot = false;
|
||||
} else {
|
||||
checkClientTick();
|
||||
}
|
||||
} else if (packet instanceof SetPlayerPositionPacket) {
|
||||
// Make sure the player has teleported before checking for position packets
|
||||
@@ -114,6 +120,7 @@ public final class FallbackGravityHandler extends FallbackVerificationHandler {
|
||||
final SetPlayerPositionPacket position = (SetPlayerPositionPacket) packet;
|
||||
handleMovement(position.getX(), position.getY(), position.getZ(), position.isOnGround(), false);
|
||||
}
|
||||
checkClientTick();
|
||||
} else if (packet instanceof ConfirmTeleportationPacket) {
|
||||
final ConfirmTeleportationPacket confirmTeleport = (ConfirmTeleportationPacket) packet;
|
||||
|
||||
@@ -123,31 +130,58 @@ public final class FallbackGravityHandler extends FallbackVerificationHandler {
|
||||
checkState(confirmTeleport.getTeleportId() == expectedTeleportId,
|
||||
"expected TP ID " + expectedTeleportId + ", but got " + confirmTeleport.getTeleportId());
|
||||
|
||||
final boolean sendPosRotBefore = user.getProtocolVersion().equals(ProtocolVersion.MINECRAFT_1_21_2);
|
||||
checkState(sendPosRotBefore ? lastPositionPacket != null : !expectTeleportPosRot,
|
||||
"expected position rotation but got teleport confirm.");
|
||||
if (!sendPosRotBefore) {
|
||||
expectTeleportPosRot = true;
|
||||
}
|
||||
|
||||
// The first teleport ID is not useful for us in this context, skip it
|
||||
if (expectedTeleportId == FIRST_TELEPORT_ID) {
|
||||
lastPositionPacket = null;
|
||||
expectedTeleportId = SECOND_TELEPORT_ID;
|
||||
} else {
|
||||
// Enable the movement checks
|
||||
teleported = true;
|
||||
|
||||
if (user.getProtocolVersion().greaterThanOrEquals(ProtocolVersion.MINECRAFT_1_21_2)) {
|
||||
checkState(lastPositionPacket != null, "excepted position rotation but got teleport confirm.");
|
||||
if (sendPosRotBefore) {
|
||||
handleMovement(
|
||||
lastPositionPacket.getX(), lastPositionPacket.getY(), lastPositionPacket.getZ(),
|
||||
lastPositionPacket.isOnGround(), true);
|
||||
}
|
||||
}
|
||||
lastPositionPacket = null;
|
||||
} else if (packet instanceof ClientInformationPacket
|
||||
|| packet instanceof PluginMessagePacket) {
|
||||
// Pass these packets back to the login handler
|
||||
// TODO: recode this
|
||||
preJoinHandler.handle(packet);
|
||||
} else if (packet instanceof ClientTickEndPacket) {
|
||||
clientTick++;
|
||||
lastPositionPacket = null;
|
||||
if (!expectClientTick) {
|
||||
// Is it impossible for the client to not move during the gravity check?
|
||||
if (++tickWithoutMove >= 20) {
|
||||
fail("expected position but got client tick end.");
|
||||
}
|
||||
} else {
|
||||
tickWithoutMove = 0;
|
||||
expectClientTick = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkClientTick() {
|
||||
if (user.getProtocolVersion().lessThan(ProtocolVersion.MINECRAFT_1_21_2)) {
|
||||
return;
|
||||
}
|
||||
if (expectClientTick) {
|
||||
failOrShowCaptcha("expected client tick end but got position.");
|
||||
} else {
|
||||
expectClientTick = true;
|
||||
}
|
||||
tickWithoutMove = 0; // lag may cause some problems :(
|
||||
}
|
||||
|
||||
private void markSuccess() {
|
||||
// Force-stop the movement checks
|
||||
teleported = false;
|
||||
@@ -207,11 +241,6 @@ public final class FallbackGravityHandler extends FallbackVerificationHandler {
|
||||
checkState(Math.abs(Math.abs(x) - BLOCKS_PER_ROW) < BLOCKS_PER_ROW, "illegal x offset: " + x);
|
||||
checkState(Math.abs(Math.abs(z) - BLOCKS_PER_ROW) < BLOCKS_PER_ROW, "illegal z offset: " + z);
|
||||
|
||||
// Check if the client is ticking correctly
|
||||
if (user.getProtocolVersion().greaterThanOrEquals(ProtocolVersion.MINECRAFT_1_21_2)) {
|
||||
checkState(clientTick >= movementTick, "invalid ticking: " + clientTick + "/" + movementTick);
|
||||
}
|
||||
|
||||
if (!onGround) {
|
||||
// The deltaY is 0 whenever the player sends their first position packet.
|
||||
// We have to account for this or the player will falsely fail the verification.
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
group=xyz.jonesdev
|
||||
version=2.1.36
|
||||
version=2.1.37
|
||||
description=A lightweight, effective, and easy-to-use anti-bot plugin for Velocity, BungeeCord, and Bukkit.
|
||||
@@ -1,7 +1,7 @@
|
||||
[versions]
|
||||
netty = "4.2.2.Final"
|
||||
adventure = "4.21.0"
|
||||
adventure-platform = "4.4.0"
|
||||
netty = "4.2.5.Final"
|
||||
adventure = "4.24.0"
|
||||
adventure-platform = "4.4.1"
|
||||
bstats = "3.1.0"
|
||||
libby = "2.0.0-SNAPSHOT"
|
||||
pluginyml = "0.6.0"
|
||||
@@ -32,7 +32,7 @@ caffeine = "com.github.ben-manes.caffeine:caffeine:3.2.2"
|
||||
annotations = "org.jetbrains:annotations:26.0.2"
|
||||
simpleyaml = "com.github.Carleslc.Simple-YAML:Simple-Yaml:1.8.4"
|
||||
ormlite = "com.j256.ormlite:ormlite-jdbc:6.1"
|
||||
lombok = "org.projectlombok:lombok:1.18.38"
|
||||
lombok = "org.projectlombok:lombok:1.18.40"
|
||||
bungeecord = "net.md-5:bungeecord-proxy:1.21-SNAPSHOT"
|
||||
velocity = "io.papermc.velocity:velocity-proxy:3.4.0-SNAPSHOT"
|
||||
# We have to use 1.8.8 for backwards compatibility
|
||||
|
||||
Reference in new issue
Block a user