This commit is contained in:
Alexander Brandes 2023-03-05 10:42:15 +01:00
parent ad522358c7
commit b8b5dd8d13
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
4 changed files with 33 additions and 42 deletions

View File

@ -107,8 +107,7 @@ public class Clear extends Command {
}
BackupManager.backup(player, plot, () -> {
final long start = System.currentTimeMillis();
boolean result = plot.getPlotModificationManager().clear(true, false, player, () -> {
TaskManager.runTask(() -> {
boolean result = plot.getPlotModificationManager().clear(true, false, player, () -> TaskManager.runTask(() -> {
plot.removeRunning();
// If the state changes, then mark it as no longer done
if (DoneFlag.isDone(plot)) {
@ -136,8 +135,7 @@ public class Clear extends Command {
.tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
.build()
);
});
});
}));
if (!result) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
} else {

View File

@ -46,6 +46,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeoutException;
@ -813,11 +814,7 @@ public class Cluster extends SubCommand {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
} else {
final String owner;
if (username == null) {
owner = "unknown";
} else {
owner = username;
}
owner = Objects.requireNonNullElse(username, "unknown");
String name = cluster.getName();
String size = (cluster.getP2().getX() - cluster.getP1().getX() + 1) + "x" + (
cluster.getP2().getY() - cluster.getP1().getY() + 1);

View File

@ -220,9 +220,8 @@ public class Purge extends SubCommand {
try {
ids.add(plot.temp);
if (finalClear) {
plot.getPlotModificationManager().clear(false, true, player, () -> {
LOGGER.info("Plot {} cleared by purge", plot.getId());
});
plot.getPlotModificationManager().clear(false, true, player,
() -> LOGGER.info("Plot {} cleared by purge", plot.getId()));
} else {
plot.getPlotModificationManager().removeSign();
}

View File

@ -36,6 +36,7 @@ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nullable;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
/**
@ -92,11 +93,7 @@ public class DefaultProgressSubscriber implements ProgressSubscriber {
this.actor = actor;
this.interval = TaskTime.ms(interval);
this.wait = TaskTime.ms(wait);
if (caption == null) {
this.caption = TranslatableCaption.of("working.progress");
} else {
this.caption = caption;
}
this.caption = Objects.requireNonNullElseGet(caption, () -> TranslatableCaption.of("working.progress"));
}
@Override