mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
fix: synchronize confirmExpiry (#3481)
Prevents that the MetaDataAccess is closed before setting the data
This commit is contained in:
parent
16928b05f1
commit
951767dc64
@ -136,18 +136,18 @@ public class ExpireManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void confirmExpiry(final PlotPlayer<?> pp) {
|
public void confirmExpiry(final PlotPlayer<?> pp) {
|
||||||
try (final MetaDataAccess<Boolean> metaDataAccess = pp.accessTemporaryMetaData(
|
TaskManager.runTask(() -> {
|
||||||
PlayerMetaDataKeys.TEMPORARY_IGNORE_EXPIRE_TASK)) {
|
try (final MetaDataAccess<Boolean> metaDataAccess = pp.accessTemporaryMetaData(
|
||||||
if (metaDataAccess.isPresent()) {
|
PlayerMetaDataKeys.TEMPORARY_IGNORE_EXPIRE_TASK)) {
|
||||||
return;
|
if (metaDataAccess.isPresent()) {
|
||||||
}
|
return;
|
||||||
if (plotsToDelete != null && !plotsToDelete.isEmpty() && pp.hasPermission("plots.admin.command.autoclear")) {
|
}
|
||||||
final int num = plotsToDelete.size();
|
if (plotsToDelete != null && !plotsToDelete.isEmpty() && pp.hasPermission("plots.admin.command.autoclear")) {
|
||||||
while (!plotsToDelete.isEmpty()) {
|
final int num = plotsToDelete.size();
|
||||||
Iterator<Plot> iter = plotsToDelete.iterator();
|
while (!plotsToDelete.isEmpty()) {
|
||||||
final Plot current = iter.next();
|
Iterator<Plot> iter = plotsToDelete.iterator();
|
||||||
if (!isExpired(new ArrayDeque<>(tasks), current).isEmpty()) {
|
final Plot current = iter.next();
|
||||||
TaskManager.runTask(() -> {
|
if (!isExpired(new ArrayDeque<>(tasks), current).isEmpty()) {
|
||||||
metaDataAccess.set(true);
|
metaDataAccess.set(true);
|
||||||
current.getCenter(pp::teleport);
|
current.getCenter(pp::teleport);
|
||||||
metaDataAccess.remove();
|
metaDataAccess.remove();
|
||||||
@ -171,15 +171,15 @@ public class ExpireManager {
|
|||||||
cmd_keep,
|
cmd_keep,
|
||||||
cmd_no_show_expir
|
cmd_no_show_expir
|
||||||
);
|
);
|
||||||
});
|
return;
|
||||||
return;
|
} else {
|
||||||
} else {
|
iter.remove();
|
||||||
iter.remove();
|
}
|
||||||
}
|
}
|
||||||
|
plotsToDelete.clear();
|
||||||
}
|
}
|
||||||
plotsToDelete.clear();
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -307,6 +307,7 @@ public class ExpireManager {
|
|||||||
this.running = 2;
|
this.running = 2;
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
private ConcurrentLinkedDeque<Plot> plots = null;
|
private ConcurrentLinkedDeque<Plot> plots = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final Runnable task = this;
|
final Runnable task = this;
|
||||||
|
Loading…
Reference in New Issue
Block a user