Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Mar 20, 2024
1 parent 123c0d0 commit 005f26b
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ private void onBlockPlace(BlockPlaceEvent event) {
if (!player.hasPermission(Permissions.Optimize.WORKSTATION.get())) return;

final Location workstationLoc = placed.getLocation();
final AtomicBoolean done = new AtomicBoolean(false);
final AtomicInteger taskAliveTicks = new AtomicInteger(check_duration_ticks);
final AtomicBoolean taskComplete = new AtomicBoolean();
final AtomicInteger taskAliveTicks = new AtomicInteger();

scheduler.runAtLocationTimer(workstationLoc, lingeringRepeatingCheck -> {
if (done.get() || taskAliveTicks.getAndAdd(-10) <= 0) {
lingeringRepeatingCheck.cancel();
scheduler.runAtLocationTimer(workstationLoc, repeatingTask -> {
if (taskComplete.get() || taskAliveTicks.getAndAdd(10) > check_duration_ticks) {
repeatingTask.cancel();
return;
}

Expand All @@ -116,7 +116,7 @@ private void onBlockPlace(BlockPlaceEvent event) {
VillagerOptimizer.getLang(player.locale()).nametag_on_optimize_cooldown
.forEach(line -> KyoriUtil.sendMessage(player, line.replaceText(timeLeft)));
}
done.set(true);
taskComplete.set(true);
return;
}

Expand Down Expand Up @@ -151,7 +151,7 @@ private void onBlockPlace(BlockPlaceEvent event) {
GenericUtil.formatLocation(wrapped.villager().getLocation())).color(GenericUtil.COLOR));
}

done.set(true);
taskComplete.set(true);
return;
}
}, 1L, 10L);
Expand Down

0 comments on commit 005f26b

Please sign in to comment.