Change the way feature flags are working because using settings was a bad idea (and bump version to 2.0.0 since it's an API change)

This commit is contained in:
Oliver-Akins 2024-09-29 00:09:30 -06:00
parent e0f6b2a8e1
commit 4584b1a7a5
7 changed files with 11 additions and 40 deletions

View file

@ -1,5 +1,3 @@
import { FEATURE_FLAGS } from "../consts.mjs";
Hooks.on(`renderChatMessage`, (msg, html) => {
// Short-Circuit when the flag isn't set for the message
@ -7,13 +5,12 @@ Hooks.on(`renderChatMessage`, (msg, html) => {
return;
}
const featureFlags = game.settings.get(game.system.id, `flags`);
const featureFlagEnabled = featureFlags.includes(FEATURE_FLAGS.ROLLMODECONTENT);
const featureFlagEnabled = taf.FEATURES.ROLL_MODE_CONTENT;
const contentElement = html.find(`.message-content`)[0];
let content = contentElement.innerHTML;
if (featureFlagEnabled && msg.blind && !game.user.isGM) {
content = content.replace(/-=.*?=-/gm, `???`);
content = content.replace(/-=.*?=-/gm, `??`);
} else {
content = content.replace(/-=|=-/gm, ``);
}