AdvancedPlugins / Chat

The Best Chat Plugin for Spigot Servers, including AI chat monitoring, endless formatting capabilities, custom commands and way more
3 stars 2 forks source link

Cannot type emoji's in chat, for example items adder ranks. #87

Closed Ricozaur closed 2 weeks ago

Ricozaur commented 1 month ago

Describe the bug

Cannot type emoji's in chat, for example items adder ranks. "/iaemoji :amythyst_icon:"

results in:

https://mclo.gs/GtGqWL3

How to reproduce

Try such emoji's in chat

Screenshots / Videos

https://mclo.gs/GtGqWL3

Server Log

No response

ThomasWega commented 3 weeks ago

what is the /e command doing?

Ricozaur commented 3 weeks ago

It works, but when you type an emoji, the message won't be sent and an error is shown in the console.

ThomasWega commented 3 weeks ago

I've asked what the command does...

Ricozaur commented 3 weeks ago

It pastes a custom itemsadder IMG in chat using symbols /e = /emoji

ThomasWega commented 2 weeks ago

Would it be possible for you to get the developer of ItemsAdder here to explain what exactly the /e command does? It seems to be running async even synchronously

ThomasWega commented 2 weeks ago

@LoneDev6

ThomasWega commented 2 weeks ago

We could also just cancel the event if it's not async and should be. Not sure how to approach this or what even causes this honestly

LoneDev6 commented 2 weeks ago

Contact the author of AdvancedChat and ask them to trigger their AsyncPlayerChatEvent event synchronously, it's not something caused by my plugin directly.

        at net.advancedplugins.chat.listeners.ChatListener.onChat(ChatListener.java:101) ~[AdvancedChat-1.2.0.jar:?]
        at net.advancedplugins.chat.Core.lambda$registerChatListener$2(Core.java:431) ~[AdvancedChat-1.2.0.jar:?]
LoneDev6 commented 2 weeks ago
package dev.lone.itemsadder.commands;

import dev.lone.itemsadder.Core.Core;
import dev.lone.itemsadder.Main;
import dev.lone.itemsadder.Permissions;
import org.jetbrains.annotations.NotNull;
import dev.lone.itemsadder.utils.Msg;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class IAImage extends ItemsAdderCommand
{
    public IAImage()
    {
        Main.getCmd("iaimage").setExecutor(this);
    }

    @Override
    public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] args)
    {
        if (!checkIfCoreIsLoaded(commandSender, command))
            return true;

        if (!(commandSender instanceof Player))
        {
            Msg.warn(Main.lang.getLocalized("command-ingame-only"));
            return true;
        }

        Player player = (Player) commandSender;

        if (!Permissions.checkPermission(player, Permissions.IMAGE_GUI))
            return true;

        if (args.length == 0)
            Core.inst().fontImagesBookGui.showBookGui(player);
        else
        {
            // Fix for kick "Illegal characters in chat" https://github.com/PluginBugs/Issues-ItemsAdder/issues/1975
            // player.chat() function can't be used to send colored messages, only pure characters.
            String msg =
                    ChatColor.stripColor(
                            String.join(" ", args)
                    );
            //WARNING! player.chat() doesn't trigger the packet listener because it's called by the server itself
            // to simulate player messages. It triggers AsyncPlayerChatEvent although.
            player.chat(msg);
        }

        return true;
    }
}
ThomasWega commented 2 weeks ago

Honestly I am surprised about Async event being sync, but sure. Just confused me for a bit. Thank you for the explanation @LoneDev6 . Will be fixed next update