fix(lint,command,scheduler): lpk alias, ReturnCount/IllegalCatch triage, scheduler facade

- command: replace /lp alias with /lpk (LuckPerms conflict, p.144);
  parkour alias kept; docs/changelog/javadoc updated
- lint p.169: restructure last 69 void early-returns into if-blocks and
  helpers; ReturnCount is now an error gate (0 violations)
- lint p.170: Throwable->RuntimeException on 3 boundaries; narrow 5
  catches to concrete types; document 14 intentional boundary catches
- scheduler p.21: add runTimerAsync to the facade (Bukkit + Folia
  backends); MetricsCacheStore and duels go through the facade, no
  BukkitRunnable/Bukkit.getScheduler outside scheduler/ (archunit
  freeze-store emptied); drop the unverified Folia badge from README
- tracker: mark p.26-29/32-33 done (fixed in fea15e6, verified)
This commit is contained in:
Loki 2026-10-10 14:52:10 +02:00
parent 8ff02cff18
commit b6712391fd
Signed by: boba
GPG key ID: 253067914055423B
79 changed files with 696 additions and 800 deletions

View file

@ -28,6 +28,7 @@ final class FoliaBackend implements Scheduler.Backend {
private final Method globalRunDelayed;
private final Method globalRunAtFixedRate;
private final Method asyncRunNow;
private final Method asyncRunAtFixedRate;
private final Method taskCancel;
FoliaBackend(Plugin plugin) throws ReflectiveOperationException {
@ -40,6 +41,8 @@ final class FoliaBackend implements Scheduler.Backend {
this.globalRunAtFixedRate = method(GLOBAL_SCHEDULER_CLASS, "runAtFixedRate",
Plugin.class, Consumer.class, long.class, long.class);
this.asyncRunNow = method(ASYNC_SCHEDULER_CLASS, "runNow", Plugin.class, Consumer.class);
this.asyncRunAtFixedRate = method(ASYNC_SCHEDULER_CLASS, "runAtFixedRate",
Plugin.class, Consumer.class, long.class, long.class);
this.taskCancel = Class.forName(SCHEDULER_PACKAGE + "ScheduledTask").getMethod("cancel");
}
@ -64,6 +67,12 @@ final class FoliaBackend implements Scheduler.Backend {
consumer(task), delayTicks, periodTicks));
}
@Override
public ScheduledTask runTimerAsync(Runnable task, long delayTicks, long periodTicks) {
return wrap(invoke(asyncRunAtFixedRate, asyncScheduler, plugin,
consumer(task), delayTicks, periodTicks));
}
private static Object scheduler(String bukkitGetter) throws ReflectiveOperationException {
return Bukkit.class.getMethod(bukkitGetter).invoke(null);
}