Eufranio / MagiBridge

A Discord <-> Minecraft chat relay plugin
MIT License
47 stars 27 forks source link

Could not pass MessageChannelEvent$Chat$Impl #113

Closed sfxworks closed 5 years ago

sfxworks commented 5 years ago
[03:28:35] [Server thread/ERROR] [Sponge]: Could not pass MessageChannelEvent$Chat$Impl to Plugin{id=magibridge, name=MagiBridge, version=2.5, description=A utility Discord <-> Minecraft chat relay plugin, source=/home/lapitos/server/./mods/plugins/MagiBridge-API7-2.5.jar}

This occurs when someone sends a chat from Minecraft to discord. Unable to make this work using sponge 1.12.2-2768-7.1.4 and 1.12.2-2705 for MagiBridge 2.5.

The same error occurs with your version marked for sponge v7

[03:34:35] [Server thread/ERROR] [Sponge]: Could not pass MessageChannelEvent$Chat$Impl to Plugin{id=magibridge, name=MagiBridge, version=2.4.5.1, description=A utility Discord <-> Minecraft chat relay plugin, authors=[Eufranio], source=/home/lapitos/server/./mods/plugins/MagiBridge-API7-2.4.5.1.jar}
        at com.magitechserver.magibridge.DiscordHandler.sendMessageToDiscord(DiscordHandler.java:102) ~[DiscordHandler.class:?]
        at com.magitechserver.magibridge.DiscordHandler.sendMessageToDiscord(DiscordHandler.java:108) ~[DiscordHandler.class:?]
        at com.magitechserver.magibridge.listeners.SpongeChatListener.onSpongeMessage(SpongeChatListener.java:56) ~[SpongeChatListener.class:?]

Here is my config, save the token.

# MagiBridge, by Eufranio
# 
# You can use the following placeholders on the DISCORD -> MC formats:
#     %user% -> user who sent the message in the Discord channel
#     %message% -> message that was sent to the channel
#     %toprole% -> name of the highest role/rank of the user in the Discord server
#     %toprolecolor% -> color of the user's role, according to the replacer at the bottom of this config
# 
# You can use the following placeholder on the MC -> DISCORD formats:
#     %player% -> player who sent the message in the chat channel
#     %prefix% -> prefix of the player that sent the message. Usually set via permission plugins
#     %topgroup% -> name of the highest group of the player who sent the message
#     %nick% -> nickname of the player. If no nick is assigned to the player, his name will be used instead
#     %message% -> message that the player sent

channel {
    # Role that users need to have to be able to send colored chat to minecraft
    # Set to "everyone" to allow everyone use colors in the messages
    color-allowed-role=vip
    # If a command is defined here, it will ONLY run if the user has the defined role.
    # In this example, ONLY who have the admin role can stop the server
    # Set the role to "everyone" to allow everyone use the command
    commands-role-override {
        ban=mod
        stop=admin
    }
    # Discord command that executes server console commands
    console-command="!cmd"
    # Role that a user needs to have in order to run the console command
    console-command-required-role=admin
    # Should MagiBridge delete the player list message?
    delete-list-message=true
    # ID of the main Discord Channel, where start/stop messages will be sent to
    main-discord-channel="374625266925830144"
    # IGNORE IF USING ULTIMATECHAT!
    nucleus {
        # Discord Channel ID which global messages are sent to
        global-discord-channel="374625266925830144"
        # Channel that HelpOp messages will be sent to (if enabled)
        helpop-channel="511079880465842188"
        # Discord Channel ID which messages from the staff chat are sent to
        staff-discord-channel="429329932066488320"
    }
    # Discord command that shows the current online player list
    player-list-command="!online"
    # IGNORE IF USING NUCLEUS!
    ultimatechat {
        # Channels defined here override the global format, so you can have per-channel formats
        channel-overrides {
            global="&7[&a&lG&7] &f%user%&7: %message%"
        }
        # Format: ChannelID = IngameChannelName, Example:
        # 12345678912345 = global
        # Replace the default value with your own channels
        channels {
            "12345678912345"=global
        }
    }
    # Should MagiBridge use Nucleus? If this and use-ultimatechat are both false, MagiBridge will use the vanilla chat system
    use-nucleus=true
    # Should MagiBridge use UltimateChat instead? If this and use-nucleus are both false, MagiBridge will use the vanilla chat system
    use-ultimatechat=false
    # Should MagiBridge send messages trough Webhooks instead a bot?
    use-webhooks=false
}
colors-converter {
    # Conversor from RGB to in-game colors (for %toprolecolor%)
    # Format: "RGB" = "IN-GAME COLOR"
    discord-to-mc-replacer {
        "206694"="&1"
        "11806A"="&2"
        "1ABC9C"="&a"
        "1F8B4C"="&2"
        "2ECC71"="&a"
        "3498DB"="&3"
        "546E7A"="&8"
        "607D8B"="&8"
        "71368A"="&5"
        "95A5A6"="&7"
        "979C9F"="&7"
        "992D22"="&4"
        "99AAB5"="&f"
        "9B59B6"="&5"
        A84300="&6"
        AD1457="&d"
        C27C0E="&6"
        E67E22="&6"
        E74C3C="&c"
        E91E63="&d"
        F1C40F="&e"
    }
}
core {
    # Should MagiBridge send advancement messages to Discord?
    advancement-messages-enabled=true
    # Bot Token of the Bot User that you want to be used when sending messages to Discord
    bot-token="----------------------"
    # Set to false if MagiBridge should NOT cut messages coming from Discord with more than
    # 120 characters. This can turn the chat ugly if someone sends a big message
    cut-messages=false
    # Should MagiBridge send death messages to Discord?
    death-messages-enabled=true
    # Should MagiBridge enable the Topic Updater, updating the topic of the main Discord channel?
    enable-topic-updater=true
    # Don't send messages of a player to Discord if he is vanished
    hide-vanished-chat=false
    # Should MagiBridge send Nucleus' HelpOp messages to Discord? The channel that the messages will be sent
    # SHOULD be defined in the Channels section if this is enabled!
    send-helpop=true
    # Topic Updater interval in seconds, minimum is 10
    topic-updater-interval=10
    # Should MagiBridge enable Boop support? Will only work if Boop is installed and updated
    use-boop=false
}
discord-to-mc-replacer {
    # Text that will be replaced in messages sent TO the game
    # Format: "word-to-replace" = "word-replaced"
    discord-to-mc-replacer {
        ":dizzy_face:"=xO
        ":frowning:"=":("
        ":heart:"="<3"
        ":joy:"=";D"
        ":kissing:"=":*"
        ":laughing:"=xD
        ":neutral_face:"=":|"
        ":open_mouth:"=":O"
        ":smile:"=":D"
        ":smiley:"=":)"
        ":sob:"=";("
        ":stuck_out_tongue:"=":P"
        ":stuck_out_tongue_closed_eyes:"=xP
        ":stuck_out_tongue_winking_eye:"=";P"
        ":sunglasses:"="B)"
        ":tired_face:"="x("
        ":wink:"=";)"
    }
}
messages {
    # Message that will be sent to the main discord channel when a player receives an advancement
    # Supports %advancement%
    advancement-message="**%player% got a new advancement: %advancement%**"
    # Messages sent to Discord when a player goes/retuns AFK, if enabled
    afk {
        enabled=false
        # Message sent when a player goes AFK
        going="%player% is now AFK"
        # Message sent when a player is not AFK anymore
        returning="%player% is not AFK anymore"
    }
    # Name of the attachment tag shown in-game when someone sends an attachment to the Discord channel
    attachment-name="[Attachment]"
    # Game that will be displayed in the bot's game status
    bot-playing-status="Playing on a nice server!"
    # Message that will be set in the main discord channel topic every X seconds
    # Supports %tps%, %players%, %maxplayers%, %hoursonline% and %minutesonline%
    channel-topic-message="%players%/%maxplayers% players online | TPS: %tps% | Server online for %hoursonline% hours or %minutesonline% minutes!"
    # Message that will be set in the main discord channel topic when the server goes offline
    channel-topic-offline="The server is currently offline!"
    # No permission message (for console command)
    console-command-no-permisson="**You don't have permission to use this command!**"
    # Message that will be sent to the main discord channel when a player dies
    death-message="**Bad day for %player%: %deathmessage%**"
    # Format of the messsage sent from Discord to the server
    discord-to-server-format="&f%user%&7: &7%message%"
    # Format of the messages sent from the Discord Staff channel to the server
    # Node: This format is used ONLY when using the Nucleus hook!
    discord-to-server-staff-format="&f%user%&7: &7%message%"
    # Message that will be sent to the main discord channel when a new player joins the server
    new-players-message="**Enjoy playing on our server, %player%!**"
    # Message shown when there are no players in the server 
    # and the list command is executed
    no-players-message="**There are no players online!**"
    # Text that will be used in %toprole% when the user don't have any roles (besides @everyone)
    # Use only if you need. If you don't, leave this option as ""
    no-role-placeholder=""
    # Message that will be sent to the discord-main-channel when a player joins the server
    player-join-message="**%player%** joined the server"
    # Format of the player name displayed in the channel list command (!online)
    player-list-name="%player%"
    # Message that will be sent to the discord-main-channel when a player leaves the server
    player-quit-message="**Bye, %player%!**"
    # Prefix that will be sent before the actual message, with a hover and clickable link
    prefix {
        enabled=true
        hover="&bClick do join our Discord!"
        link="https://github.com/Eufranio/MagiBridge"
        text="&6[Discord]"
    }
    # Message that will be sent to the discord-main-channel when the server starts
    server-starting-message="**The server is starting!**"
    # Message that will be sent to the discord-main-channel when the server stops
    server-stopping-message="**The server is stopping!**"
    # Format of messages sent FROM the server TO discord
    server-to-discord-format="**%player%**: %message%"
    # Format of messages sent FROM the server staff channel TO the discord staff channel
    # Used only when Nucleus is running and enabled
    server-to-discord-staff-format="**%player%**: %message%"
    # Format of the name of the webhooks that will send messages to Discord, if enabled
    webhook-name="[%prefix%] %player%"
    # URL that webhooks should get the skin picture from
    # Note: the link SHOULD return a valid .png picture from the request!
    # Supports %player%
    webhook-picture-url="https://crafatar.com/avatars/%uuid%?default=MHF_Alex"
}
Eufranio commented 5 years ago

Post the rest of the error when using the 2.5 build please. You only posted the first line.

sfxworks commented 5 years ago

Here is the full stack trace associated with this error.

[17:43:11] [Server thread/ERROR] [Sponge]: Could not pass MessageChannelEvent$Chat$Impl to Plugin{id=magibridge, name=MagiBridge, version=2.4.5.1, description=A utility Discord <-> Minecraft chat relay plugin, authors=[Eufranio], source=/home/lapitos/server/./mods/plugins/MagiBridge-API7-2.4.5.1.jar}
net.dv8tion.jda.core.exceptions.InsufficientPermissionException: Cannot perform action due to a lack of Permission. Missing permission: MESSAGE_WRITE
    at net.dv8tion.jda.core.entities.impl.AbstractChannelImpl.checkPermission(AbstractChannelImpl.java:306) ~[AbstractChannelImpl.class:?]
    at net.dv8tion.jda.core.entities.impl.AbstractChannelImpl.checkPermission(AbstractChannelImpl.java:298) ~[AbstractChannelImpl.class:?]
    at net.dv8tion.jda.core.entities.impl.TextChannelImpl.sendMessage(TextChannelImpl.java:265) ~[TextChannelImpl.class:?]
    at com.magitechserver.magibridge.DiscordHandler.sendMessageToDiscord(DiscordHandler.java:102) ~[DiscordHandler.class:?]
    at com.magitechserver.magibridge.DiscordHandler.sendMessageToDiscord(DiscordHandler.java:108) ~[DiscordHandler.class:?]
    at com.magitechserver.magibridge.listeners.SpongeChatListener.onSpongeMessage(SpongeChatListener.java:56) ~[SpongeChatListener.class:?]
    at org.spongepowered.common.event.listener.ChatListener_SpongeChatListener_onSpongeMessage346.handle(Unknown Source) ~[?:?]
    at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:95) ~[RegisteredListener.class:1.12.2-2768-7.1.4]
    at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:383) [SpongeModEventManager.class:1.12.2-2768-7.1.4]
    at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:347) [SpongeModEventManager.class:1.12.2-2768-7.1.4]
    at org.spongepowered.mod.event.SpongeModEventManager.extendedPost(SpongeModEventManager.java:435) [SpongeModEventManager.class:1.12.2-2768-7.1.4]
    at net.minecraftforge.common.ForgeHooks.onServerChatEvent(ForgeHooks.java:1766) [ForgeHooks.class:?]
    at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:942) [pa.class:?]
    at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(SourceFile:37) [la.class:?]
    at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(SourceFile:9) [la.class:?]
    at org.spongepowered.common.event.tracking.phase.packet.PacketPhaseUtil.onProcessPacket(PacketPhaseUtil.java:193) [PacketPhaseUtil.class:1.12.2-2768-7.1.4]
    at net.minecraft.network.PacketThreadUtil$1.redirect$onProcessPacket$zlg000(SourceFile:539) [hv$1.class:?]
    at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [hv$1.class:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_191]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_191]
    at net.minecraft.util.Util.func_181617_a(SourceFile:46) [h.class:?]
    at org.spongepowered.common.SpongeImplHooks.onUtilRunTask(SpongeImplHooks.java:294) [SpongeImplHooks.class:1.12.2-2768-7.1.4]
    at net.minecraft.server.MinecraftServer.redirect$onRun$zjk000(MinecraftServer.java:3970) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:723) [MinecraftServer.class:?]
    at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:396) [nz.class:?]
    at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]

net.dv8tion.jda.core.exceptions.InsufficientPermissionException: Cannot perform action due to a lack of Permission. Missing permission: MESSAGE_WRITE

If this is assocaited with the discord bot, the bot was set have the "Send Message" permission after joinig the discord. I confirmed this by removing the bot from discord and readding the bot with a permissions integer of 523328

sfxworks commented 5 years ago

After granting channel overrides, this was repaired. It was not immediately noticed.

Eufranio commented 5 years ago

Cannot perform action due to a lack of Permission. Missing permission: MESSAGE_WRITE The error is self explanatory.