File tree 1 file changed +4
-7
lines changed
src/main/java/com/lx862/svrutil/feature
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import com .google .gson .JsonElement ;
4
4
import com .google .gson .JsonObject ;
5
+ import eu .pb4 .placeholders .api .TextParserUtils ;
5
6
import net .minecraft .text .Text ;
6
7
7
8
public class TextOverrideFeature extends Feature {
@@ -17,12 +18,12 @@ public void readConfig(JsonObject jsonObject) {
17
18
if (jsonObject .has ("whitelistedMessage" )) {
18
19
JsonElement element = jsonObject .get ("whitelistedMessage" );
19
20
try {
20
- whitelistedMessage = Text .Serializer .fromJson (element . getAsString () );
21
+ whitelistedMessage = Text .Serializer .fromJson (element );
21
22
} catch (Exception ignored ) {
22
23
}
23
24
24
25
try {
25
- whitelistedMessage = Text . Serializer . fromJson (element );
26
+ whitelistedMessage = TextParserUtils . formatText (element . getAsString () );
26
27
} catch (Exception ignored ) {
27
28
}
28
29
}
@@ -31,11 +32,7 @@ public void readConfig(JsonObject jsonObject) {
31
32
@ Override
32
33
public JsonObject generateConfig () {
33
34
JsonObject jsonObject = super .generateConfig ();
34
- if (whitelistedMessage == null ) {
35
- jsonObject .addProperty ("whitelistedMessage" , "You are not whitelisted on the server." );
36
- } else {
37
- jsonObject .addProperty ("whitelistedMessage" , Text .Serializer .toJson (whitelistedMessage ));
38
- }
35
+ jsonObject .addProperty ("whitelistedMessage" , "You are not whitelisted on the server." );
39
36
return jsonObject ;
40
37
}
41
38
You can’t perform that action at this time.
0 commit comments