File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/main/java/me/despical/commandframework Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -160,13 +160,18 @@ public void registerCommands(@NotNull Object instance) {
160
160
161
161
subCommands .forEach ((key , value ) -> {
162
162
final String splitName = key .name ().split ("\\ ." )[0 ];
163
+ boolean shouldThrowException = false ;
163
164
164
165
// This is an unsupported behaviour at least for now.
165
166
// All sub-commands must have their own main command to be registered.
166
167
if (commands .keySet ().stream ().noneMatch (cmd -> cmd .name ().equals (splitName ))) {
168
+ shouldThrowException = true ;
169
+
167
170
unregisterCommand (key .name ());
168
- throw new IllegalStateException (String .format ("You can not create sub-commands without a main command! (%s)" , key .name ()));
169
171
}
172
+
173
+ if (shouldThrowException )
174
+ throw new IllegalStateException (String .format ("You can not create sub-commands without a main command! (%s)" , key .name ()));
170
175
});
171
176
}
172
177
You can’t perform that action at this time.
0 commit comments