1
1
package dev .jorel .commandapi .config ;
2
2
3
+ import org .jetbrains .annotations .ApiStatus ;
4
+
3
5
import java .util .ArrayList ;
4
6
import java .util .List ;
7
+ import java .util .Map ;
5
8
6
9
/**
7
10
* Default config values for the plugin's config.yml file
8
11
*/
9
- class DefaultedBukkitConfig {
12
+ @ SuppressWarnings ("ClassEscapesDefinedScope" )
13
+ @ ApiStatus .Internal
14
+ public class DefaultedBukkitConfig {
10
15
11
16
public static final CommentedConfigOption <Boolean > VERBOSE_OUTPUTS = new CommentedConfigOption <>(
12
17
List .of (
13
18
"Verbose outputs (default: false)" ,
14
19
"If \" true\" , outputs command registration and unregistration logs in the console"
15
- ),
16
- "verbose-outputs" , false
20
+ ), false
17
21
);
18
22
19
23
public static final CommentedConfigOption <Boolean > SILENT_LOGS = new CommentedConfigOption <>(
20
24
List .of (
21
25
"Silent logs (default: false)" ,
22
26
"If \" true\" , turns off all logging from the CommandAPI, except for errors."
23
- ),
24
- "silent-logs" , false
27
+ ), false
25
28
);
26
29
27
30
public static final CommentedConfigOption <String > MISSING_EXECUTOR_IMPLEMENTATION = new CommentedConfigOption <>(
@@ -31,8 +34,7 @@ class DefaultedBukkitConfig {
31
34
"parameters are:" ,
32
35
" %s - the executor class (lowercase)" ,
33
36
" %S - the executor class (normal case)"
34
- ),
35
- "messages.missing-executor-implementation" , "This command has no implementations for %s"
37
+ ), "This command has no implementations for %s"
36
38
);
37
39
38
40
public static final CommentedConfigOption <Boolean > CREATE_DISPATCHER_JSON = new CommentedConfigOption <>(
@@ -41,8 +43,7 @@ class DefaultedBukkitConfig {
41
43
"If \" true\" , the CommandAPI creates a command_registration.json file showing the" ,
42
44
"mapping of registered commands. This is designed to be used by developers -" ,
43
45
"setting this to \" false\" will improve command registration performance."
44
- ),
45
- "create-dispatcher-json" , false
46
+ ), false
46
47
);
47
48
48
49
public static final CommentedConfigOption <Boolean > USE_LATEST_NMS_VERSION = new CommentedConfigOption <>(
@@ -51,8 +52,7 @@ class DefaultedBukkitConfig {
51
52
"If \" true\" , the CommandAPI will use the latest available NMS implementation" ,
52
53
"when the CommandAPI is used. This avoids all checks to see if the latest NMS" ,
53
54
"implementation is actually compatible with the current Minecraft version."
54
- ),
55
- "use-latest-nms-version" , false
55
+ ), false
56
56
);
57
57
58
58
public static final CommentedConfigOption <Boolean > BE_LENIENT_FOR_MINOR_VERSIONS = new CommentedConfigOption <>(
@@ -62,8 +62,7 @@ class DefaultedBukkitConfig {
62
62
"For example, this setting may allow updating from 1.21.1 to 1.21.2 as only the minor version is changing" ,
63
63
"but will not allow an update from 1.21.2 to 1.22." ,
64
64
"Keep in mind that implementations may vary and actually updating the CommandAPI might be necessary."
65
- ),
66
- "be-lenient-for-minor-versions" , false
65
+ ), false
67
66
);
68
67
69
68
public static final CommentedConfigOption <Boolean > SHOULD_HOOK_PAPER_RELOAD = new CommentedConfigOption <>(
@@ -75,8 +74,7 @@ class DefaultedBukkitConfig {
75
74
"function which allows CommandAPI commands to be used in datapacks." ,
76
75
"If you set this to false, CommandAPI commands may not work inside datapacks after" ,
77
76
"reloading datapacks."
78
- ),
79
- "hook-paper-reload" , false
77
+ ), false
80
78
);
81
79
82
80
public static final CommentedConfigOption <Boolean > SKIP_RELOAD_DATAPACKS = new CommentedConfigOption <>(
@@ -85,25 +83,22 @@ class DefaultedBukkitConfig {
85
83
"If \" true\" , the CommandAPI will not reload datapacks when the server has finished" ,
86
84
"loading. Datapacks will still be reloaded if performed manually when \" hook-paper-reload\" " ,
87
85
"is set to \" true\" and /minecraft:reload is run."
88
- ),
89
- "skip-initial-datapack-reload" , false
86
+ ), false
90
87
);
91
88
92
89
public static final CommentedConfigOption <List <?>> PLUGINS_TO_CONVERT = new CommentedConfigOption <>(
93
90
List .of (
94
91
"Plugins to convert (default: [])" ,
95
92
"Controls the list of plugins to process for command conversion."
96
- ),
97
- "plugins-to-convert" , new ArrayList <>()
93
+ ), new ArrayList <>()
98
94
);
99
95
100
96
public static final CommentedConfigOption <List <String >> OTHER_COMMANDS_TO_CONVERT = new CommentedConfigOption <>(
101
97
List .of (
102
98
"Other commands to convert (default: [])" ,
103
99
"A list of other commands to convert. This should be used for commands which" ,
104
100
"are not declared in a plugin.yml file."
105
- ),
106
- "other-commands-to-convert" , new ArrayList <>()
101
+ ), new ArrayList <>()
107
102
);
108
103
109
104
public static final CommentedConfigOption <List <String >> SKIP_SENDER_PROXY = new CommentedConfigOption <>(
@@ -112,34 +107,32 @@ class DefaultedBukkitConfig {
112
107
"Determines whether the proxy sender should be skipped when converting a" ,
113
108
"command. If you are having issues with plugin command conversion, add the" ,
114
109
"plugin to this list."
115
- ),
116
F438
code>
- "skip-sender-proxy" , new ArrayList <>()
110
+ ), new ArrayList <>()
117
111
);
118
112
119
- public static final List < CommentedConfigOption <?>> ALL_OPTIONS = List . of (
120
- VERBOSE_OUTPUTS ,
121
- SILENT_LOGS ,
122
- MISSING_EXECUTOR_IMPLEMENTATION ,
123
- CREATE_DISPATCHER_JSON ,
124
- USE_LATEST_NMS_VERSION ,
125
- BE_LENIENT_FOR_MINOR_VERSIONS ,
126
- SHOULD_HOOK_PAPER_RELOAD ,
127
- SKIP_RELOAD_DATAPACKS ,
128
- PLUGINS_TO_CONVERT ,
129
- OTHER_COMMANDS_TO_CONVERT ,
130
- SKIP_SENDER_PROXY
113
+ public static final Map < String , CommentedConfigOption <?>> ALL_OPTIONS = Map . ofEntries (
114
+ Map . entry ( "verbose-outputs" , VERBOSE_OUTPUTS ) ,
115
+ Map . entry ( "silent-logs" , SILENT_LOGS ) ,
116
+ Map . entry ( "messages.missing-executor-implementation" , MISSING_EXECUTOR_IMPLEMENTATION ) ,
117
+ Map . entry ( "create-dispatcher-json" , CREATE_DISPATCHER_JSON ) ,
118
+ Map . entry ( "use-latest-nms-version" , USE_LATEST_NMS_VERSION ) ,
119
+ Map . entry ( "be-lenient-for-minor-versions" , BE_LENIENT_FOR_MINOR_VERSIONS ) ,
120
+ Map . entry ( "hook-paper-reload" , SHOULD_HOOK_PAPER_RELOAD ) ,
121
+ Map . entry ( "skip-initial-datapack-reload" , SKIP_RELOAD_DATAPACKS ) ,
122
+ Map . entry ( "plugins-to-convert" , PLUGINS_TO_CONVERT ) ,
123
+ Map . entry ( "other-commands-to-convert" , OTHER_COMMANDS_TO_CONVERT ) ,
124
+ Map . entry ( "skip-sender-proxy" , SKIP_SENDER_PROXY )
131
125
);
132
126
133
127
public static final CommentedConfigOption <?> SECTION_MESSAGE = new CommentedConfigOption <>(
134
128
List .of (
135
129
"Messages" ,
136
130
"Controls messages that the CommandAPI displays to players"
137
- ),
138
- "messages" , null
131
+ ), null
139
132
);
140
133
141
- public static final List < CommentedConfigOption <?>> ALL_SECTIONS = List .of (
142
- SECTION_MESSAGE
134
+ public static final Map < String , CommentedConfigOption <?>> ALL_SECTIONS = Map .of(
135
+ "messages" , SECTION_MESSAGE
143
136
);
144
137
145
138
}
0 commit comments