ru.cwcode.commands.paperplatform.executor.AsyncExecutor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of PaperCommands Show documentation
Show all versions of PaperCommands Show documentation
Commands library for Paper (Minecraft)
The newest version!
package ru.cwcode.commands.paperplatform.executor;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import ru.cwcode.commands.ArgumentParser;
import ru.cwcode.commands.ArgumentSet;
import ru.cwcode.commands.Command;
import ru.cwcode.commands.api.Sender;
import ru.cwcode.commands.paperplatform.PaperMain;
public abstract class AsyncExecutor extends Executor {
@Override
public void prepare(Sender sender, String[] args, ArgumentSet argumentSet, Command command) {
this.parser = new ArgumentParser(args, argumentSet);
this.sender = sender;
this.command = command;
Bukkit.getScheduler().runTaskAsynchronously(PaperMain.plugin, () -> {
try {
if (sender instanceof Player) {
executeForPlayer();
} else {
executeForNonPlayer();
}
} catch (Exception e) {
handleError(e);
}
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy