You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an anti-caps feature in my plugin and I am looking to know what is the best practice to replace excessive caps in an Adventure component.
Current code (chatMessage is a legacy string):
finalString[] words = chatMessage.split(" ");
booleancapsAllowed = false;
booleanwhitelisted = false;
for (inti = 0; i < words.length; i++) {
finalStringword = words[i];
// Some logic code hereif (!whitelisted) {
if (!capsAllowed) {
finalcharfirstChar = word.charAt(0);
words[i] = firstChar + word.toLowerCase().substring(1);
} elsewords[i] = word.toLowerCase();
capsAllowed = !words[i].endsWith(".") && !words[i].endsWith("!") && !words[i].endsWith("?");
}
whitelisted = false;
}
// I need to set the component here.String.join(" ", words);
My current solution involves converting the component to legacy and then back which destroys hover/click events and to my knowledge has a unnecessarily performance hit.
Any advice would be greatly appreciated!
Matej
The text was updated successfully, but these errors were encountered:
kangarko
changed the title
Best practices in regex matching
Best practices in regex matching and editing the entire component content
Jul 13, 2024
I have an anti-caps feature in my plugin and I am looking to know what is the best practice to replace excessive caps in an Adventure component.
Current code (chatMessage is a legacy string):
My current solution involves converting the component to legacy and then back which destroys hover/click events and to my knowledge has a unnecessarily performance hit.
Any advice would be greatly appreciated!
Matej
The text was updated successfully, but these errors were encountered: