Skip to content

Commit

Permalink
fix: search for hook annotations on constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Jun 17, 2024
1 parent 8c9585d commit 014bec5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions common/src/main/java/net/william278/husktowns/hook/Hook.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ public abstract class Hook {

protected Hook(@NotNull HuskTowns plugin) {
this.plugin = plugin;
this.hookInfo = Arrays.stream(this.getClass().getMethods()).filter(method ->
method.getAnnotation(PluginHook.class) != null).map(method ->
method.getAnnotation(PluginHook.class)).findFirst().orElse(null);
this.hookInfo = Arrays.stream(this.getClass().getConstructors())
.filter(con -> con.getAnnotation(PluginHook.class) != null)
.map(con -> con.getAnnotation(PluginHook.class)).findFirst()
.orElse(null);
}

/**
Expand Down

0 comments on commit 014bec5

Please sign in to comment.