Skip to content

Commit 475bbf7

Browse files
committed
bug fix
1 parent 9908332 commit 475bbf7

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/main/java/org/maxgamer/quickshop/util/reload/ReloadManager.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ public synchronized void unregister(@NotNull Method reloadMethod) {
7777
* @param reloadable Reloadable module
7878
*/
7979
public synchronized void unregister(@NotNull Reloadable reloadable) {
80-
this.registry.removeIf(reloadableContainer -> reloadableContainer != null && Objects.equals(reloadableContainer.getReloadable(), reloadable));
80+
this.registry.removeIf(reloadableContainer -> {
81+
if (reloadableContainer != null) {
82+
if (reloadableContainer.getReloadable() != null) {
83+
return Objects.equals(reloadableContainer.getReloadable().get(), reloadable);
84+
}
85+
}
86+
return false;
87+
});
8188
}
8289

8390
/**
@@ -88,7 +95,11 @@ public synchronized void unregister(@NotNull Reloadable reloadable) {
8895
public synchronized void unregister(@NotNull Class<Reloadable> clazz) {
8996
this.registry.removeIf(reloadable -> {
9097
if (reloadable.getReloadable() != null) {
91-
return clazz.equals(reloadable.getReloadable().getClass());
98+
Reloadable rable = reloadable.getReloadable().get();
99+
if (rable != null) {
100+
return clazz.equals(rable.getClass());
101+
}
102+
return false;
92103
}
93104
if (reloadable.getReloadableMethod() != null) {
94105
Method method = reloadable.getReloadableMethod();
@@ -125,7 +136,12 @@ public synchronized Map<ReloadableContainer, ReloadResult> reload(@Nullable Clas
125136
ReloadableContainer reloadable = iterator.next();
126137
if (clazz != null) {
127138
if (reloadable.getReloadable() != null) {
128-
if (!clazz.equals(reloadable.getReloadable().getClass())) {
139+
Reloadable rable = reloadable.getReloadable().get();
140+
if (rable != null) {
141+
if (!clazz.equals(reloadable.getReloadable().getClass())) {
142+
continue;
143+
}
144+
} else {
129145
continue;
130146
}
131147
}

0 commit comments

Comments
 (0)