Skip to content

Commit

Permalink
Fix strict hook loading (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
KaspianDev authored May 30, 2024
1 parent b72d7d1 commit beb2cc6
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/main/java/me/hsgamer/yatpa/hook/HookManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ public HookManager(YATPA plugin) {
}

public void addHook(String pluginName, Class<? extends Hook> hookClass) {
if (!Bukkit.getPluginManager().isPluginEnabled(pluginName)) {
throw new IllegalArgumentException("Cannot add a Hook because plugin " + pluginName + " isn't loaded");
}
if (!Bukkit.getPluginManager().isPluginEnabled(pluginName)) return;
try {
Hook hook = hookClass.getDeclaredConstructor(YATPA.class, String.class).newInstance(plugin, pluginName);
registeredHooks.add(hook);
Expand Down

0 comments on commit beb2cc6

Please sign in to comment.