refactor: drop lolib, add own scheduler, inventory GUI and void generator
This commit is contained in:
parent
cc521dc284
commit
7e227e39a4
47 changed files with 708 additions and 113 deletions
|
|
@ -0,0 +1,36 @@
|
|||
package dev.loki.loparkour.scheduler;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Scheduler backend for Bukkit/Paper servers.
|
||||
*/
|
||||
final class BukkitBackend implements Scheduler.Backend {
|
||||
|
||||
private final Plugin plugin;
|
||||
|
||||
BukkitBackend(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledTask run(Runnable task) {
|
||||
return Bukkit.getScheduler().runTask(plugin, task)::cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledTask runAsync(Runnable task) {
|
||||
return Bukkit.getScheduler().runTaskAsynchronously(plugin, task)::cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledTask runLater(Runnable task, long delayTicks) {
|
||||
return Bukkit.getScheduler().runTaskLater(plugin, task, delayTicks)::cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledTask runTimer(Runnable task, long delayTicks, long periodTicks) {
|
||||
return Bukkit.getScheduler().runTaskTimer(plugin, task, delayTicks, periodTicks)::cancel;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue