File tree Expand file tree Collapse file tree
paper/src/main/java/io/wdsj/asw/bukkit/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66@ SuppressWarnings ("unused" )
77public final class AdvancedSensitiveWordsApi {
88 private static final ShadowBanApi SHADOW_BAN_API = new ShadowBanApi ();
9+ private static final CoreApi CORE_API = new CoreApi ();
910
1011 private AdvancedSensitiveWordsApi () {
1112 }
@@ -18,4 +19,13 @@ private AdvancedSensitiveWordsApi() {
1819 public static ShadowBanApi shadowBan () {
1920 return SHADOW_BAN_API ;
2021 }
22+
23+ /**
24+ * Get the core API.
25+ *
26+ * @return core API
27+ */
28+ public static CoreApi core () {
29+ return CORE_API ;
30+ }
2131}
Original file line number Diff line number Diff line change 1+ package io .wdsj .asw .bukkit .api ;
2+
3+ import io .wdsj .asw .bukkit .AdvancedSensitiveWords ;
4+
5+ import java .util .List ;
6+
7+ @ SuppressWarnings ("unused" )
8+ public final class CoreApi {
9+ CoreApi () {
10+ }
11+
12+ /**
13+ * Returns whether the plugin is initialized.
14+ *
15+ * @return true if the plugin is initialized, false otherwise
16+ */
17+ public boolean isInitialized () {
18+ return AdvancedSensitiveWords .isInitialized ;
19+ }
20+
21+ /**
22+ * Finds all sensitive words in the given text.
23+ * <p>
24+ * <b>Warning:</b> This method should be called after checking initialization state.
25+ *
26+ * @param text the text to search for sensitive words
27+ * @return a list of sensitive words found in the text
28+ * @see #isInitialized()
29+ */
30+ public List <String > findSensitiveWords (String text ) {
31+ return AdvancedSensitiveWords .sensitiveWordBs .findAll (text );
32+ }
33+
34+ /**
35+ * Replaces all sensitive words in the given text.
36+ * <p>
37+ * <b>Warning:</b> This method should be called after checking initialization state.
38+ *
39+ * @param text the text to replace sensitive words in
40+ * @return the text with sensitive words replaced
41+ * @see #isInitialized()
42+ */
43+ public String replaceSensitiveWords (String text ) {
44+ return AdvancedSensitiveWords .sensitiveWordBs .replace (text );
45+ }
46+ }
You can’t perform that action at this time.
0 commit comments