mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-02-06 04:05:28 +01:00
Add missed locking onto expansions
This commit is contained in:
parent
0798d94449
commit
74423d6dc0
@ -281,9 +281,14 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public boolean unregister(@NotNull final PlaceholderExpansion expansion) {
|
public boolean unregister(@NotNull final PlaceholderExpansion expansion) {
|
||||||
|
expansionsLock.lock();
|
||||||
|
try {
|
||||||
if (expansions.remove(expansion.getIdentifier()) == null) {
|
if (expansions.remove(expansion.getIdentifier()) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
expansionsLock.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
Bukkit.getPluginManager().callEvent(new ExpansionUnregisterEvent(expansion));
|
Bukkit.getPluginManager().callEvent(new ExpansionUnregisterEvent(expansion));
|
||||||
|
|
||||||
@ -335,6 +340,8 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void unregisterAll() {
|
private void unregisterAll() {
|
||||||
|
expansionsLock.lock();
|
||||||
|
try {
|
||||||
for (final PlaceholderExpansion expansion : Sets.newHashSet(expansions.values())) {
|
for (final PlaceholderExpansion expansion : Sets.newHashSet(expansions.values())) {
|
||||||
if (expansion.persist()) {
|
if (expansion.persist()) {
|
||||||
continue;
|
continue;
|
||||||
@ -342,6 +349,9 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
|
|
||||||
expansion.unregister();
|
expansion.unregister();
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
expansionsLock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
Loading…
Reference in New Issue
Block a user