Compare commits

...
7 Commits
Author SHA1 Message Date
Jones 3ca1852e03 Release 2.1.35 (#491) 2025-07-09 16:33:22 +00:00
Jones 625a3a1e8e Bump Gradle from 8.14.2 to 8.14.3 2025-07-07 12:01:45 +02:00
dependabot[bot] 646f8f08f6 Bump com.gradleup.shadow from 8.3.7 to 8.3.8 (#490)
Bumps [com.gradleup.shadow](https://github.com/GradleUp/shadow) from 8.3.7 to 8.3.8.
- [Release notes](https://github.com/GradleUp/shadow/releases)
- [Commits](https://github.com/GradleUp/shadow/compare/8.3.7...8.3.8)

---
updated-dependencies:
- dependency-name: com.gradleup.shadow
  dependency-version: 8.3.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-07 09:56:30 +00:00
Jones 947eb7f6a1 Remove locale regex check due to a Minecraft bug
There's a bug in Minecraft where, when no language seems to be selected, the client may send invalid data to the server. As the length of the locale string is already capped in Sonar either way, we are not required to double-check the decoded string using a regex.
2025-07-06 20:10:20 +02:00
Jones 881f826692 Add missing translations for the new feature 2025-07-05 12:44:07 +02:00
Jones 4252362584 Make incorrect captcha message contain attempts left 2025-07-05 12:40:07 +02:00
Jones 7271a2a13f Allow "fell through" check to be skipped by a CAPTCHA 2025-07-03 22:02:28 +02:00
34 changed files with 34 additions and 61 deletions

No files matched your search

@@ -177,7 +177,7 @@ public final class SonarConfiguration {
verification.map.timing = Verification.Timing.valueOf(generalConfig.getString("verification.checks.map-captcha.timing"));
verification.map.precomputeAmount = clamp(generalConfig.getInt("verification.checks.map-captcha.precompute"), 10, 5000);
verification.map.maxDuration = clamp(generalConfig.getInt("verification.checks.map-captcha.max-duration"), 5000, 360000);
verification.map.maxTries = generalConfig.getInt("verification.checks.map-captcha.max-tries");
verification.map.maxTries = clamp(generalConfig.getInt("verification.checks.map-captcha.max-tries"), 1, 100);
verification.map.alphabet = generalConfig.getString("verification.checks.map-captcha.alphabet");
verification.map.backgroundImage = null;
@@ -198,7 +198,6 @@ public final class SonarConfiguration {
verification.timeOfDay = clamp(generalConfig.getInt("verification.time-of-day"), 0, 24000);
verification.gamemode = Verification.Gamemode.valueOf(generalConfig.getString("verification.gamemode"));
verification.validNameRegex = Pattern.compile(generalConfig.getString("verification.checks.valid-name-regex"));
verification.validLocaleRegex = Pattern.compile(generalConfig.getString("verification.checks.valid-locale-regex"));
verification.checkGeyser = generalConfig.getBoolean("verification.check-geyser-players");
verification.logConnections = generalConfig.getBoolean("verification.log-connections");
@@ -418,7 +417,6 @@ public final class SonarConfiguration {
private boolean logDuringAttack;
private boolean debugXYZPositions;
private Pattern validNameRegex;
private Pattern validLocaleRegex;
private int readTimeout;
private int writeTimeout;
@@ -108,11 +108,11 @@ public class FallbackPreparer {
public static final FallbackPacket REMOVE_VEHICLE = new RemoveEntitiesPacket(VEHICLE_ENTITY_ID);
public static final FallbackPacket SET_VEHICLE_PASSENGERS = new FallbackPacketSnapshot(
new SetPassengersPacket(VEHICLE_ENTITY_ID, PLAYER_ENTITY_ID));
public FallbackPacket[] incorrectCaptcha;
public FallbackPacket loginSuccess;
public FallbackPacket welcomeMessage;
public FallbackPacket enterCodeMessage;
public FallbackPacket incorrectCaptcha;
public static FallbackPacket joinGame;
public FallbackPacket defaultSpawnPosition;
public FallbackPacket spawnPosition;
@@ -238,11 +238,14 @@ public class FallbackPreparer {
MiniMessage.miniMessage().deserialize(
Sonar.get0().getConfig().getMessagesConfig().getString("verification.captcha.enter"),
Placeholder.component("prefix", Sonar.get0().getConfig().getPrefix())))));
incorrectCaptcha = new FallbackPacketSnapshot(new SystemChatPacket(new ComponentHolder(
MiniMessage.miniMessage().deserialize(
Sonar.get0().getConfig().getMessagesConfig().getString("verification.captcha.incorrect"),
Placeholder.component("prefix", Sonar.get0().getConfig().getPrefix())))));
incorrectCaptcha = new FallbackPacket[Sonar.get0().getConfig().getVerification().getMap().getMaxTries()];
for (int i = 0; i < incorrectCaptcha.length; i++) {
incorrectCaptcha[i] = new FallbackPacketSnapshot(new SystemChatPacket(new ComponentHolder(
MiniMessage.miniMessage().deserialize(
Sonar.get0().getConfig().getMessagesConfig().getString("verification.captcha.incorrect"),
Placeholder.component("prefix", Sonar.get0().getConfig().getPrefix()),
Placeholder.unparsed("attempts-left", String.valueOf(i + 1))))));
}
// Prepare countdown
xpCountdown = new FallbackPacket[Sonar.get0().getConfig().getVerification().getMap().getMaxDuration() / 1000];
@@ -79,7 +79,7 @@ public final class FallbackCaptchaHandler extends FallbackVerificationHandler {
// Decrement the number of tries left
checkState(tries-- > 0, "failed CAPTCHA too often");
// Send the player a chat message to let them know that the code they entered is incorrect
user.write(incorrectCaptcha);
user.write(incorrectCaptcha[tries]);
} else if (packet instanceof SetPlayerPositionPacket
|| packet instanceof SetPlayerPositionRotationPacket) {
// A position packet is sent approximately every second
@@ -198,8 +198,9 @@ public final class FallbackGravityHandler extends FallbackVerificationHandler {
}
// Ensure that the player's Y coordinate is above the collision platform
checkState(y >= PLATFORM_Y_POSITION,
"fell through blocks: " + y + "/" + deltaY + "/" + movementTick);
if (y < PLATFORM_Y_POSITION) {
failOrShowCaptcha("fell through blocks: " + y + "/" + deltaY + "/" + movementTick);
}
// The player is not allowed to move away from the collision platform.
// This should not happen unless the max movement tick is configured to a high number.
@@ -106,8 +106,6 @@ public final class FallbackPreJoinHandler extends FallbackVerificationHandler {
checkState(clientInformation.getViewDistance() >= 2,
"view distance: " + clientInformation.getViewDistance());
}
// Ensure that the client locale is correct
validateClientLocale(clientInformation.getLocale());
receivedClientInfo = true;
} else if (packet instanceof PluginMessagePacket) {
@@ -186,11 +184,4 @@ public final class FallbackPreJoinHandler extends FallbackVerificationHandler {
final Pattern pattern = Sonar.get0().getConfig().getVerification().getBrand().getValidRegex();
checkState(pattern.matcher(brand).matches(), "client brand does not match pattern: " + brand);
}
private void validateClientLocale(final @NotNull String locale) {
// Check the client locale by performing a simple regex check
// that disallows non-ascii characters by default.
final Pattern pattern = Sonar.get0().getConfig().getVerification().getValidLocaleRegex();
checkState(pattern.matcher(locale).matches(), "client locale does not match pattern: " + locale);
}
}
@@ -136,8 +136,6 @@ verification:
# Regex pro validování jmen při verifikaci
valid-name-regex: ^[a-zA-Z0-9_]+$
# Regex pro validaci "client locale" při verifikaci
valid-locale-regex: ^[a-zA-Z_]+$
# Je-li povoleno, hráč bude přenesen zpět na původní server
# po úspěšném absolvování ověření bota.
@@ -133,8 +133,6 @@ verification:
# Regex zur Validierung von Benutzernamen während der Überprüfung
valid-name-regex: ^[a-zA-Z0-9_]+$
# Regex zur Validierung der Client-Spracheinstellung während der Überprüfung
valid-locale-regex: ^[a-zA-Z_]+$
# Wenn aktiviert, wird der Player zurück zum Ursprungsserver gesendet,
# falls dieser die der Bot-Verifizierung erfolgreich besteht.
@@ -136,8 +136,6 @@ verification:
# Regex for validating usernames during verification
valid-name-regex: ^[a-zA-Z0-9_]+$
# Regex for validating client locale during verification
valid-locale-regex: ^[a-zA-Z_]+$
# If enabled, the player will be transferred back to the origin server
# after successfully passing the bot verification.
@@ -135,8 +135,6 @@ verification:
# Regex pour valider les noms d'utilisateur lors de la vérification
valid-name-regex: ^[a-zA-Z0-9_]+$
# Regex pour valider la locale client lors de la vérification
valid-locale-regex: ^[a-zA-Z_]+$
# S'il est activé, le joueur sera renvoyé au serveur d'origine
# après avoir passé avec succès la vérification du bot.
@@ -135,8 +135,6 @@ verification:
# Regex-ი მომხმარებლის სახელების ვერიფიკაციისთვის
valid-name-regex: ^[a-zA-Z0-9_]+$
# Regex-ი კლიენტის ადგილის დასადასტურებლად ვერიფიკაციის დროს
valid-locale-regex: ^[a-zA-Z_]+$
# თუ ჩართულია, მოთამაშე გადავა საწყის სერვერში ვერიფიკაციის წარმატებით გავლის შემდეგ
# ეს ფუნქცია დაემატა Mojang-ის მიერ Minecraft-ის 1.20.5 ვერსიაში
@@ -135,8 +135,6 @@ verification:
# Regex voor het valideren van gebruikersnamen tijdens verificatie
valid-name-regex: ^[a-zA-Z0-9_]+$
# Regex voor het valideren van de landinstelling van de client tijdens verificatie
valid-locale-regex: ^[a-zA-Z_]+$
# Indien ingeschakeld, wordt de speler teruggestuurd naar de oorspronkelijke server
# nadat u de bot-verificatie met succes heeft doorstaan.
@@ -135,8 +135,6 @@ verification:
# Regex do sprawdzania poprawności nazw użytkowników podczas weryfikacji
valid-name-regex: ^[a-zA-Z0-9_]+$
# Regex do sprawdzania ustawień regionalnych klienta podczas weryfikacji
valid-locale-regex: ^[a-zA-Z_]+$
# Jeśli opcja ta jest włączona, gracz zostanie przeniesiony z powrotem
# na serwer początkowy po pomyślnym przejściu weryfikacji antybotowej.
@@ -135,8 +135,6 @@ verification:
# Regex para validar nomes de usuário durante a verificação
valid-name-regex: ^[a-zA-Z0-9_]+$
# Regex para validar o local do cliente durante a verificação
valid-locale-regex: ^[a-zA-Z_]+$
# Se habilitado, o jogador será transferido de volta para o servidor de origem
# após passar com sucesso pela verificação do bot.
@@ -134,8 +134,6 @@ verification:
# Regex для проверки ников при верификации
valid-name-regex: ^[a-zA-Z0-9_]+$
# Regex для проверки локализации клиента при верификации
valid-locale-regex: ^[a-zA-Z_]+$
# Если включено, игрок будет возвращен на исходный сервер
# после успешного прохождения проверки на бота.
@@ -133,8 +133,6 @@ verification:
# 用于检查用户名是否有效的正则表达式
valid-name-regex: ^[a-zA-Z0-9_]+$
# 用于检查客户端语言(例如 zh_CN)的正则表达式
valid-locale-regex: ^[a-zA-Z_]+$
# 开启后 玩家将在验证成功后被重定向到指定的服务器
# 该功能由 Mojang 在 Minecraft 1.20.5 版本中引入
@@ -196,7 +196,7 @@ verification:
# Zpráva zobrazená hráči, když má zadat odpověď na captchu
enter: '<prefix><green>Prosím, zadejte text do chatu, který se zobrazí na mapě.'
# Zpráva zobrazená hráči, když zadá špatnou odpověď do chatu
incorrect: '<prefix><red>Zadali jste špatnou odpověď! Zkuste to prosím znovu.'
incorrect: '<prefix><red>Zadali jste špatnou odpověď! Zbývají vám <attempts-left> pokus(y).'
# Zpráva zobrazená hráči při ověřování
# Nastavením této hodnoty na '' uvítací zprávu zcela vypnete
@@ -197,7 +197,7 @@ verification:
# Nachricht, die dem Spieler angezeigt wird, wenn er den CAPTCHA-Code im Chat eingeben muss
enter: '<prefix><green>Bitte gib den Text im Chat ein, der auf der Karte angezeigt wird.'
# Nachricht, die dem Spieler angezeigt wird, wenn er den falschen Code im Chat eingibt
incorrect: '<prefix><red>Du hast eine falsche Antwort eingegeben! Bitte versuche es erneut.'
incorrect: '<prefix><red>Du hast eine falsche Antwort eingegeben! Sie haben noch <attempts-left> Versuch(e) übrig.'
# Nachricht, die dem Spieler angezeigt wird, wenn er überprüft wird
# Setzen Sie dies auf '', um die Willkommensnachricht vollständig zu deaktivieren
@@ -196,7 +196,7 @@ verification:
# Message shown to the player when they have to enter the answer to the CAPTCHA
enter: '<prefix><green>Please enter the text in chat that is displayed on the map.'
# Message shown to the player when they enter the wrong answer in chat
incorrect: '<prefix><red>You have entered a wrong answer! Please try again.'
incorrect: '<prefix><red>You have entered a wrong answer! You have <attempts-left> attempt(s) left.'
# Message shown to the player when they are being verified
# Set this to '' to disable the welcome message entirely
@@ -196,7 +196,7 @@ verification:
# Message shown to the player when they have to enter the answer to the captcha
enter: '<prefix><green>Por favor, introduce en el chat el texto que se muestra en el mapa.'
# Message shown to the player when they enter the wrong answer in chat
incorrect: '<prefix><red>¡Has introducido una respuesta incorrecta! Por favor, inténtalo de nuevo.'
incorrect: '<prefix><red>¡Has introducido una respuesta incorrecta! Te quedan <attempts-left> intento(s).'
# Mensaje que se muestra al jugador cuando está siendo verificado
# Ajústalo a '' para desactivar por completo el mensaje de bienvenida
@@ -196,7 +196,7 @@ verification:
# Message affiché au joueur lorsqu'il doit entrer la réponse au CAPTCHA
enter: '<prefix><green>Veuillez saisir le texte en chat qui s''affiche sur la carte.'
# Message affiché au joueur lorsqu'il entre la mauvaise réponse dans le chat
incorrect: '<prefix><red>Vous avez saisi une mauvaise réponse ! Veuillez réessayer.'
incorrect: '<prefix><red>Vous avez saisi une mauvaise réponse ! Il vous reste <attempts-left> tentative(s).'
# Message affiché au joueur lorsqu'il est en cours de vérification
# Réglez ce paramètre sur '' pour désactiver complètement le message de bienvenue
@@ -196,7 +196,7 @@ verification:
# Pesan yang ditampilkan kepada pemain saat mereka harus memasukkan jawaban untuk CAPTCHA
enter: '<prefix><green>Masukkan teks dalam obrolan yang ditampilkan di peta.'
# Pesan yang ditampilkan kepada pemain saat mereka memasukkan jawaban yang salah di chat
incorrect: '<prefix><red>Anda telah memasukkan jawaban yang salah! Silakan coba lagi.'
incorrect: '<prefix><red>Anda telah memasukkan jawaban yang salah! Anda memiliki <attempts-left> percobaan yang tersisa.'
# Pesan yang ditampilkan kepada pemain ketika mereka sedang diverifikasi
# Atur ini ke '' untuk menonaktifkan pesan selamat datang sepenuhnya
@@ -196,7 +196,7 @@ verification:
# მესიჯი რომელიც გაეგზავნება მოთამაშეს როცა მათ უნდა მიუთითონ CAPTCHA ს პასუხი
enter: '<prefix><green>გთხოვთ დაწეროთ ჩატში ის კოდი რომელიც არის ნაჩვენები რუკაზე.'
# მესიჯი რომელიც გაეგზავნება მოთამაშეს როცა ისინი ჩაწერენ არასწორ პასუხს ჩატში
incorrect: '<prefix><red>თქვენ მიუთითეთ არასწორი კოდი. გთხოვთ ხელახლა ცადოთ.'
incorrect: '<prefix><red>თქვენ მიუთითეთ არასწორი კოდი. თქვენ დაგრჩათ <attempts-left> მცდელობა(ები).'
# Message shown to the player when they are being verified
# Set this to '' to disable the welcome message entirely
@@ -196,7 +196,7 @@ verification:
# Bericht dat aan de speler wordt getoond wanneer hij het antwoord op de CAPTCHA moet invoeren
enter: '<prefix><green>Voer in de chat de tekst in die op de kaart wordt weergegeven.'
# Bericht dat aan de speler wordt getoond wanneer hij of zij het verkeerde antwoord invoert in de chat
incorrect: '<prefix><red>Je hebt een verkeerd antwoord ingevoerd! Probeer het opnieuw.'
incorrect: '<prefix><red>Je hebt een verkeerd antwoord ingevoerd! Je hebt <attempts-left> poging(en) over.'
# Bericht dat aan de speler wordt getoond als hij wordt geverifieerd
# Stel dit in op '' om het welkomstbericht volledig uit te schakelen
@@ -199,7 +199,7 @@ verification:
# Message shown to the player when they have to enter the answer to the captcha
enter: '<prefix><green>Wprowadź na czacie tekst wyświetlany na mapie.'
# Message shown to the player when they enter the wrong answer in chat
incorrect: '<prefix><red>Wprowadzono nieprawidłowy kod. Spróbuj ponownie.'
incorrect: '<prefix><red>Wprowadzono nieprawidłowy kod. Zostało <attempts-left> prób.'
# Wiadomość wyświetlana graczowi podczas weryfikacji
# Ustaw wartość '', aby całkowicie wyłączyć wiadomość powitalną
@@ -196,7 +196,7 @@ verification:
# Mensagem mostrada ao jogador quando ele deve inserir a resposta ao CAPTCHA
enter: '<prefix><green>Por favor, insira o texto no chat que é exibido no mapa.'
# Mensagem mostrada ao jogador quando ele insere a resposta errada no chat
incorrect: '<prefix><red>Você inseriu uma resposta errada! Por favor, tente novamente.'
incorrect: '<prefix><red>Você inseriu uma resposta errada! Você tem <attempts-left> tentativa(s) restante(s).'
# Mensagem mostrada ao jogador quando ele está sendo verificado
# Defina isso como '' para desativar a mensagem de boas-vindas completamente
@@ -196,7 +196,7 @@ verification:
# Сообщение, которое показывается игроку, когда он должен ввести ответ на капчу
enter: '<prefix><green>Пожалуйста, введите в чат текст, который будет отображаться на карте.'
# Сообщение, которое показывается игроку, когда он вводит неправильную капчу в чат
incorrect: '<prefix><red>Вы ввели неправильный ответ! Пожалуйста, попробуйте еще раз.'
incorrect: '<prefix><red>Вы ввели неверный код! У вас осталось <attempts-left> попыток.'
# Сообщение, показываемое игроку при прохождении верификации
# Установите значение '', чтобы полностью отключить приветственное сообщение
@@ -196,7 +196,7 @@ verification:
# CAPTCHA'nın cevabını girmeleri gerektiğinde oyuncuya gösterilen mesaj
enter: '<prefix><green>Lütfen haritada görüntülenen sohbet metnini girin.'
# Message that is shown to the player when they enter the wrong answer in chat
incorrect: '<prefix><red>Yanlış bir cevap girdiniz! Lütfen tekrar deneyin.'
incorrect: '<prefix><red>Yanlış bir cevap girdiniz! <attempts-left> deneme(ler)iniz kaldı.'
# Doğrulandıklarında oyuncuya gösterilen mesaj
# Karşılama mesajını tamamen devre dışı bırakmak için bunu '' olarak ayarlayın
@@ -196,7 +196,7 @@ verification:
# 玩家需要输入验证码答案时显示的消息
enter: '<prefix><green>请输入地图上显示的聊天文本.'
# 当玩家输入错误的验证码时显示的消息
incorrect: '<prefix><red>您输入了错误的答案! 请重试.'
incorrect: '<prefix><red>您输入了错误的答案! 您还剩 <attempts-left> 次尝试。'
# 当玩家正在接受验证时显示的信息
# 将此项设置为''可完全禁用加入时发送的消息
+1 -1
View File
@@ -1,3 +1,3 @@
group=xyz.jonesdev
version=2.1.34
version=2.1.35
description=A lightweight, effective, and easy-to-use anti-bot plugin for Velocity, BungeeCord, and Bukkit.
+1 -1
View File
@@ -8,7 +8,7 @@ pluginyml = "0.6.0"
[plugins]
indra-git = "net.kyori.indra.git:3.1.3"
shadow = "com.gradleup.shadow:8.3.7"
shadow = "com.gradleup.shadow:8.3.8"
spotless = "com.diffplug.spotless:7.0.4"
pluginyml-bungee = { id = "net.minecrell.plugin-yml.bungee", version.ref = "pluginyml" }
pluginyml-bukkit = { id = "net.minecrell.plugin-yml.bukkit", version.ref = "pluginyml" }
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+2 -2
View File
@@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
Vendored
+2 -2
View File
@@ -70,11 +70,11 @@ goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell