Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat message validation failure #212

Open
FunixG opened this issue Apr 8, 2024 · 5 comments
Open

Chat message validation failure #212

FunixG opened this issue Apr 8, 2024 · 5 comments
Labels
status: needs triage type: bug Something doesn't work as it was intended to. version: 1.20.4 Game version 1.20.4

Comments

@FunixG
Copy link

FunixG commented Apr 8, 2024

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();
    }
@FunixG FunixG added status: needs triage type: bug Something doesn't work as it was intended to. labels Apr 8, 2024
@electronicboy
Copy link
Member

Are you using a proxy?

@FunixG
Copy link
Author

FunixG commented Apr 8, 2024

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 contact@funixproductions.com
[09:35:31 INFO]: Loaded plugin pacifista-survie 1.0.0 by Funix contact@funixproductions.com
[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)!

@FunixG
Copy link
Author

FunixG commented Apr 10, 2024

Little precision, the player is kicked only when he clicks on the message event.

@kashike kashike added the version: 1.20.4 Game version 1.20.4 label Apr 29, 2024
@Spottedleaf
Copy link
Member

Does this still happen on 1.21.3?

@FunixG
Copy link
Author

FunixG commented Dec 4, 2024

Will try that soon !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage type: bug Something doesn't work as it was intended to. version: 1.20.4 Game version 1.20.4
Projects
None yet
Development

No branches or pull requests

4 participants