Folia
Folia copied to clipboard
Chat message validation failure
Expected behavior
I am sending a message to a player with player.sendMessage(Component) and sometimes (not always) the player is kicked because it can't sign the message. For instance the message sended contains clickable command text. It only occus when the component built contains click events or hover events
Observed/Actual behavior
The player is kicked on the message reception and the console shows that :
[11:13:47 WARN]: Failed to validate message acknowledgements from Seenty1 [11:13:47 INFO]: Seenty1 lost connection: Chat message validation failure
Steps/models to reproduce
Send a message to a player with a plugin, you need to try multiples times. My source code is in other part
Plugin and Datapack List
Only custom plugins
[11:45:36 INFO]: Bukkit Plugins: [11:45:36 INFO]: - CoreProtect, PacifistaMain, PacifistaSurvie, voicechat
Folia version
[11:45:47 INFO]: Checking version, please wait... [11:45:47 INFO]: This server is running Folia version git-Folia-"ef2c697" (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: ef2c697) You are running the latest version Previous version: git-Paper-463 (MC: 1.20.4)
Other
Here is the source code :
final Component message = this.buildMessage(pageDTO, player);
player.getScheduler().run(getPlugin(), s3 -> player.sendMessage(message), null);
The buildMessage method
private Component buildMessage(final PageDTO<DTO> pageDTO, final Player sender) throws PacifistaException, PluginException {
final List<DTO> content = pageDTO.getContent();
final TextComponent.Builder message = Component.text()
.append(this.header)
.append(Component.newline())
.append(Component.newline());
int added = 0;
Component tmp;
for (final DTO dto : content) {
tmp = this.getDTOComponentLine(dto, sender);
if (tmp != null) {
++added;
if (this.showIndex) {
tmp = Component.text(this.getIndex(pageDTO, content.indexOf(dto)) + ". - ", NamedTextColor.GRAY).append(tmp);
}
message.append(tmp).append(Component.newline());
}
}
if (added == 0) {
message.append(Component.text("Aucun élément trouvé.", NamedTextColor.RED));
} else {
message.append(Component.newline());
}
message.append(Component.newline())
.append(this.buildPagination(pageDTO));
return message.build();
}
Here is the pagination builder where the clicks events occurs
private Component buildPagination(final PageDTO<DTO> pageDTO) {
final int totalPages = pageDTO.getTotalPages();
final int currentPage = pageDTO.getActualPage();
final TextComponent.Builder pagination = Component.text();
if (currentPage > 0) {
pagination.append(Component.text("⏪ ", NamedTextColor.GREEN, TextDecoration.BOLD)
.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND, "/" + this.commandName + " " + (currentPage - 1)))
.hoverEvent(Component.text("Page précédente", NamedTextColor.GRAY)));
}
pagination.append(Component.text("Page ", NamedTextColor.GRAY))
.append(Component.text(currentPage + 1, NamedTextColor.GOLD))
.append(Component.text(" / ", NamedTextColor.GRAY))
.append(Component.text(totalPages, NamedTextColor.GOLD));
if (currentPage < totalPages - 1) {
pagination.append(Component.text(" ⏩", NamedTextColor.GREEN, TextDecoration.BOLD)
.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND, "/" + this.commandName + " " + (currentPage + 1)))
.hoverEvent(Component.text("Page suivante", NamedTextColor.GRAY)));
}
return pagination.build();
}
Are you using a proxy?
Yes ! Velocity with geyser and floodgate, here is the start logs
[09:35:28 INFO]: Booting up Velocity 3.3.0-SNAPSHOT (git-3bce4d85-b374)...
[09:35:28 INFO]: Loading localizations...
[09:35:28 INFO]: Connections will use epoll channels, libdeflate (Linux x86_64) compression, OpenSSL 1.1.x (Linux x86_64) ciphers
[09:35:28 INFO]: Loading plugins...
[09:35:31 WARN] [floodgate]: en_ is not a supported Floodgate language.
[09:35:31 INFO] [floodgate]: Took 130ms to boot Floodgate
[09:35:31 INFO]: Loaded plugin floodgate 2.2.2-SNAPSHOT (b96-7f38765) by GeyserMC
[09:35:31 INFO]: Loaded plugin geyser 2.2.3-SNAPSHOT (git-master-29bd896) by GeyserMC
[09:35:31 INFO] [PacifistaHttpInfos]: Http server loaded on port 25550
[09:35:31 INFO]: Loaded plugin pacifista-main 1.0.0 by Funix [email protected]
[09:35:31 INFO]: Loaded plugin pacifista-survie 1.0.0 by Funix [email protected]
[09:35:31 INFO]: Loaded 4 plugins
[09:35:31 WARN]: The server channel initializer has been replaced by java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[09:35:31 WARN]: The backend channel initializer has been replaced by java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[09:35:31 INFO] [geyser]: Loading extensions...
[09:35:31 INFO] [geyser]: Loaded 0 extension(s)
[09:35:31 INFO] [PacifistaPlugin]: 🔧 Ajout du module SanctionModule...
[09:35:31 INFO] [PacifistaPlugin]: 🔧 Ajout du module PlayersDataModule...
[09:35:31 INFO] [PacifistaPlugin]: 🔧 Ajout du module PermissionsModule...
[09:35:31 INFO] [PacifistaHttpInfos]: Http server started.
[09:35:32 INFO] [PacifistaPlugin]: 🔧 Ajout du module JobsModule...
[09:35:32 INFO] [JobsTasksModule]: Loaded 1 tasks
[09:35:32 INFO] [JobsTasksModule]: Loaded 1 workers
[09:35:32 INFO]: Listening on /[0:0:0:0:0:0:0:0%0]:25565
[09:35:32 INFO] [geyser]: ******************************************
[09:35:32 INFO] [geyser]:
[09:35:32 INFO] [geyser]: Loading Geyser version 2.2.3-SNAPSHOT (git-master-29bd896)
[09:35:32 INFO] [geyser]:
[09:35:32 INFO] [geyser]: ******************************************
[09:35:32 INFO]: Done (3.91s)!
Little precision, the player is kicked only when he clicks on the message event.