Zrips / CMI

117 stars 99 forks source link

Chat problem [fixed] #7302

Open EPGMooky opened 2 years ago

EPGMooky commented 2 years ago

Description of Issue

Hi, my chat and chatgroups are not working. It even throws some errores in the console. I'm using bungee and my chat is not working on either server.

Version Information

[13:21:18 INFO]: --------------------------------------------------
[13:21:18 INFO]: CMI: 9.2.4.6 BungeeCord CMIB  SqLite
[13:21:18 INFO]: CMILib: 1.2.3.6 
[13:21:18 INFO]: Server: Purpur 1.19.2-R0.1-SNAPSHOT
[13:21:18 INFO]: CMI economy: Enabled Vault: 1.7.3-CMI CMI Chat: Enabled 
[13:21:18 INFO]: Modules -> 55 enabled 2 disabled: tablist, ranks
[13:21:18 INFO]: --------------------------------------------------

Errors

[13:16:17 ERROR]: Could not pass event AsyncPlayerChatPreviewEvent to CMI v9.2.4.6
java.util.UnknownFormatConversionException: Conversion = 'i'
        at org.bukkit.event.player.AsyncPlayerChatEvent.setFormat(AsyncPlayerChatEvent.java:105) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at com.Zrips.CMI.Modules.ChatFilter.ChatFilterListener1_19.AsyncPlayerChatEvent(ChatFilterListener1_19.java:69) ~[CMI-9.2.4.6.jar:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor709.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:git-Purpur-1819]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:678) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.adventure.ChatDecorationProcessor.post(ChatDecorationProcessor.java:115) ~[purpur-1.19.2.jar:git-Purpur-1819]
        at io.papermc.paper.adventure.ChatDecorationProcessor.processLegacy(ChatDecorationProcessor.java:68) ~[purpur-1.19.2.jar:git-Purpur-1819]
        at io.papermc.paper.adventure.ChatDecorationProcessor.lambda$process$0(ChatDecorationProcessor.java:57) ~[purpur-1.19.2.jar:git-Purpur-1819]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]

Relevant Config Sections

Chat:
  # Will try to modify chat to display it in defined format
  ModifyChatFormat: true
  # When set to true, regular and private messages (excludes clean messages) will have additional information when hovering over it (PlaceHolderAPI supported) and can be clicked for quick reply option
  # To change default hover over messages seen on sent message, go to your locale file to Chat section
  ClickHoverMessages: true
  DiscordSRV:
    # Enables support for DiscordSRV plugin
    Enabled: false
    # Defines name of global chat channel in discordsrv
    GlobalChannel: global
    # Indicator which can be used as {discord} in chat format to indicate that message came from discord and not ingame
    Label: '&2[&7D&2]'
    UnlinkedLabel: '&4[&cD&4]'
  # Enables support for DynMap web chat
  DynMapChat: false
  # When set to false, each time you will use /r you will reply to person you previously sent message directly or to person who sent you message if there is none you have conversion before
  # When this set to true, players with /r will reply to person who last sent private message. This can result in confusion when using /r while getting private messages from multiple players
  ReplyToLastMessenger: false
  # If ReplyToLastMessenger is set to false, then timeOut will be taken into consideration to who you should reply
  # If you had conversation in last 120 seconds (default) then even receiving message from 3rd person, you will still reply to original player
  # If you had conversation in longer then 120 seconds period, then you will reply to latest person who send you a message
  LastMessengerTimeOut: 120
  # When set to true players will need to have cmi.command.msg.[groupname].send where [groupName] is receivers main permission group
  PrivateMessagesGroups: false
  # When set to false, web pge links in a chat will not get shortened to default [LINK] format
  TranslateLink: true
  # Defines regex when replacing url in chat with short word
  # Examples:
  # (https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9]\.[^\s]{2,})
  # ((http|https|ftp|ftps)\:\/\/)?[a-zA-Z0-9\-]+\.[a-zA-Z]{2,3}(\/\S*)?
  # ((http|https|ftp|ftps)\:\/\/)?[a-zA-Z0-9\-]+\.[a-zA-Z]{2,3}(\/\S*)?([^\s]+)
  LinkRegex: (^| )((http|https|ftp|ftps)\:\/\/)?[a-zA-Z0-9\-]+\.[a-zA-Z]{1,3}(\/\S*)?([^\s|^\)]+)
  # When set to true, particular variables in chat will be translated into items player are holding. List of variables belove
  HoverItems: true
  # Defines regex when replacing item line in chat with players item in hand information. Only works when CMI hover over chat format is enabled
  ItemRegex:
  - (\%item\%)
  - (\[item\])
  - (\%i\%)
  # Attention! This will require you to have CMI Bungee plugin which can be found at zrips.net
  # Or direct download https://www.zrips.net/cmi/
  # Do you want to enable private messaging over bungeecord
  BungeeMessages: true
  # Do you want to enable public messaging over bungeecord
  # Player needs to have cmi.bungee.publicmessages.[servername] permission node to be able to send messages to target server
  BungeePublicMessages: true
  # Do you want to enable staff messaging over bungeecord
  BungeeStaffMessages: true
  # Used for simple chat messages. Optional variables: {displayName} {world} {prefix} {suffix} {group} {shout} {message}. Supporting PlaceHolderAPI variables like %player_server%

  # ATTENTION! Dont use gradient colors for {message} variable, if you want to apply gradient for it, utilize GeneralMessageFormat section
  GeneralFormat: '{prefix}&f{displayName} &8&l» &r{message}'
  # Will define message format itself, this allows to have gradients in messages
  # It NEEDS to contain {message} otherwise we will ignore this setup
  # For 1.16+ servers you can use color gradients like '{#b3a28f>}{message}{#d7b8e6<}'
  # You can have more than 2 colors in gradient. To define it repeat {message} variable. For example '{#b3a28f>}{message}{#5c6999<>}{message}{#d7b8e6<}'
  GeneralMessageFormat: '{message}'
  # Defines range of regular messages to travel
  # Set to -1 to disable range restriction
  GeneralRange: -1
  # Defines range of shout messages to travel
  # Shout messages should start with ! and player should have cmi.chat.shout permission
  # GeneralRange should be enabled
  # set to 0 to shout across all worlds, -1 to disable
  ShoutRange: 200
  # Defines cost for each shout message
  ShoutCost: 0
  # Prefix used to indicate that message should be sent to public chat instead of current players chat room
  # Set it to empty field if you want this feature to be disabled
  ChatRoomShout: '!'
  # Time in seconds you want to keep chat rooms alive before removing them
  # This only applies to empty rooms after last user leaves it
  ChatRoomLife: 3600
  # Defines suggested commands when you click on public, private and similar messages. [playerName], [playerDisplayName] and [playerNickName]  can be used to include players name
  ClickSuggestions:
    pubmsg: '/msg [playerNickName] '
    privmsg: '/msg [playerNickName] '
    staffmsg: '/msg [playerNickName] '
    helpop: '/msg [playerNickName] '
    chatroom: '/msg [playerNickName] '
    discord: '/msg [playerNickName] '
  # Use numeric increments to separate groups from each other. If player has more than one, then line with higher number will be used
  # Add as many lines as you need too
  # cmi.chatgroup.[id] permnission node to use
  # Permission example: cmi.chatgroup.2

  # ATTENTION! Dont use gradient colors for {message} variable, if you want to apply gradient for it, utilize GroupMessageFormat section
  GroupFormat:
    '1': '{prefix}&f{displayName} &8&l» &r{message}'
    '2': '{prefix}&f{displayName} &8&l» &r{message}'
    '3': '{prefix}&f{displayName} &8&l» &r{message}'
  # Use numeric increments to separate groups from each other. If player has more than one, then line with higher number will be used
  # Add as many lines as you need too
  # cmi.chatmessagegroup.[id] permnission node to use
  # Permission example: cmi.chatmessagegroup.2
  GroupMessageFormat:
    '1': '{message}'
    '2': '{message}'
    '3': '{message}'

ChatFilter:
  Enabled: false
  Deny:
    ipBlock:
      # If not set to true, this filter will not be used
      Enabled: true
      # Defines filter group and defines required permission node to bypass this filter: cmi.chatfilter.bypass.[groupName]
      Group: Advertising
      # When set to true, each time player triggers filter, console will receive information about who triggered it, which filter and with what message
      InformConsole: true
      # Regex expression to filter by. How to use regex https://regexone.com/
      Regex:
      - '[a-zA-Z0-9\-\.]+\s?(\.|dot|\(dot\)|-|;|:|,|_|\/)\s?([a-zA-Z]{2}|aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel)\b'
      - \b[0-9]{1,3}(\.|dot|\(dot\)|-|;|:|,|(\W|\d|_)*\s)+[0-9]{1,3}(\.|dot|\(dot\)|-|;|:|,|(\W|\d|_)*\s)+[0-9]{1,3}(\.|dot|\(dot\)|-|;|:|,|(\W|\d|_)*\s)+[0-9]{1,3}\b
      # With what we need to replace word, if not defined found expression will not be changed
      ReplaceWith: ''
      # possible: none, others, all
      # Where 'none' means everyone will receive this message
      # 'others' means that sender will get message but not other players, this is usefull to prevent advertising and silently block it
      # 'all' means that no one will receive sent message
      BlockType: others
      # When enabled rule will be applied to private messages
      includePrivateMessages: true
      # Players with cmi.chatfilter.inform permission will receive defined message when rule is broken
      msgToStaff: '&4!&6[playerName] &4advertising with: &r[message]'
      # List of commands to perform when rule is broken. Use [senderName] to include message sender name. Supports global variables same as locale file
      # Use [message] to include original players message
      # Use [updatedmessage] to include new modified message
      Commands: []
    swearing1:
      Enabled: true
      Group: Swearing
      InformConsole: true
      Regex:
      - \bass\b|\basshole
      ReplaceWith: dude
      BlockType: none
      includePrivateMessages: true
      msgToStaff: '&4!&6[playerName] &4swearing'
      Commands:
      - msg [senderName] &eDon't swear!
    swearing2:
      Enabled: true
      Group: Swearing
      InformConsole: true
      Regex:
      - \b(?i)(f+(\W|_)*(u?)+(\W|_)*(c?)+(\W|_)*k+)
      ReplaceWith: not good
      BlockType: none
      includePrivateMessages: true
      msgToStaff: '&4!&6[playerName] &4swearing'
      Commands:
      - msg [senderName] &eDon't swear!
  # List of regex filter to exlude from block list. Usefull if you want to block all ip/host address but want to allow usage of your own server.
  WhiteList:
  - \bgoogle.\s?([a-zA-Z]{2,4})\b
  - \bspigotmc.\s?([a-zA-Z]{2,4})\b
  DuplicatedMessagePrevention:
    # When set to true, plugin will prevent spaming of same or similar messages in short time range. Can be bypased with cmi.chatfilter.spambypass permission
    Use: false
    # How much in percentage message is counted as same
    Percentage: 80
    # Defines how often in seconds you can send same/similar message
    Interval: 5
    # How many commands you can repeat before stopped for cooldown
    MinAmount: 2
  Caps:
    # When nebaled we will try to prevent chat messages with multiple capitalized letters by defined criteria
    # Can be bypassed with cmi.chatfilter.capbypass permission node
    Filter: true
    # Defines amount of letters we can ignore
    # For example ':DDD' would be made of 2 letters with 3 capitalized letters which would make it 75% capitalized
    IgnoreUnder: 6
    # Amount in percentage of capitalized letters we should not cross over.
    # In example 'GOOD thing' would be 4 capitalized and 5 not, spaces gets ignored, whic makes it 44% capitalized and passes check
    Percentage: 50
    # List of commands you want to perform when player uses too many caps
    Commands:
    - asConsole! cmi titlemsg [playerName] &cToo many caps! -keep:20
    # List of messages, excluding color codes, player can use even if it 100% capitalized
    WhiteList:
    - AFAIK
    - AFK
    - BRB
    - IMHO
    - OMG
    - ROFL
    - ROFLMAO
    - LQTM
    - LSMH
    - LMHO

Relevant Plugins

Vault 1.7.3

Agreements

mrfloris commented 2 years ago

I see chatfilter, so I presume this might be due to the regex in the [link] thingy;

LinkRegex: (www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)

try setting it to this, bit more taxing, but let's see if that resolves it for you?

Maybe I'm reading the error msg wrong, but lets try

If that didn't do it, then backup your chatfilter.yml and remove it - start the server and see if that fixes it.

Otherwise it's perhaps group formatting or a bug, I can't quite tel..

EPGMooky commented 2 years ago

I have chatfilter disabled thats the thing. My chat still dont work.

Zrips commented 2 years ago

@EPGMooky You might want to test this without any other plugin enabled just to make sure that there arent issue with another plugin incorrectly modifying chat messages which causes this problem. Can't reproduce your issue with your config file at the moment.

EPGMooky commented 2 years ago

[15:58:36 ERROR]: Could not pass event AsyncPlayerChatPreviewEvent to CMI v9.2.5.4 java.util.UnknownFormatConversionException: Conversion = 'i' at org.bukkit.event.player.AsyncPlayerChatEvent.setFormat(AsyncPlayerChatEvent.java:105) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?] at com.Zrips.CMI.Modules.ChatFilter.ChatFilterListener1_19.AsyncPlayerChatEvent(ChatFilterListener1_19.java:67) ~[CMI-9.2.5.4.jar:?] at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor424.execute(Unknown Source) ~[?:?] at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:git-Purpur-1857] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:678) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?] at io.papermc.paper.adventure.ChatDecorationProcessor.post(ChatDecorationProcessor.java:115) ~[purpur-1.19.2.jar:git-Purpur-1857] at io.papermc.paper.adventure.ChatDecorationProcessor.processLegacy(ChatDecorationProcessor.java:68) ~[purpur-1.19.2.jar:git-Purpur-1857] at io.papermc.paper.adventure.ChatDecorationProcessor.lambda$process$0(ChatDecorationProcessor.java:57) ~[purpur-1.19.2.jar:git-Purpur-1857] at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?] at java.lang.Thread.run(Thread.java:833) ~[?:?] [15:58:36 ERROR]: Could not pass event AsyncPlayerChatEvent to CMI v9.2.5.4 java.util.UnknownFormatConversionException: Conversion = 'i' at org.bukkit.event.player.AsyncPlayerChatEvent.setFormat(AsyncPlayerChatEvent.java:105) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?] at com.Zrips.CMI.Modules.ChatFormat.ChatFormatListener.AsyncPlayerChatEvent(ChatFormatListener.java:191) ~[CMI-9.2.5.4.jar:?] at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor410.execute(Unknown Source) ~[?:?] at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:git-Purpur-1857] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:678) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?] at io.papermc.paper.adventure.ChatProcessor.post(ChatProcessor.java:381) ~[purpur-1.19.2.jar:git-Purpur-1857] at io.papermc.paper.adventure.ChatProcessor.process(ChatProcessor.java:96) ~[purpur-1.19.2.jar:git-Purpur-1857] at net.minecraft.server.network.ServerGamePacketListenerImpl.chat(ServerGamePacketListenerImpl.java:2496) ~[?:?] at net.minecraft.server.network.ServerGamePacketListenerImpl.broadcastChatMessage(ServerGamePacketListenerImpl.java:2681) ~[?:?] at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChat$18(ServerGamePacketListenerImpl.java:2321) ~[?:?] at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?] at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?] at java.lang.Thread.run(Thread.java:833) ~[?:?]

EPGMooky commented 2 years ago

Tested only with Luckperms, Vault, PlaceholderAPi, CMI-9.2.5.4 and cmilib1.2.3.7 Current: git-Purpur-1857 (MC: 1.19.2)*

EPGMooky commented 2 years ago

Lookslike luckperms caused that problem--edit---> placeholder in prefix caused that

EPGMooky commented 2 years ago

Thanks for your time!