mirror of
https://github.com/jonesdevelopment/sonar.git
synced 2026-11-13 12:42:00 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8bbe411e1 | ||
|
|
4ed63ee2dc | ||
|
|
7cd7f86114 | ||
|
|
58c9a6bc25 | ||
|
|
be6fbc78ab | ||
|
|
cd5eb191fa | ||
|
|
449ff7a55d | ||
|
|
89b8033540 | ||
|
|
1b003e9872 | ||
|
|
59d1cd2e66 | ||
|
|
de377dbde6 | ||
|
|
9b5845f5af | ||
|
|
6cd1f9e5e4 | ||
|
|
5ca053cfdd | ||
|
|
95d94e467a | ||
|
|
fdd54c9b34 |
No files matched your search
@@ -73,19 +73,19 @@ class LibraryLoader {
|
||||
Library.builder()
|
||||
.groupId("net{}kyori")
|
||||
.artifactId("adventure-text-minimessage")
|
||||
.version("4.21.0")
|
||||
.version("5.2.0")
|
||||
.relocate("net{}kyori", "xyz{}jonesdev{}sonar{}libs{}kyori")
|
||||
.build(),
|
||||
Library.builder()
|
||||
.groupId("net{}kyori")
|
||||
.artifactId("adventure-text-serializer-gson")
|
||||
.version("4.21.0")
|
||||
.version("5.2.0")
|
||||
.relocate("net{}kyori", "xyz{}jonesdev{}sonar{}libs{}kyori")
|
||||
.build(),
|
||||
Library.builder()
|
||||
.groupId("net{}kyori")
|
||||
.artifactId("adventure-nbt")
|
||||
.version("4.21.0")
|
||||
.version("5.2.0")
|
||||
.relocate("net{}kyori", "xyz{}jonesdev{}sonar{}libs{}kyori")
|
||||
.build()
|
||||
);
|
||||
@@ -95,7 +95,7 @@ class LibraryLoader {
|
||||
Library.builder()
|
||||
.groupId("net{}kyori")
|
||||
.artifactId("adventure-nbt")
|
||||
.version("4.21.0")
|
||||
.version("5.2.0")
|
||||
.relocate("net{}kyori{}adventure{}nbt", "xyz{}jonesdev{}sonar{}libs{}kyori{}adventure{}nbt")
|
||||
.build()
|
||||
);
|
||||
|
||||
@@ -21,6 +21,7 @@ import io.netty.channel.ChannelDuplexHandler;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.jonesdev.sonar.common.util.ProtocolUtil;
|
||||
|
||||
@ChannelHandler.Sharable
|
||||
public final class TailExceptionsHandler extends ChannelDuplexHandler {
|
||||
@@ -33,6 +34,20 @@ public final class TailExceptionsHandler extends ChannelDuplexHandler {
|
||||
// Additionally, this will also run after our custom decoder.
|
||||
@Override
|
||||
public void exceptionCaught(final @NotNull ChannelHandlerContext ctx, final Throwable cause) throws Exception {
|
||||
// If ProtocolUtil#closeWith(...) already queued a graceful write-then-close for
|
||||
// this channel (e.g. VerificationHandler#fail() calls disconnect() and then
|
||||
// throws to unwind), don't race it with a second, immediate close() here. Doing
|
||||
// so can abort the still-in-flight kick/disconnect packet write before it's fully
|
||||
// flushed, so the client only receives a truncated packet instead of our message.
|
||||
// The scheduled close from closeWith() will still run once the write completes.
|
||||
// See: https://github.com/jonesdevelopment/sonar/issues/476
|
||||
if (Boolean.TRUE.equals(ctx.channel().attr(ProtocolUtil.CLOSING).get())) {
|
||||
if (LOG_EXCEPTIONS) {
|
||||
cause.printStackTrace(System.err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Close the channel if we encounter any errors.
|
||||
ctx.close();
|
||||
if (LOG_EXCEPTIONS) {
|
||||
|
||||
@@ -85,7 +85,10 @@ public enum ItemType {
|
||||
if (protocolVersion.lessThanOrEquals(MINECRAFT_1_21_11)) {
|
||||
return 1104;
|
||||
}
|
||||
return 1105;
|
||||
if (protocolVersion.lessThanOrEquals(MINECRAFT_26_1)) {
|
||||
return 1105;
|
||||
}
|
||||
return 1133;
|
||||
}, protocolVersion -> {
|
||||
if (protocolVersion.lessThanOrEquals(MINECRAFT_1_21)) {
|
||||
return 26;
|
||||
|
||||
@@ -24,6 +24,7 @@ import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import io.netty.handler.codec.EncoderException;
|
||||
import io.netty.util.AttributeKey;
|
||||
import io.netty.util.Version;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.kyori.adventure.nbt.BinaryTag;
|
||||
@@ -217,9 +218,20 @@ public class ProtocolUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static final AttributeKey<Boolean> CLOSING = AttributeKey.valueOf("sonar-graceful-close-in-progress");
|
||||
|
||||
public static void closeWith(final @NotNull Channel channel,
|
||||
final @NotNull ProtocolVersion protocolVersion,
|
||||
final @NotNull Object msg) {
|
||||
// Mark this channel as already undergoing a graceful close *before* we queue the
|
||||
// write. If something downstream (e.g. an exception thrown right after this call,
|
||||
// such as VerificationHandler#fail()'s QuietDecoderException) reaches
|
||||
// TailExceptionsHandler while our writeAndFlush(...).addListener(CLOSE) is still
|
||||
// in flight, that handler must not call ctx.close() a second time - doing so can
|
||||
// abort the still-pending write and deliver only a truncated packet to the client
|
||||
// (which then sees a bare disconnect/reset instead of our kick message).
|
||||
// See: https://github.com/jonesdevelopment/sonar/issues/476
|
||||
channel.attr(CLOSING).set(true);
|
||||
if (protocolVersion.lessThan(ProtocolVersion.MINECRAFT_1_8)) {
|
||||
channel.eventLoop().execute(() -> {
|
||||
channel.config().setAutoRead(false);
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ public abstract class VerificationHandler implements SonarPacketListener {
|
||||
// The user is allowed to disable the blacklist entirely by setting the threshold to 0
|
||||
final int limit = Sonar.get0().getConfig().getVerification().getBlacklistThreshold();
|
||||
// The player hasn't been blacklisted yet, so skip this iteration
|
||||
if (newScore < limit) break blacklist;
|
||||
if (limit <= 0 || newScore < limit) break blacklist;
|
||||
|
||||
GlobalSonarStatistics.totalBlacklistedPlayers++;
|
||||
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
group=xyz.jonesdev
|
||||
version=2.1.49
|
||||
version=2.1.51
|
||||
description=A lightweight, effective, and easy-to-use anti-bot plugin for Velocity, BungeeCord, and Bukkit.
|
||||
@@ -1,5 +1,5 @@
|
||||
[versions]
|
||||
netty = "4.2.15.Final"
|
||||
netty = "4.2.17.Final"
|
||||
adventure = "5.2.0"
|
||||
adventure-platform = "4.4.1"
|
||||
bstats = "3.2.1"
|
||||
@@ -8,8 +8,8 @@ pluginyml = "0.6.0"
|
||||
|
||||
[plugins]
|
||||
indra-git = "net.kyori.indra.git:3.2.0"
|
||||
shadow = "com.gradleup.shadow:9.4.3"
|
||||
spotless = "com.diffplug.spotless:8.8.0"
|
||||
shadow = "com.gradleup.shadow:9.6.1"
|
||||
spotless = "com.diffplug.spotless:8.10.1"
|
||||
pluginyml-bungee = { id = "net.minecrell.plugin-yml.bungee", version.ref = "pluginyml" }
|
||||
pluginyml-bukkit = { id = "net.minecrell.plugin-yml.bukkit", version.ref = "pluginyml" }
|
||||
pluginyml-paper = { id = "net.minecrell.plugin-yml.paper", version.ref = "pluginyml" }
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
|
||||
Reference in new issue
Block a user