your current location:首页 > news>Encountered other MODs and barrage chatting at the same time when installing at the same time, players who cannot be dis

Encountered other MODs and barrage chatting at the same time when installing at the same time, players who cannot be dis

2024-12-10 17:58:26|Myriagame |source:minecraft skins

This tutorial is set by the author to use the CC By-NC-ND protocol.

The reason is that the author received such an issue this afternoon

Soon, the author found that he forgot to upload the latest version to CurseForge

Keke, of course, the main reason for the problem is not this. This tutorial is not to discuss the problem. In short, the new version of the barrage chat (2.0.0 and above) adds the support of regular expressions to the message conversion.We can not need to stick to the content of the message and the format displayed in the chat bar, and directly convert the message that conforms to a certain format to make them into a barrage. The format here can be defined in the configuration file through the regular expression. Let me introduce it belowConfiguration method:

First enter the game and click the MOD button to enter the module list interface. After selecting the barrage to chat, click the configuration button in the lower left corner. After entering the barrage chat configuration interfaceThe file, as shown in the figure below:

After entering the advanced configuration file, we can see five items, of which the first three entries ("Stopwords", "BlockUsers", "Regexp") are sensitive words, shielding users, and shielding regular expression settings for barrage chatting.If there is no relevant needs, you can ignore it.

The content we need to focus on is the following two entries, namely "ChatRegcustomize" and "Tellregcustomize".

Both of them use the custom matching mode defined by regular expression definitions. We only need to modify the string in these two entries to achieve custom analysis function.

Take the ISSUE as an example. After installing MINEMENTION, although the message sent out in the chat bar has not changed, the barrage cannot be displayed normally (Figure);

At this time, we only need

 "^<(?  \ w {3,16})> (? .*$)" 

And save, you can see that the barrage can be rendered normally.

It should be noted that the content located in the small bracket does not require us to do any modification. The content of the first small bracket ("(? \ w {3 ,16})") represents the name of the player.The content of the second small bracket ("(? .*$)") Represents the message sent by it, so in theory, if there are other mods or server plugins, the player's message is changed to a similar form:

Hello, I am Ding Zhen -Dingzhen, who will change it like this!

We can also modify the expression to similar

 "^(? .*$)-(?  \ w {3,16})"

Let's make the barrage chat recognition message and convert it into a barrage (of course, if you really change the probability of 99%, there will be a problem)

It should be noted that some special characters (such as [(), etc.) need to be used in a regular expression. The specific method is to add back slope in front of the corresponding character \ nYou can refer to the rookie tutorial. The characteristics you need to use here are not much, so I won't go into details.

In the end, due to the limitation of the Java Regex library itself, the naming capture group of the same name appears in the same regular expression is not allowed, so if you need to add multiple regular rules

 "^(?: <|) (?  \ w {3,16}) (?:> :) (msg>.*$)"/pre>

In this way, it will capture messages similar to Ciallo! And Player: Ciallo!

However, there will also be messages of Ciallo! Format (but someone really uses this format to format the chat bar news?)Method

Another: This function was produced to adapt to the strange message format of the Teacon server (yes, the message format corresponding to the corresponding expression of the default expression), but appropriate use can achieve many unexpected effects;

For example, it reached a linkage with the live barrage module of 943 (not, how did 943 not updated 1.20.1), and the configuration method in this regard is left to the reader to explore itself.