Skip to content

Commit

Permalink
auto registration fix issue with no command node
Browse files Browse the repository at this point in the history
Close #48
  • Loading branch information
ikfir committed Jun 15, 2024
1 parent 2597a83 commit d77e10f
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.google.common.reflect.ClassPath;
import net.apartium.cocoabeans.Dispensers;
import net.apartium.cocoabeans.Ensures;
import net.apartium.cocoabeans.commands.Command;
import net.apartium.cocoabeans.commands.CommandManager;
import net.apartium.cocoabeans.commands.CommandNode;
import net.apartium.cocoabeans.spigot.Commands;
Expand All @@ -27,6 +26,15 @@
*/
public class CommandAutoRegistration {

private static Class<?> COMMAND_NODE_CLASS;
{
try {
COMMAND_NODE_CLASS = Class.forName("net.apartium.cocoabeans.commands.CommandNode");
} catch (ClassNotFoundException e) {
COMMAND_NODE_CLASS = null;
}
}

private final JavaPlugin
plugin;

Expand Down Expand Up @@ -107,7 +115,7 @@ public void register(String packageName, boolean deep) {
continue;
}

if (CommandNode.class.isAssignableFrom(clazz)) {
if (COMMAND_NODE_CLASS != null && COMMAND_NODE_CLASS.isAssignableFrom(clazz)) {
handleCommandNode(clazz);
continue;
}
Expand Down

0 comments on commit d77e10f

Please sign in to comment.